Chilkat Online Tools

lianja / Coupa Postman Collection - OAuth - Master / Update Image Scan on an Invoice

Back to Collection Items

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

loHttp = createobject("CkHttp")

loReq = createobject("CkHttpRequest")
loReq.HttpVerb = "PUT"
loReq.Path = "/invoices/:id/image_scan?return_object=limited"
loReq.ContentType = "multipart/form-data"
llSuccess = loReq.AddFileForUpload2("file"," path to file","application/octet-stream")

loReq.AddHeader("Authorization","Bearer <access_token>")
loReq.AddHeader("Expect","100-continue")

loResp = loHttp.SynchronousRequest("domain.com",443,.T.,loReq)
if (loHttp.LastMethodSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loReq
    return
endif

? str(loResp.StatusCode)
? loResp.BodyStr
release loResp


release loHttp
release loReq

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
	--form 'file=@"/path/to/file"'
https://domain.com/invoices/:id/image_scan?return_object=limited

Postman Collection Item JSON

{
  "name": "Update Image Scan on an Invoice",
  "protocolProfileBehavior": {
    "disabledSystemHeaders": {}
  },
  "request": {
    "method": "PUT",
    "header": [
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "file",
          "description": "\"Body Params: Form_data\nParam Name: file\nParam Type: file\nParam Value: Choose File\"",
          "type": "file",
          "src": "/Users/siyadmohammed/Documents/Learning/EmptyFiles/Test.pdf"
        }
      ]
    },
    "url": {
      "raw": "{{URL}}/invoices/:id/image_scan?return_object=limited",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "invoices",
        ":id",
        "image_scan"
      ],
      "query": [
        {
          "key": "return_object",
          "value": "limited"
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "1291"
        }
      ]
    }
  },
  "response": [
  ]
}