GCollect API Integration Instructions

GiniMachine API documentation is split into three sections: authentication, endpoints section and sdk usage samples.

All requests are made to endpoints beginning:

https://gcollect.ginimachine.com/

All requests must be secure, i.e. https, not http.

The API endpoint bodies support two content types JSON and tab-delimited CSV. It’s specified at the end of the endpoint URL.

Authentication

In order to make a single API call to GiniMachine, you will need to attach an access token to the request headers.

For every http request pass the value of the access token as an Authorization header with type API Key.

Collection API Endpoints
Predict JSON, single - application or batch scoring

Query params

For columnList query param not more than 3 values can be specified per request.

Response status codes

  • Status: 200 - OK
  • Status: 201 - Created
  • Status: 400 - Bad Request
    Choose not more than 3 columns;
    The operation was not completed;
    Limit exceeded
  • Status: 401 - Unauthorized
  • Status: 403 - Forbidden
  • Status: 404 - Model with id not Found

Response body example

Predict JSON with interpretation for each application, single - application or batch scoring

The process uses additional heuristics to calculate the effect of each feature on the prediction. So, the inference time can vary in this case.

Query params

For columnList query param not more than 3 values can be specified per request.

Response status codes

  • Status: 200 - OK
  • Status: 201 - Created
  • Status: 400 - Bad Request
    Choose not more than 3 columns;
    The operation was not completed;
    Limit exceeded
  • Status: 401 - Unauthorized
  • Status: 403 - Forbidden
  • Status: 404 - Model with id not Found

Response body example

Predict CSV, single - application or batch scoring

Query params

For columnList query param not more than 3 values can be specified per request.

Response status codes

  • Status: 200 - OK
  • Status: 201 - Created
  • Status: 400 - Bad Request
    Choose not more than 3 columns;
    The operation was not completed;
    Limit exceeded
  • Status: 401 - Unauthorized
  • Status: 403 - Forbidden
  • Status: 404 - Model with id not Found

Predict CSV with interpretation for each application, single - application or batch scoring

Query params

For columnList query param not more than 3 values can be specified per request.

Response status codes

  • Status: 200 - OK
  • Status: 201 - Created
  • Status: 400 - Bad Request
    Choose not more than 3 columns;
    The operation was not completed;
    Limit exceeded
  • Status: 401 - Unauthorized
  • Status: 403 - Forbidden
  • Status: 404 - Model with id not Found

Usage and SDK Samples

Curl SDK


curl --location --request POST 'https://collection.ginimachine.com/api/collection/predict.json?modelId=4&columnList=phone_call' \
--header 'Content-Type: application/json' \
--data-raw '[{
"product_type" : "consumer_credit",
"gender" : "male",
"debt" : "109907.33",
"dpd" : "1346",
"age" : "58",
"guarantor" : "1",
"account_opened_month" : "11",
"account_opened_day" : "28",
"account_opened_day_of_week" : "4",
"account_opened_quarter" : "4",
"repayment_received" : "365-1095",
"phone_call" : "f",
"email_sent" : "f",
"push_sent" : "2"
}]
'

Java SDK


        OkHttpClient client = new OkHttpClient().newBuilder()
          .build();
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, "[{\n  \"product_type\" : \"consumer_credit\",\n  \"gender\" : \"male\",\n  \"debt\" : \"109907.33\",\n  \"dpd\" : \"1346\",\n  \"age\" : \"58\",\n  \"guarantor\" : \"1\",\n  \"account_opened_month\" : \"11\",\n  \"account_opened_day\" : \"28\",\n  \"account_opened_day_of_week\" : \"4\",\n  \"account_opened_quarter\" : \"4\",\n  \"repayment_received\" : \"365-1095\",\n  \"phone_call\" : \"f\",\n  \"email_sent\" : \"f\",\n  \"push_sent\" : \"2\"\n}]\n");
        Request request = new Request.Builder()
          .url("https://gcollect.ginimachine.com/api/v1/collection/predict.json?modelId=4&columnList=phone_call")
          .method("POST", body)
          .addHeader("Content-Type", "application/json")
          .build();
        Response response = client.newCall(request).execute();

JavaScript SDK


var settings = {
  "url": "https://gcollect.ginimachine.com/api/v1/collection/predict.json?modelId=4&columnList=phone_call",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json"
  },
  "data": JSON.stringify([
    {
      "product_type": "consumer_credit",
      "gender": "male",
      "debt": "109907.33",
      "dpd": "1346",
      "age": "58",
      "guarantor": "1",
      "account_opened_month": "11",
      "account_opened_day": "28",
      "account_opened_day_of_week": "4",
      "account_opened_quarter": "4",
      "repayment_received": "365-1095",
      "phone_call": "f",
      "email_sent": "f",
      "push_sent": "2"
    }
  ]),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

Python SDK


import requests
import json

url = "https://gcollect.ginimachine.com/api/v1/collection/predict.json?modelId=4&columnList=phone_call"

payload = json.dumps([
  {
    "product_type": "consumer_credit",
    "gender": "male",
    "debt": "109907.33",
    "dpd": "1346",
    "age": "58",
    "guarantor": "1",
    "account_opened_month": "11",
    "account_opened_day": "28",
    "account_opened_day_of_week": "4",
    "account_opened_quarter": "4",
    "repayment_received": "365-1095",
    "phone_call": "f",
    "email_sent": "f",
    "push_sent": "2"
  }
])
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

#With empty columns list

url = "https://gcollect.ginimachine.com/api/v1/collection/predict.json?modelId=4"

payload = json.dumps([
  {
    "product_type": "consumer_credit",
    "gender": "male",
    "debt": "109907.33",
    "dpd": "1346",
    "age": "58",
    "guarantor": "1",
    "account_opened_month": "11",
    "account_opened_day": "28",
    "account_opened_day_of_week": "4",
    "account_opened_quarter": "4",
    "repayment_received": "365-1095",
    "phone_call": "f",
    "email_sent": "f",
    "push_sent": "2"
  }
])
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

  

Got a question?
Contact us
: it@ginimachine.com