Send the full list of your numbers
POSThttps://{ourserver.com}/api/resellers/sendNumbersOnline
Pass all numbers that are available for sale right now. The request replaces your list of numbers added through this API:
- numbers that are not in the request are removed (their value in
idsisnull); - numbers that are already on the list stay as they are, with the same ID (their other fields are not updated: use addNumber to replace a number);
- new numbers are added and activated by the server within about a minute.
A number without its country code at the beginning gets the code from country_id prepended.
The request also confirms that your server is up. Send it after every change of the list and at least every 5 minutes. Instead of resending the list, you can confirm uptime with checkWork and change the list with addNumber and removeNumber.
If your server has not confirmed uptime for more than 10 minutes, all numbers you added through this API are removed.
Parameters
header1
| Name | Type | Description |
|---|---|---|
Authorization* | string | see more here |
Request Body
application/jsonschemaobject
numbersobject[]All numbers available for sale. A JSON string of the array is accepted too.
/api/resellers* requests only. It can be passed in the query string or in the request body.
test1— the request is executed and answered as usual, but its database changes are rolled back. Effects outside the database still happen: for example, an SMS accepted by addMessage is still delivered to the customer, andusedvalues are still kept.test2— the request is not executed: the answer is a debug dump (HTML, HTTP 200) of the request headers and body as our server received them.
test value does not confirm that your server is up.Enum:test1test2Example:test1Examples
threeNumbers22 lines
Three numbers, with optional fields on the last two
{
"numbers": [
{
"number": "+234112233445",
"country_id": 234
},
{
"number": "+234112233446",
"country_id": 234,
"date_start": 1543907600
},
{
"number": "+234112233447",
"country_id": 234,
"date_start": 1543907600,
"port_id": "Port1",
"used": [
"vkcom"
]
}
]
}Responses
200The list is accepted. Check the result of every number in ids.
application/jsonschemaobject
1Example:1idsanyOfRequiredResult per number. The key is the phone number as digits (country code included, no +).
The value is the ID of the number on our server, null for a number that was removed from your list,
or fail for a number that was not added. A number fails when it is not a phone number, the country
is unknown, its port_id is already used by another of your numbers, it is online under another account,
equipment_id is invalid, or rent is requested without rent access.
An empty result is returned as an empty array [].
Examples
Two numbers added, one removed, one not a phone number
{
"response": "1",
"ids": {
"234112233445": 1042,
"234112233446": 1043,
"234112233440": null,
"abc": "fail"
}
}400numbers is not a list
application/jsonschemaobjectError answer: response and message hold the same error code.
ERROR_PARAMSERROR_PARAMS401No API key, or the key does not exist. The body is the plain text Unauthorized.
A request with Accept: application/json gets HTTP 200 with {"response":"ERROR_WRONG_KEY"} instead.
text/htmlUnauthorized.Example:Unauthorized.403Forbidden: the API key is valid, but the request is refused. Error codes:
ERROR_DISABLED — the partner account is not activated;
ERROR_BANNED — the partner account is blocked;
ERROR_IP — the request comes from an IP address that is not in the account's allowlist;
ERROR_RENT — rent is requested, but the account has no rent access (addNumber only).
ERROR_DISABLED — the partner account is not activated;ERROR_BANNED — the partner account is blocked;ERROR_IP — the request comes from an IP address that is not in the account's allowlist;ERROR_RENT — rent is requested, but the account has no rent access (addNumber only).application/jsonschemaobject
ERROR_DISABLEDERROR_BANNEDERROR_IPERROR_RENTExamples
Request from an IP address outside the allowlist
{
"response": "ERROR_IP",
"message": "ERROR_IP"
}