Chilkat Online Tools

Swift / Belvo API Docs / Retrieve

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.

    // {
    //   "link": "link_id"
    // }

    let json = CkoJsonObject()
    json.UpdateString("link", value: "link_id")

    var resp: CkoHttpResponse? = http.PostJson3("https://domain.com/investments/portfolios/", contentType: "application/json", json: json)
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        return
    }

    print("\(resp!.StatusCode.intValue)")
    print("\(resp!.BodyStr)")
    resp = nil

}

Curl Command

curl -X POST
	-u '{{secretId}}:{{secretPassword}}'
	-d '{
  "link": "link_id"
}'
https://domain.com/investments/portfolios/

Postman Collection Item JSON

{
  "name": "Retrieve",
  "request": {
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"link\": \"link_id\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/investments/portfolios/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "investments",
        "portfolios",
        ""
      ]
    }
  },
  "response": [
  ]
}