logo

CALLGOOSE

API - Request

This guide helps you use the Request 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/request

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


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/request?token=xxxx




Create Request

Endpoint

/v1/request

This API endpoint allows you to create Request. You can create Request for running Automation Workflow.


Payload

The API expects the payload to be in JSON format.

The payload must include the key workflowId with the Public ID of the Automation Workflow you want to run as its value.

Additionally, specify any custom variables defined in the Automation Workflow.

  • Use the custom variable name as the JSON key.
  • Provide the corresponding value.


Example:

To run an Automation Workflow with

public id: ghty****hjfhjj

Custom variables:

  • name
  • email

The payload would look like this:

{
    "workflowId": "ghty****hjfhjj",
    "name": "John Doe",
    "email": "john@***.com"
}



Response

Based on the payload content and API token, we will process the payload.

The response data you receive will be:

{
    "id": "api-id",
    "created": true/false // true if a new Request was created
}


The response code you receive will be:

201 - Successfully processed the API request and created Request.

202 - Successfully processed the API request but there is no valid Automation Workflow applicable for the payload.

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 Request token and not Incident 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 '{
    "workflowId": "ghty****hjfhjj",
    "name": "John Doe",
    "email": "john@***.com"
  }'


PYTHON

import requests
import json

url = "https://************"
payload = {
    "workflowId": "ghty****hjfhjj",
    "name": "John Doe",
    "email": "john@***.com"
}
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 = "{" +
          "  \"workflowId\": \"ghty****hjfhjj\"," +
          "  \"name\": \"John Doe\","+
          "  \"email\": \"john@***.com\""+
          "  }";
  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({
  "workflowId": "ghty****hjfhjj",
  "name": "John Doe",
  "email": "john@***.com"
});
  
$.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({  
    "workflowId": "ghty****hjfhjj",
    "name": "John Doe",
    "email": "john@***.com"
});

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