Add several numbers
POSThttps://{ourserver.com}/api/resellers/addNumbers
Adds several numbers to your list in one request. Each number is handled as in addNumber: a number that is already on the list is replaced and gets a new ID. Numbers that are not in the request stay on the list.
The answer is HTTP 200 even when some numbers fail: check the value of every number in ids.
The request also confirms that your server is up.
Parameters
header1
| Name | Type | Description |
|---|---|---|
Authorization* | string | see more here |
Request Body
Content-Type
application/jsonSchema
schemaobject
numbersobject[]Numbers to add
teststring
Test mode, for /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
twoNumbers17 lines
Two numbers, the second one with optional fields
{
"numbers": [
{
"number": "+4695000051",
"country_id": 46
},
{
"number": "+4695000052",
"country_id": 46,
"port_id": "Port2",
"used": [
"vkcom"
],
"date_start": 1658209063
}
]
}Responses
200Result of every number
Content-Type
application/jsonSchema
schemaobject
responsestringRequired
Enum: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
partlyAdded
Two numbers added, one with an unknown country
{
"response": "1",
"ids": {
"4695000051": 1042,
"4695000052": 1043,
"4695000053": "fail"
}
}400numbers is not a list
Content-Type
application/jsonSchema
schemaobjectError answer: response and message hold the same error code.
responsestringRequired
Enum:ERROR_PARAMSmessagestringRequired
Example:ERROR_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.
Content-Type
text/htmlSchema
schemastring
Enum:Unauthorized.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).Content-Type
application/jsonSchema
schemaobject
responsestringRequired
Error codeEnum:ERROR_DISABLEDERROR_BANNEDERROR_IPERROR_RENTmessagestringRequired
The same error codeExamples
ERROR_IP
Request from an IP address outside the allowlist
{
"response": "ERROR_IP",
"message": "ERROR_IP"
}Code Samples
Generating examples...