Chilkat Online Tools

C++ / Belvo API Docs / Retrieve credit metrics

Back to Collection Items

#include <CkHttp.h>
#include <CkJsonObject.h>
#include <CkHttpResponse.h>

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

    CkHttp http;
    bool success;

    http.put_BasicAuth(true);
    http.put_Login("{{secretId}}");
    http.put_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"
    // }

    CkJsonObject json;
    json.UpdateString("link","link_id");

    CkHttpResponse *resp = http.PostJson3("https://domain.com/api/risk-insights/","application/json",json);
    if (http.get_LastMethodSuccess() == false) {
        std::cout << http.lastErrorText() << "\r\n";
        return;
    }

    std::cout << resp->get_StatusCode() << "\r\n";
    std::cout << resp->bodyStr() << "\r\n";
    delete resp;
    }

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