Chilkat Online Tools

DataFlex / Squadcast API V3 / Resolve Incident

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sData
    String sTemp1
    Boolean bTemp1

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"

    Get ComQuickRequest Of hoHttp "POST" "https://api.squadcast.com/v3/incidents/:incidentID/resolve" To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "data": "incident successfully resolved"
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    Get ComStringOf Of hoJResp "data" To sData


End_Procedure

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
https://api.squadcast.com/v3/incidents/:incidentID/resolve

Postman Collection Item JSON

{
  "name": "Resolve Incident",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{sq_pb_auth_header}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "incidents",
        ":incidentID",
        "resolve"
      ],
      "variable": [
        {
          "key": "incidentID",
          "value": "5d81d9bc60e42f6b99ca4307"
        }
      ]
    },
    "description": "- This endpoint is used to resolve the incident by ID.\n- Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header."
  },
  "response": [
    {
      "name": "200 OK",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "resolve"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx/1.17.7"
        },
        {
          "key": "Date",
          "value": "Tue, 07 Jul 2020 21:35:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Content-Length",
          "value": "42"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15724800; includeSubDomains"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"data\": \"incident successfully resolved\"\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "resolve"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx/1.17.7"
        },
        {
          "key": "Date",
          "value": "Tue, 07 Jul 2020 21:35:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Content-Length",
          "value": "42"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15724800; includeSubDomains"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "401 Unauthorized",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "resolve"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx/1.17.7"
        },
        {
          "key": "Date",
          "value": "Tue, 07 Jul 2020 21:35:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Content-Length",
          "value": "42"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15724800; includeSubDomains"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 401,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "403 Forbidden",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "resolve"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx/1.17.7"
        },
        {
          "key": "Date",
          "value": "Tue, 07 Jul 2020 21:35:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Content-Length",
          "value": "42"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15724800; includeSubDomains"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 403,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "404 Not Found",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "resolve"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx/1.17.7"
        },
        {
          "key": "Date",
          "value": "Tue, 07 Jul 2020 21:35:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Content-Length",
          "value": "42"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15724800; includeSubDomains"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 404,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "500 Internal Server Error",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/resolve",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "resolve"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Server",
          "value": "nginx/1.17.7"
        },
        {
          "key": "Date",
          "value": "Tue, 07 Jul 2020 21:35:20 GMT"
        },
        {
          "key": "Content-Type",
          "value": "application/json"
        },
        {
          "key": "Content-Length",
          "value": "42"
        },
        {
          "key": "Connection",
          "value": "keep-alive"
        },
        {
          "key": "Vary",
          "value": "Origin"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=15724800; includeSubDomains"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 500,\n        \"error_message\": \"<string>\"\n    }\n}"
    }
  ]
}