API Endpoints

API Endpoints

The Oppizi API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication.

Authentication

To use the API endpoints, you need to add your secret key to the request’s authorization header. Except for the public authorization endpoint.

curl https://developer-api.oppizi.com/* \
  -H "Authorization: Bearer YOUR_SECRET_KEY"

Create event

Publish a new event.

eventName and value are required.

Endpoint

POST https://developer-api.oppizi.com/events

Parameters

eventName required
Name of event

value required
Value of event

metadata optional
Could be key/value as string or string[].
Supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 256 characters maximum.

Request body

{
  "eventName": "Purchase",
  "value": 250,
  "metadata": {
    "orderId": 182394
  }
}

Example

fetch('https://developer-api.oppizi.com/events', {
  method: 'POST',
  headers: new Headers({
    'Content-Type': 'application/json',
    Authorization: 'Bearer YOUR_SECRET_KEY',
  }),
  body: JSON.stringify({
    eventName: 'Purchase',
    value: 250,
    metadata: {
      amount: 250,
    },
  }),
});

Get events

Returns a list of your events. The events are sorted by creation date, from newest to oldest. You can filter events by metadata, name and value.

Endpoint

GET https://developer-api.oppizi.com/events

Parameters

startingAfter optional
A cursor used for pagination. You get the value from the response of the previous page.

limit optional
A limit on the number of rooms to be returned. The limit can range between 1 and 100, and defaults to 20.

Minimum: 1
Maximum: 100
Default: 20

eventName optional
Name of event(s)

value optional
Value of event(s)

metadata.KEY optional
A filter on metadata. Multiple metadata keys can be used to filter rooms.

metadata.amount=100

Example

fetch(
  'https://developer-api.oppizi.com/events?eventName=Purchase&metadata.amount=100',
  {
    method: 'GET',
    headers: new Headers({
      'Content-Type': 'application/json',
      Authorization: 'Bearer YOUR_SECRET_KEY',
    }),
  },
);
Last updated on December 7, 2023