Add events using our API

Automatically add your code deployments or modifications of your system configuration

These advanced events can be created only in an automated way via our API. The best way to use them is to incorporate a request to our API in your code deployment scripts (to do so by your agency) and in your configuration management tool (to do so by your provider).

20170317-code-deploy.png

Our API can be accessed via a simple HTTP request: "https://www.quanta-monitoring.com/api/events/push"The parameters to be entered are as follows:

  • Type: The type of the event. It can either be "code_deploy" (deployment code), "config_change" (system configuration change), "comment" (comment), "cron" (background job) or "custom" (generic event)
  • Content: The message associated with the event. This may be the version of the application or the changes made. You are free to use this field as you like.
  • You must also specify an API token to authenticate the request. This token can be generated in the "Integrations" section of your site settings in QUANTA.
    You can also add a custom icon in order to easily identify events added in this way.

This token must be either:

  • Inserted in the HTTP header "Authorization" in the form: Authorization Token <your_token>
  • Passed directly in the query by adding this parameter at the end of the URL: ?auth_token=<your_token>

Sample query with cURL which adds a code deployment event with the message "Version 42.0". We see the presence of the header "Content-Type" which is essential for our API to consider the query: 

curl -m 10 -X POST -d '{"type": "code_deploy", "content": "version 42.0"}' -H 'Content-Type: application/json' -H 'Authorization: Token 78e64233e09d3d8ec7bf73c4d9ea8a8851badbd216' https://www.quanta-monitoring.com/api/events/push 

If you wish to integrate events via another service which does not allow for POST queries, you can use the API via a GET query. E.g. the following command adds a generic event ("custom") with the content "hello" using cURL:

curl -m 10 https://www.quanta-monitoring.com/api/events/push?content=hello&type=custom&auth_token=78e64233e09d3d8ec7bf73c4d9ea8a8851badbd216

NB: In the 2 requests/queries above, the -m option of cURL can position a timeout to 10 seconds so as not to  to block your scripts in the case of an unavailability of our API.

Our API will send back an  HTTP 200 code if successful, and a  4xx or 5xx if there was an error. The response will contain a JSON content with the field "error" in case of error or "success" if successful.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.