Chilkat Online Tools

PureBasic / Coupa Postman Collection - OAuth - Master / Get CoupaPay Invoice Payments - status cancelled and Not Exported

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,"status[in]","cancelled")
    CkJsonObject::ckUpdateString(queryParams,"exported","false")
    CkJsonObject::ckUpdateString(queryParams,"pay_to_account[type]","CoupaPay::SupplierPaymentAccount")
    CkJsonObject::ckUpdateString(queryParams,"fields","[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "payment-batch-id" + Chr(34) + "," + Chr(34) + "status" + Chr(34) + "," + Chr(34) + "exchange_rate" + Chr(34) + "," + Chr(34) + "updated_at" + Chr(34) + "," + Chr(34) + "released_at" + Chr(34) + ",{" + Chr(34) + "pay_from_account" + Chr(34) + ":[" + Chr(34) + "id" + Chr(34) + ",{" + Chr(34) + "currency" + Chr(34) + ":[" + Chr(34) + "code" + Chr(34) + "]}]},{" + Chr(34) + "pay_to_currency" + Chr(34) + ":[" + Chr(34) + "code" + Chr(34) + "]},{" + Chr(34) + "payee" + Chr(34) + ":[" + Chr(34) + "number" + Chr(34) + "]},{" + Chr(34) + "digital_check" + Chr(34) + ":[" + Chr(34) + "check_number" + Chr(34) + "]},{" + Chr(34) + "payment_details" + Chr(34) + ":[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "released_at" + Chr(34) + "," + Chr(34) + "source_transaction_id" + Chr(34) + "," + Chr(34) + "source_transaction_reference" + Chr(34) + "," + Chr(34) + "discount_total" + Chr(34) + "," + Chr(34) + "payment_total" + Chr(34) + ",{" + Chr(34) + "payable_allocations" + Chr(34) + ":[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "updated_at" + Chr(34) + "," + Chr(34) + "payable_to_amount" + Chr(34) + "," + Chr(34) + "source_transaction_to_reference" + Chr(34) + "," + Chr(34) + "source_transaction_to_id" + Chr(34) + "]},{" + Chr(34) + "currency" + Chr(34) + ":[" + Chr(34) + "code" + Chr(34) + "]}]}]")

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

    resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://domain.com/coupa_pay/payments",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 "status[in]=cancelled"
	-d "exported=false"
	-d "pay_to_account[type]=CoupaPay%3A%3ASupplierPaymentAccount"
	-d "fields=%5B%22id%22,%22payment-batch-id%22,%22status%22,%22exchange_rate%22,%22updated_at%22,%22released_at%22,%7B%22pay_from_account%22%3A%5B%22id%22,%7B%22currency%22%3A%5B%22code%22%5D%7D%5D%7D,%7B%22pay_to_currency%22%3A%5B%22code%22%5D%7D,%7B%22payee%22%3A%5B%22number%22%5D%7D,%7B%22digital_check%22%3A%5B%22check_number%22%5D%7D,%7B%22payment_details%22%3A%5B%22id%22,%22released_at%22,%22source_transaction_id%22,%22source_transaction_reference%22,%22discount_total%22,%22payment_total%22,%7B%22payable_allocations%22%3A%5B%22id%22,%22updated_at%22,%22payable_to_amount%22,%22source_transaction_to_reference%22,%22source_transaction_to_id%22%5D%7D,%7B%22currency%22%3A%5B%22code%22%5D%7D%5D%7D%5D"
	-H "Authorization: Bearer <access_token>"
https://domain.com/coupa_pay/payments

Postman Collection Item JSON

{
  "name": "Get CoupaPay Invoice Payments - status cancelled and Not Exported",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/coupa_pay/payments?status[in]=cancelled&exported=false&pay_to_account[type]=CoupaPay::SupplierPaymentAccount&fields=[\"id\",\"payment-batch-id\",\"status\",\"exchange_rate\",\"updated_at\",\"released_at\",{\"pay_from_account\":[\"id\",{\"currency\":[\"code\"]}]},{\"pay_to_currency\":[\"code\"]},{\"payee\":[\"number\"]},{\"digital_check\":[\"check_number\"]},{\"payment_details\":[\"id\",\"released_at\",\"source_transaction_id\",\"source_transaction_reference\",\"discount_total\",\"payment_total\",{\"payable_allocations\":[\"id\",\"updated_at\",\"payable_to_amount\",\"source_transaction_to_reference\",\"source_transaction_to_id\"]},{\"currency\":[\"code\"]}]}]",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "coupa_pay",
        "payments"
      ],
      "query": [
        {
          "key": "status[in]",
          "value": "cancelled"
        },
        {
          "key": "exported",
          "value": "false"
        },
        {
          "key": "pay_to_account[type]",
          "value": "CoupaPay::SupplierPaymentAccount"
        },
        {
          "key": "fields",
          "value": "[\"id\",\"payment-batch-id\",\"status\",\"exchange_rate\",\"updated_at\",\"released_at\",{\"pay_from_account\":[\"id\",{\"currency\":[\"code\"]}]},{\"pay_to_currency\":[\"code\"]},{\"payee\":[\"number\"]},{\"digital_check\":[\"check_number\"]},{\"payment_details\":[\"id\",\"released_at\",\"source_transaction_id\",\"source_transaction_reference\",\"discount_total\",\"payment_total\",{\"payable_allocations\":[\"id\",\"updated_at\",\"payable_to_amount\",\"source_transaction_to_reference\",\"source_transaction_to_id\"]},{\"currency\":[\"code\"]}]}]"
        }
      ]
    }
  },
  "response": [
  ]
}