Developer Docs
Table of contents

Sending HLR request

PUT (POST is also supported)

Endpoint URL: https://api.affiliate-sms.com/hlr/create

Header:

X-API-KEY: live_asdfasdfq234 
content-type: multipart/form-data

JSON Body RAW:

{
"msisdn":"380505142320",
"reference":"sendHLR0407",
"tariff":9
"callback_url":"https://somelink.com/hlr
}

Scenario 1: Creating single HLR request

Attention! For this request, the Content-type must be set to multipart/form-data!

In this scenario, 2 parameters are passed (and 2 optional):

Required:

  • msisdn – the phone number for which the HLR request is performed
  • reference – external ID of the HLR request

Optional:

  • tariff – number of the tariff. The default is 0. An integer from 0 to 9.
  • callback_url – overrides the link that will be used to pass information about the HLR request (see below).

If this parameter is incorrect, an error is not generated, but the callback_url from the user configuration (if set) is used.

Example of the correct response:

{
  "error": "0",
  "id": "12123",
  "price": "0.002",
  "currency": "EUR"
}

If the request contains an error:

{
  "error": "11",
  "errorDescription": "Incorrect msisdn"
}

Scenario 2: Creating multiple requests

The payload parameter is passed containing a JSON-encoded array having the following structure:

Header:

X-API-KEY: live_asdfasdfq234 
content-type: multipart/form-data

JSON Body RAW:

[
{"msisdn":"380972920000", 
"reference":"extid13423now"
], 
"tariff":9,
"callback_url":"http://someurl.com/callback/?id=12345"},
[
{"msisdn":"380972920000", 
"reference":"extid13425"
], 
"tariff":9,
"callback_url":"http://someurl.com/callback/?id=12346"}
]

The tariff, callback_url parameters are optional.

In this case, an example of the correct response is:

{"result":
[
{"reference":"extid13423now",
"id":"12345",
"error":"0",
"price":"0.002",
"currency":"EUR"},
{"reference":"extid13425",
"id":"12346",
"error":"0",
"price":"0.002",
"currency":"EUR"}
],
"error":"0", 
"totalprice":"0.004",
"currency":"EUR"}

If the data contains an error, the response will be returned approximately as follows:

{"error":"14",
"errorDescription":"Incorrect payload: missing msisdn"
}

In case of passing of one or more external IDs of HLR-requests already existing in the system, the response will be returned nearly as follows:

{"result":
[
{"reference":"extid13423now",
"id":"12345",
"error":"13",
" errorDescription":"HLR already exists"
}, {"reference":"extid13425",
"id":"12346",
"error":"0",
"price":"0.002",
"currency":"EUR"}
],
"error":"0",
"totalprice":"0.002",
"currency":"EUR"}

That is, for all HLR requests with non-unique (i.e., those that already exist in the system) IDs, error 13 will be returned.

Attention! Upon error 14, HLR requests are not created, even if the payload contained the correctly passed data.