logo

CALLGOOSE

API - Incident

This guide helps you use the Incident API endpoints effectively.



Prerequisites


1. Find the Base URL

You can locate the base URL in Dashboard → API Token tab. Go to here for more details.


2. Construct the Final Endpoint

The Final Endpoint = Base URL + API endpoint.

Example:

The Base URL is: https://sqibs.callgoose.com/sqibs-api

Api endpoint is: /v1/process

The Final Endpoint will be: https://sqibs.callgoose.com/sqibs-api/v1/process


3. Authentication Token

Use a valid API token. Go to here for more details.

You need to include the API token with every API request by using as a Bearer Token in headers or as a URL request parameter.

a. Bearer Token

If the caller support header then you can use the API Token as a Bearer token.

Use the Header named Authorization and use Bearer <API_TOKEN> as the value.

In the following examples we are using this method.


b. URL Parameter

If the caller doesn’t support header customization, then we can use API Token as a value of URL parameter named token.

Example: https://sqibs.callgoose.com/sqibs-api/v1/process?token=xxxx




Create Incident

Endpoint

/v1/process

This API endpoint allows you to create Incident.


Payload

The API expects the payload to be in JSON format. Ensure that you are using the correct payload structure that used to create the Api Filter. If the filter validation fails, the incident will not be created.

We only support string/text type Content-type(application/json, text/plain, text/html, etc...). Unsupported Content-type payload(audio/mpeg, image/png, etc...) will be considered as empty payload.


Response

Based on the payload content and API token, we will process the payload with Api Filter you created earlier.

The response data you receive will be:

{
    "id": "api-id",
    "resolved": { // incident resolved detailed object
      "duplicate": true/false, // true if the request was a duplicate within a specific time
      "resolved": true/false // true if the resolved filter is successful
    },
    "triggered": { // incident triggered detailed object
      "duplicate": true/false, // true if the request was a duplicate within a specific time
      "created": true/false // true if a new incident was created
    }
}


The response code you receive will be:

200 - Successfully processed the API request and resolved Incident(s).

201 - Successfully processed the API request and created Incident(s) and resolved if applicable.

202 - Successfully processed the API request but there is no valid filter available to create/resolve Incident.

208 - Duplicate API request. We have already got and processed a similar one earlier within a specific time limit.

🚫 401 - Unauthorized request. API Token is not valid. Make sure you are using a Incident token and not Request token.

500 - Server encountered a temporary error and could not complete the request at that moment. Please try again.



Usage Examples

Find the preferred language of your choice from the examples and use the code to test and implement.

If your language is not listed, you can easily create your own version by converting the cURL example.


cURL

curl --location --request POST 'https://************' \
  --header 'Authorization: Bearer <api_token>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "title": "This is title",
    "content": "This is content"
  }'


PYTHON

import requests
import json

url = "https://************"
payload = {
    "title": "This is title",
    "content": "This is content"
}
headers = {
    "Authorization": "Bearer <api_token>",
    "Content-Type": "application/json"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))

print("Status Code:", response.status_code)
print("Response:", response.json())


JAVA

private void sendApiCall() throws IOException {
  String POST_DATA_IN_STRING = "{" +
          "  \"title\": \"This is title\"," +
          "  \"content\": \"This is content\""+
          "  }";
  URL obj = new URL("https://*********");
  HttpURLConnection postConnection = (HttpURLConnection) obj.openConnection();
  postConnection.setConnectTimeout(5000);
  postConnection.setRequestMethod("POST");
  postConnection.setRequestProperty("Content-Type", "application/json");
  postConnection.setRequestProperty("Authorization", "Bearer <api_token>");
  postConnection.setDoOutput(true);
  OutputStream os = postConnection.getOutputStream();
  os.write(POST_DATA_IN_STRING.getBytes(StandardCharsets.UTF_8));
  os.flush();
  os.close();
  String response = postConnection.getResponseMessage();
  System.out.println("Response: "+ response);
}


JAVASCRIPT

var payload = JSON.stringify({
  "title" : "This is title",
  "content" : "This is content"   
});
  
$.ajax({
  type: 'POST',
  url: 'https://*********',
  dataType: "json",
  contentType: "application/json; charset=utf-8",
  data: JSON.stringify({ title: 'This is title', content: 'This is content' }),
  headers:{
         'Authorization': 'Bearer <api_token>',
         'Content-Type': 'application/json'   
    },
  success: function(response) { 
      console.log(response)
  },
  error: function(error){
      console.log(error)
  }
});


NODE JS

const axios = require('axios');

const data = JSON.stringify({  
    "title": "This is title",   
    "content": "This is content" 
});

const config = {
  method: 'post',
  url: 'https://*********',
  headers:{
         'Authorization': 'Bearer <api_token>',
         'Content-Type': 'application/json'   
    },
  data: data
};

axios(config)
.then(response => {
       console.log(JSON.stringify(response.data)); 
})
.catch(error => {
    console.log(error); 
});


Note:
• Replace the https://************ with the Final API endpoint.
• Replace the Bearer <api_token> with your API Token.

CALLGOOSE
SQIBS

Advanced Automation platform with effective On-Call schedule, real-time Incident Management and Incident Response capabilities that keep your organization more resilient, reliable, and always on

Callgoose SQIBS can Integrate with any applications or tools you use. It can be monitoring, ticketing, ITSM, log management, error tracking, ChatOps, collaboration tools or any applications

Callgoose providing the Plans with Unique features and advanced features for every business needs at the most affordable price.



Unique Features

  • 30+ languages supported
  • IVR for Phone call notifications
  • Dedicated caller id
  • Advanced API & Email filter
  • Tag based maintenance mode
Book a Demo

Signup for a freemium plan today &
Experience the results.

No credit card required