Chilkat Online Tools

autoit / Belvo API Docs / Resume

Back to Collection Items

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

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oHttp.BasicAuth = True
$oHttp.Login = "{{secretId}}"
$oHttp.Password = "{{secretPassword}}"

; Use this online tool to generate code from sample JSON: Generate Code to Create JSON

; The following JSON is sent in the request body.

; {
;   "session": "<uuid>",
;   "token": "<string>",
;   "link": "<uuid>"
; }

$oJson = ObjCreate("Chilkat_9_5_0.JsonObject")
$oJson.UpdateString("session","<uuid>")
$oJson.UpdateString("token","<string>")
$oJson.UpdateString("link","<uuid>")

$oSbRequestBody = ObjCreate("Chilkat_9_5_0.StringBuilder")
$oJson.EmitSb($oSbRequestBody)

Local $oResp = $oHttp.PTextSb("PATCH","https://domain.com/investments/portfolios/",$oSbRequestBody,"utf-8","application/json",False,False)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -X PATCH
	-u '{{secretId}}:{{secretPassword}}'
	-d '{
    "session": "<uuid>",
    "token": "<string>",
    "link": "<uuid>"
}'
https://domain.com/investments/portfolios/

Postman Collection Item JSON

{
  "name": "Resume",
  "request": {
    "method": "PATCH",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"session\": \"<uuid>\",\n    \"token\": \"<string>\",\n    \"link\": \"<uuid>\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/investments/portfolios/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "investments",
        "portfolios",
        ""
      ]
    }
  },
  "response": [
  ]
}