Chilkat Online Tools

PureBasic / Coupa Postman Collection - OAuth - Master / Retrieve goods receipts by ID

Back to Collection Items

IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.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

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

    CkJsonObject::ckUpdateString(queryParams,"fields","[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "status" + Chr(34) + "," + Chr(34) + "price" + Chr(34) + "," + Chr(34) + "quantity" + Chr(34) + "," + Chr(34) + "total" + Chr(34) + "," + Chr(34) + "transaction_date" + Chr(34) + "," + Chr(34) + "type" + Chr(34) + "," + Chr(34) + "match_reference" + Chr(34) + "," + Chr(34) + "original_transaction_id" + Chr(34) + "," + Chr(34) + "voided_value" + Chr(34) + "," + Chr(34) + "exported" + Chr(34) + ",{" + Chr(34) + "account" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + "," + Chr(34) + "code" + Chr(34) + "," + Chr(34) + "active" + Chr(34) + "," + Chr(34) + "segment_1" + Chr(34) + "," + Chr(34) + "segment_2" + Chr(34) + ", " + Chr(34) + "segment_3" + Chr(34) + ", " + Chr(34) + "segment_4" + Chr(34) + ", " + Chr(34) + "account_type_id" + Chr(34) + "]},{" + Chr(34) + "account_allocations" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + "," + Chr(34) + "code" + Chr(34) + "," + Chr(34) + "active" + Chr(34) + "," + Chr(34) + "segment_1" + Chr(34) + "," + Chr(34) + "segment_2" + Chr(34) + ", " + Chr(34) + "segment_3" + Chr(34) + ", " + Chr(34) + "segment_4" + Chr(34) + ", " + Chr(34) + "account_type_id" + Chr(34) + "]},{" + Chr(34) + "order_line" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "order_header_id" + Chr(34) + "," + Chr(34) + "order_header_number" + Chr(34) + "]},{" + Chr(34) + "item" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + "," + Chr(34) + "item_number" + Chr(34) + "]},{" + Chr(34) + "uom" + Chr(34) + ": [" + Chr(34) + "name" + Chr(34) + "," + Chr(34) + "code" + Chr(34) + "]},{" + Chr(34) + "created_by" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "login" + Chr(34) + "," + Chr(34) + "email" + Chr(34) + "]},{" + Chr(34) + "updated_by" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "login" + Chr(34) + "," + Chr(34) + "email" + Chr(34) + "]}]")

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

    resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://domain.com/receiving_transactions/:id",queryParams)
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkJsonObject::ckDispose(queryParams)
        ProcedureReturn
    EndIf

    Debug Str(CkHttpResponse::ckStatusCode(resp))
    Debug CkHttpResponse::ckBodyStr(resp)
    CkHttpResponse::ckDispose(resp)



    CkHttp::ckDispose(http)
    CkJsonObject::ckDispose(queryParams)


    ProcedureReturn
EndProcedure

Curl Command

curl -G -d "fields=%5B%22id%22,%22status%22,%22price%22,%22quantity%22,%22total%22,%22transaction_date%22,%22type%22,%22match_reference%22,%22original_transaction_id%22,%22voided_value%22,%22exported%22,%7B%22account%22%3A%20%5B%22id%22,%22name%22,%22code%22,%22active%22,%22segment_1%22,%22segment_2%22,%20%22segment_3%22,%20%22segment_4%22,%20%22account_type_id%22%5D%7D,%7B%22account_allocations%22%3A%20%5B%22id%22,%22name%22,%22code%22,%22active%22,%22segment_1%22,%22segment_2%22,%20%22segment_3%22,%20%22segment_4%22,%20%22account_type_id%22%5D%7D,%7B%22order_line%22%3A%20%5B%22id%22,%22order_header_id%22,%22order_header_number%22%5D%7D,%7B%22item%22%3A%20%5B%22id%22,%22name%22,%22item_number%22%5D%7D,%7B%22uom%22%3A%20%5B%22name%22,%22code%22%5D%7D,%7B%22created_by%22%3A%20%5B%22id%22,%22login%22,%22email%22%5D%7D,%7B%22updated_by%22%3A%20%5B%22id%22,%22login%22,%22email%22%5D%7D%5D"
	-H "Authorization: Bearer <access_token>"
https://domain.com/receiving_transactions/:id

Postman Collection Item JSON

{
  "name": "Retrieve goods receipts by ID",
  "protocolProfileBehavior": {
    "disabledSystemHeaders": {}
  },
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/receiving_transactions/:id?fields=[\"id\",\"status\",\"price\",\"quantity\",\"total\",\"transaction_date\",\"type\",\"match_reference\",\"original_transaction_id\",\"voided_value\",\"exported\",{\"account\": [\"id\",\"name\",\"code\",\"active\",\"segment_1\",\"segment_2\", \"segment_3\", \"segment_4\", \"account_type_id\"]},{\"account_allocations\": [\"id\",\"name\",\"code\",\"active\",\"segment_1\",\"segment_2\", \"segment_3\", \"segment_4\", \"account_type_id\"]},{\"order_line\": [\"id\",\"order_header_id\",\"order_header_number\"]},{\"item\": [\"id\",\"name\",\"item_number\"]},{\"uom\": [\"name\",\"code\"]},{\"created_by\": [\"id\",\"login\",\"email\"]},{\"updated_by\": [\"id\",\"login\",\"email\"]}]",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "receiving_transactions",
        ":id"
      ],
      "query": [
        {
          "key": "fields",
          "value": "[\"id\",\"status\",\"price\",\"quantity\",\"total\",\"transaction_date\",\"type\",\"match_reference\",\"original_transaction_id\",\"voided_value\",\"exported\",{\"account\": [\"id\",\"name\",\"code\",\"active\",\"segment_1\",\"segment_2\", \"segment_3\", \"segment_4\", \"account_type_id\"]},{\"account_allocations\": [\"id\",\"name\",\"code\",\"active\",\"segment_1\",\"segment_2\", \"segment_3\", \"segment_4\", \"account_type_id\"]},{\"order_line\": [\"id\",\"order_header_id\",\"order_header_number\"]},{\"item\": [\"id\",\"name\",\"item_number\"]},{\"uom\": [\"name\",\"code\"]},{\"created_by\": [\"id\",\"login\",\"email\"]},{\"updated_by\": [\"id\",\"login\",\"email\"]}]"
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "5033",
          "description": "Coupa Internal Id for a Goods Receipt"
        }
      ]
    }
  },
  "response": [
  ]
}