Chilkat Online Tools

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

Back to Collection Items

Add-Type -Path "C:\chilkat\ChilkatDotNet47-9.5.0-x64\ChilkatDotNet47.dll"

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

$http = New-Object Chilkat.Http

$req = New-Object Chilkat.HttpRequest
$req.HttpVerb = "PUT"
$req.Path = "/invoices/:id/image_scan?return_object=limited"
$req.ContentType = "multipart/form-data"
$success = $req.AddFileForUpload2("file"," path to file","application/octet-stream")

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

$resp = $http.SynchronousRequest("domain.com",443,$true,$req)
if ($http.LastMethodSuccess -eq $false) {
    $($http.LastErrorText)
    exit
}

$($resp.StatusCode)
$($resp.BodyStr)

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": [
  ]
}