OCPP Messages

GET /api/ocpp-messages

Retrieve a list of OCPP (Open Charge Point Protocol) messages for a specific charger.

Parameters

Parameters should be passed as query parameters on the URL.

  • chargerId - Required The ID of the charger to retrieve messages for

  • startTimestamp - ISO 8601 date string to filter to messages created after this time (defaults to 24 hours ago)

  • endTimestamp - ISO 8601 date string to filter to messages created before this time (defaults to current time)

  • messageType - Filter messages by message type. Can be a single message type (e.g., messageType=Authorize) or multiple message types (e.g., messageType[]=StartTransaction&messageType[]=StopTransaction).

  • limit - Maximum number of messages to return (defaults to 50, maximum 500)

  • nextPageCursor - When the filters match more than one page of data, pass this parameter to fetch the next page

The date range must be less than 8 days long. If you need more than 8 days of OCPP messages, please make multiple API requests.

Response

Messages will be sorted with the newest first, so that by default when you call the endpoint you get the latest messages.

The JSON response will contain a data field with a list of OCPP messages matching the filters, and a pagination field containing pagination details.

{
  data: {
    id: number;
    createdAt: string; // ISO 8601 format
    ocppChargerIdentity: string;
    messageType: string; // OCPP message type (e.g., 'Authorize', 'StartTransaction', 'GetConfiguration')
    messagePayload: any; // The original OCPP message payload
    messageResponse: any; // The OCPP response or error message
    chargerId: number;
    protocol: string; // OCPP protocol version ('ocpp1.6' or 'ocpp2.0.1')
  }
  [];
  pagination: {
    hasNextPage: boolean;
    nextPageCursor: string | null;
  }
}

Example request and response

Request:

curl "https://api.getflipturn.com/api/ocpp-messages?chargerId=123&startTimestamp=2024-04-30T01:00:07.321Z" -H "Authorization: Bearer {token}"

Filtering by a single message type:

curl "https://api.getflipturn.com/api/ocpp-messages?chargerId=123&messageType=Authorize" -H "Authorization: Bearer {token}"

Filtering by multiple message types:

curl "https://api.getflipturn.com/api/ocpp-messages?chargerId=123&messageType[]=StartTransaction&messageType[]=StopTransaction" -H "Authorization: Bearer {token}"

Response:

{
  "data": [  {
    "id": 456,
    "createdAt": "2024-04-30T01:00:07.321Z",
    "ocppChargerIdentity": "test-charger-1",
    "messageType": "Authorize",
    "messagePayload": {
      "idTag": "test-tag-1"
    },
    "messageResponse": {
      "idTagInfo": {
        "status": "Accepted"
      }
    },
    "chargerId": 123,
    "protocol": "ocpp1.6"
  },
  {
    "id": 457,
    "createdAt": "2024-04-30T01:05:12.456Z",
    "ocppChargerIdentity": "test-charger-1",
    "messageType": "StartTransaction",
    "messagePayload": {
      "connectorId": 1
    },
    "messageResponse": {
      "transactionId": 12345
    },
    "chargerId": 123,
    "protocol": "ocpp1.6"
  }],
  "pagination": {
    "hasNextPage": false,
    "nextPageCursor": null
  }
}

Message responses in case of error

Generally, both the request and response for each message is a JSON object. However, in special cases, the response can be a string only. For example:

  • FlipturnRequestTimeout is used as the response if the request to the charger timed out

  • NotSupported is used as the response if the charger or server doesn't support this message type

Last updated