Chilkat Online Tools

Swift3 / Belvo API Docs / Retrieve credit metrics

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.update("link", value: "link_id")

    var resp: CkoHttpResponse? = http.postJson3("https://domain.com/api/risk-insights/", 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/api/risk-insights/

Postman Collection Item JSON

{
  "name": "Retrieve credit metrics",
  "request": {
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"link\": \"link_id\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/api/risk-insights/",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "risk-insights",
        ""
      ]
    }
  },
  "response": [
  ]
}