Reference
HTTP API

API Reference (HTTP API)

Endpoints

GET /api/v1/data/:projectId

Returns the data for the given project.

Query Parameters

  • environment: The environment to filter by

Path Parameters

  • projectId: The project ID.

Response

{
  "tests": [
    {
      "name": "Test 1",
      "weights": [0.5, 0.5]
    }
  ],
  "flags": [
    {
      "name": "Flag 1",
      "value": true
    }
  ],
  "remoteConfig": [
    {
      "name": "Remote Config 1",
      "value": "Foobar"
    }
  ]
}

GET /api/v1/data/:projectId/script.js

Gives the same response as /api/v1/data/:projectId, but in JavaScript format. You can use this endpoint to load the data in the browser using a <script> tag. This is useful if you want to load the data in the browser without having to wait for the UI framework to load and hydrate. This is mostly the case for SPAs

Query Parameters

  • environment: The environment to filter by.

Path Parameters

  • projectId: The project ID.

Response

window.__abby_data__ = {
  tests: [
    {
      name: "Test 1",
      weights: [0.5, 0.5],
    },
  ],
  flags: [
    {
      name: "Flag 1",
      value: true,
    },
  ],
  remoteConfig: [
    {
      name: "Remote Config 1",
      value: "Foobar",
    },
  ],
};

POST /api/v1/track

Tracks an event.

Request Body

The type field can be either 0 (track view) or 1 (track interaction).

{
  "type": 1,
  "projectId": "<PROJECT_ID>",
  "testName": "<TEST_NAME>",
  "selectedVariant": "<SELECTED_VARIANT>"
}