Chilkat Online Tools

Swift3 / Belvo API Docs / Resume

Back to Collection Items

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

    let http = CkoHttp()!
    var success: Bool

    http.basicAuth = true
    http.login = "{{secretId}}"
    http.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>"
    // }

    let json = CkoJsonObject()!
    json.update("session", value: "<uuid>")
    json.update("token", value: "<string>")
    json.update("link", value: "<uuid>")

    let sbRequestBody = CkoStringBuilder()!
    json.emitSb(sbRequestBody)

    var resp: CkoHttpResponse? = http.pTextSb("PATCH", url: "https://domain.com/investments/portfolios/", textData: sbRequestBody, charset: "utf-8", contentType: "application/json", md5: false, gzip: false)
    if http.lastMethodSuccess == false {
        print("\(http.lastErrorText!)")
        return
    }

    print("\(resp!.statusCode.intValue)")
    print("\(resp!.bodyStr!)")
    resp = nil

}

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