Chilkat Online Tools

PureBasic / Twitter API v2 / Get a compliance job by ID

Back to Collection Items

IncludeFile "CkStringBuilder.pb"
IncludeFile "CkHttp.pb"

Procedure ChilkatExample()

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success.i

    ; Adds the "Authorization: Bearer <access_token>" header.
    CkHttp::setCkAuthToken(http, "<access_token>")

    sbResponseBody.i = CkStringBuilder::ckCreate()
    If sbResponseBody.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success = CkHttp::ckQuickGetSb(http,"https://api.twitter.com/2/compliance/jobs/:id",sbResponseBody)
    If success = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkStringBuilder::ckDispose(sbResponseBody)
        ProcedureReturn
    EndIf

    Debug "Response status code = " + Str(CkHttp::ckLastStatus(http))
    Debug CkStringBuilder::ckGetAsString(sbResponseBody)


    CkHttp::ckDispose(http)
    CkStringBuilder::ckDispose(sbResponseBody)


    ProcedureReturn
EndProcedure

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/compliance/jobs/:id

Postman Collection Item JSON

{
  "name": "Get a compliance job by ID",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://api.twitter.com/2/compliance/jobs/:id",
      "protocol": "https",
      "host": [
        "api",
        "twitter",
        "com"
      ],
      "path": [
        "2",
        "compliance",
        "jobs",
        ":id"
      ],
      "variable": [
        {
          "key": "id",
          "value": null
        }
      ]
    },
    "description": "Get a single compliance job with the specified ID.\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/compliance/batch-compliance/api-reference/get-compliance-jobs-id) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
  },
  "response": [
  ]
}