Universal Connector

This API endpoint allows you to send badge events to a specific connector identified by its unique UUID. Each event contains user-related data including email, timestamp, and a lock identifier.

  • HTTP Method: POST
  • Endpoint Path Parameter:
    • uuid (string): The unique identifier of the connector.

Request Payload

The request payload must be sent in JSON format and conform to the following type definitions:

Type Definitions

export type ConnectorPayload = {
  events: ConnectorEvent[];
};

export type ConnectorEvent = {
  email: string;
  timestamp: string;
  lockId: string;
}; 

Payload Description

  • events: An array of objects, where each object represents a badge event. Each event object must include the following fields:
    • email (string): The email address of the user associated with the event.
    • timestamp (string): The timestamp for when the event occurred. This should be in ISO 8601 format.
    • lockId (string): A unique identifier representing the lock (or session) associated with the event.

Example Request Payload

{
  "events": [
    {
      "email": "user@example.com",
      "timestamp": "2025-02-05T15:30:00Z",
      "lockId": "lock-1234"
    },
    {
      "email": "anotheruser@example.com",
      "timestamp": "2025-02-05T15:32:00Z",
      "lockId": "lock-5678"
    }
  ]
}

Request Headers

Include the following headers in your request:

  • Content-Type: application/json
  • Authorization: Access-Token YOUR_ACCESS_TOKEN

Response

{
  "status": "success",
  "message": "Badge events processed successfully."
}

Error Responses

  • HTTP Status Code: 400 Bad Request.
    Description: Returned if the specified connector uuid does not exist.
{
  "status": "error",
  "message": "Invalid payload: missing required fields."
}
  • HTTP Status Code: 404 Not Found
    Description: Returned if the specified connector uuid does not exist
{
  "status": "error",
  "message": "Connector not found."
}
  • HTTP Status Code: 500 Internal Server Error
    Description: Returned if an unexpected error occurs on the server.
{
  "status": "error",
  "message": "An unexpected error occurred. Please try again later."
}

Code Sample

cURL Example

curl -X POST "https://api.robinpowered.com/v1.0/connectors/YOUR_CONNECTOR_UUID/presence" \
     -H "Content-Type: application/json" \
     -H "Authorization: Access-Token YOUR_ACCESS_TOKEN" \
     -d '{
           "events": [
             {
               "email": "user@example.com",
               "timestamp": "2025-02-05T15:30:00Z",
               "lockId": "lock-1234"
             }
           ]
         }'

Additional Notes

  • Timestamp Format: Ensure that the timestamp is provided in ISO 8601 format (YYYY-MM-DDTHH:mm:ssZ).
  • Validation: The server will validate the structure of the payload. Make sure all required fields (email, timestamp, lockId) are present for each event.
  • Rate Limiting: Check your API rate limits to avoid hitting the maximum number of requests per minute.