Create Event

DESCRIPTION

To create a new event. If the given fields are not enough, to add more information to your event use the "properties" field and add additional data with key-value objects.

DEFINITION

POST https://api.anodot.com/api/v1/user-events?token=<api token>

HEADERS

Content-type=application/json

BODY

{
"event": {
    "title": "<event title>",
    "description": "<event description>",
    "category": "<category name>",
    "source": "<source name>",
    "properties":[
     {
        "key":"<key1>",
        "value": "<value1>"
      },
      {
        "key": "<key2>",
        "value": "<value2>"
      }
    ],
    "startDate": "<epoch start date>",
    "endDate": "<epoch end date>"
  }

 ARGUMENT\ DEFINITION

Title  

The event's title [required

Description

A description of the event. [optional]

Category

The name of the pre-defined category that the event belongs to (e.g deployments, marketing_campaigns, Jewish_holidays) [required].
If a relevant category does not exist, create one.
To create a new category, see Create Category.

Source

The pre-defined source of the request (e.g rest_api, Chef, Jenkins) [required].
If the source does not exist, add it. 
To add a new source, see Create Source.
Properties key-value pairs, can be whatever the user wants to add as additional data except the ones that are already part of the body arguments like title, description, category and so on. E.g:  severity:high, publisher: nyt, exchange: rubicon. [optional]
StartDate The start time of the event. Needs to be in epochtime (seconds)[requiredl].
EndDate The end time of the event. Needs to be in epochtime (seconds) [optional]

EXAMPLE REQUEST

 curl \
-X POST \
-d '{"event":{"title":"deployment started on myServer","description":"my description","category":"deployments","source":"chef","properties":[{"key":"service","value":"myService"}],"startDate":"1468326864"}}' \
-H "Content-Type:application/json" \
'https://api.anodot.com/api/v1/user-events?token=<API TOKEN>'

EXAMPLE RESPONSE

 {
   "id":"b1229900-1a49-4b9e-a2e4-b9d21240793f",
   "title":"deployment started on myServer",
   "description":"my description",
   "source":"chef",
   "category":"deployments",
   "startDate":1468326864,
   "endDate":null,
   "properties":[
      {
         "key":"service",
         "value":"myService"
      }
   ]
}

Note: For more details about example responses, see Success and Errors

Was this article helpful?
0 out of 0 found this helpful