How to send events via API

You are here:
Estimated reading time: 1 min

Please check our API Overview before continuing.

User endpoint base is event/ so for version 1 of our API you will use:

https://api.vtcdn.net/v1/event/

Request format:

For this endpoint you will need to pass 2 objects: user and event.

Both are mandatory and have the following structure:

  • User: object with email or _id as identifier.
  • Event: same format as Javascript event

Create new event [POST]

POST /
Request example:
{
 "user": {"email": "[email protected]"}
 "event": {"update": {"firstname": "alexandru"} }
}

Note that user must exist in the database beforehand. Otherwise you will receive an error.

Sending generic events:

Request example:
{
 "user": {"email": "[email protected]"}
 "event": {"generic": {"generic": {"event_name": "my_event", "firstname": "alexandru"} } }
}

Responses examples:

Response (HTTP status code: 200)

{
  "results": {
    "message": "Event created",
    "email": "Event was created for the specified user"
  }
}

Response (HTTP status code: 400)

{
  "errors": [
    {
      "message": "Missing event information",
      "description": "Please send event information along with user",
    }
  ]
}

How to test:

  1. Make request using your desired programming language. You can test using an app like Postman.
  2. Make sure received response has a 200 status code.
  3. Wait a little and check user profile and see if event was saved on it’s profile
Was this article helpful?
Dislike 0
Views: 53