Chilkat Online Tools

PureBasic / GP-API Collection / DIA_1.2 Get Document

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

    CkHttp::ckSetRequestHeader(http,"Content-Type","application/json")
    CkHttp::ckSetRequestHeader(http,"X-GP-Version","{{version}}")
    ; Adds the "Authorization: Bearer {{token}}" header.
    CkHttp::setCkAuthToken(http, "{{token}}")
    CkHttp::ckSetRequestHeader(http,"Accept","application/json")

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

    success = CkHttp::ckQuickGetSb(http,"https://{{url}}/ucp/disputes/DIS_SAND_abcd1234/documents/DOC_MyEvidence_234234AVCDE-1",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 "Content-Type: application/json"
	-H "Authorization: Bearer {{token}}"
	-H "Accept: application/json"
	-H "X-GP-Version: {{version}}"
https://{{url}}/ucp/disputes/DIS_SAND_abcd1234/documents/DOC_MyEvidence_234234AVCDE-1

Postman Collection Item JSON

{
  "name": "DIA_1.2 Get Document",
  "request": {
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "value": "application/json",
        "type": "text",
        "disabled": true
      },
      {
        "key": "Authorization",
        "type": "text",
        "value": "Bearer {{token}}"
      },
      {
        "key": "Accept",
        "type": "text",
        "value": "application/json"
      },
      {
        "key": "X-GP-Version",
        "type": "text",
        "value": "{{version}}"
      }
    ],
    "url": {
      "raw": "https://{{url}}/ucp/disputes/DIS_SAND_abcd1234/documents/DOC_MyEvidence_234234AVCDE-1",
      "protocol": "https",
      "host": [
        "{{url}}"
      ],
      "path": [
        "ucp",
        "disputes",
        "DIS_SAND_abcd1234",
        "documents",
        "DOC_MyEvidence_234234AVCDE-1"
      ]
    },
    "description": "This request is for retrieving a document that has been provided by the Issuer in a dispute. You must provide the dispute id and also the document id in the query string. In the response, you should receive the document in base 64.\r\n\r\nFor more info on getting a document in a dispute, visit: https://developer.globalpay.com/api/disputes#/Document/get_disputes__id__documents__doc_id_"
  },
  "response": [
  ]
}