sendNumbersOnline - sends all online numbers

URL - /api/resellers/sendNumbersOnline

In this request all numbers available for sale should be passed. Send this request every 5 minutes, and while adding or removing a number.

Example

  • javascript
axios.post(
    'http://_SERVER_URL_/api/resellers/sendNumbersOnline', 
    {numbers: [
        {number: "+234112233445",country_id: 234},
        {number: "+234112233446",country_id: 234,date_start: 1543907600,operator: 28967}
    ]},
    {headers: {Authorization: 'Bearer APIKEY', 'Content-Type': 'application/json; charset=utf-8'}}
)
  • php
<?php
// Include Guzzle. If using Composer: require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Request;
$response = (new Client())->send(new Request(
  'POST',
  'http://_SERVER_URL_/api/resellers/sendNumbersOnline',
  ['Authorization' => 'Bearer APIKEY', 'Content-Type' => 'application/json; charset=utf-8'],
  ['numbers'=> [
      ['number'=>'+234112233445','country_id'=>234],
      ['number'=>'+234112233446','country_id'=>234,'date_start'=>1543907600,'operator'=>28967]]
  ]
));
echo 'Response HTTP : ' . $response->getStatusCode();
  • python
# Install the Python Requests library: `pip install requests`
import requests
import json

def send_request():
    try:
        response = requests.post(
            url="http://_SERVER_URL_/api/resellers/sendNumbersOnline",
            headers={"Authorization": "Bearer APIKEY","Content-Type": "application/json; charset=utf-8"},
            data={
                "numbers": [
                    {"number": "+234112233445","country_id": 234},
                    {"number": "+234112233446","country_id": 234,"date_start": 1543907600,"operator": 28967}
                ]
            }
        )
        print('Response HTTP Status Code: {status_code}'.format(status_code=response.status_code))
        print('Response HTTP Response Body: {content}'.format(content=response.content))
    except requests.exceptions.RequestException:
        print('HTTP Request failed')
  • cURL
curl -X "POST" "http://_SERVER_URL_/api/resellers/sendNumbersOnline" \
     -H 'Authorization: Bearer APIKEY' \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d '{"numbers": [
         {"number": "+234112233445","country_id": 234},
         {"number": "+234112233446","country_id": 234,"date_start": 1543907600,"operator": 28967}
     ]
}'

Parameters

Parameter name Parameter Data type Description
numbers required ARRAY Online numbers list.
{number, country_id, operator, price, date_start}
test optional STRING Parameter for this method, if === 'test1', data will not be saved. If === 'test2', prints the request

Numbers list format

Parameter name Parameter Data type Description
number required ARRAY Phone number.
Format: International
Example: 234112233445
country_id required STRING Country code
Show list
operator optional STRING Mobile operator code (mcc + mnc)
Show list
Example: 28967
port_id optional STRING Unique port number. Less than 100 charachters. It is required for working with our interface.

Result

After successful execution of the request you will get the JSON format response like this:

json {response:1, ids:{number: id or null, ...}}

Result Description
response 1, if request was successful, or reports an error
ids Numbers IDs, number: id - added number or null - deleted

ERRORS

Status Result Description
400 NUMBER_FORMAT_ERROR Number format error
400 ERROR_DATE date_start format error