Numbers API
POST
Buy a number
{{baseUrl}}/number/buy
BODY formUrlEncoded
country
msisdn
target_api_key
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/number/buy");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "country=&msisdn=&target_api_key=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/number/buy" {:form-params {:country ""
:msisdn ""
:target_api_key ""}})
require "http/client"
url = "{{baseUrl}}/number/buy"
headers = HTTP::Headers{
"content-type" => "application/x-www-form-urlencoded"
}
reqBody = "country=&msisdn=&target_api_key="
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/number/buy"),
Content = new FormUrlEncodedContent(new Dictionary
{
{ "country", "" },
{ "msisdn", "" },
{ "target_api_key", "" },
}),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/number/buy");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "country=&msisdn=&target_api_key=", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/number/buy"
payload := strings.NewReader("country=&msisdn=&target_api_key=")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/number/buy HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: example.com
Content-Length: 32
country=&msisdn=&target_api_key=
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/number/buy")
.setHeader("content-type", "application/x-www-form-urlencoded")
.setBody("country=&msisdn=&target_api_key=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/number/buy"))
.header("content-type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("country=&msisdn=&target_api_key="))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "country=&msisdn=&target_api_key=");
Request request = new Request.Builder()
.url("{{baseUrl}}/number/buy")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/number/buy")
.header("content-type", "application/x-www-form-urlencoded")
.body("country=&msisdn=&target_api_key=")
.asString();
const data = 'country=&msisdn=&target_api_key=';
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/number/buy');
xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
xhr.send(data);
import axios from 'axios';
const encodedParams = new URLSearchParams();
encodedParams.set('country', '');
encodedParams.set('msisdn', '');
encodedParams.set('target_api_key', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/buy',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: encodedParams,
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/number/buy';
const options = {
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({country: '', msisdn: '', target_api_key: ''})
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/number/buy',
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
data: {
country: '',
msisdn: '',
target_api_key: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/x-www-form-urlencoded")
val body = RequestBody.create(mediaType, "country=&msisdn=&target_api_key=")
val request = Request.Builder()
.url("{{baseUrl}}/number/buy")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build()
val response = client.newCall(request).execute()
const qs = require('querystring');
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/number/buy',
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(qs.stringify({country: '', msisdn: '', target_api_key: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/buy',
headers: {'content-type': 'application/x-www-form-urlencoded'},
form: {country: '', msisdn: '', target_api_key: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/number/buy');
req.headers({
'content-type': 'application/x-www-form-urlencoded'
});
req.form({
country: '',
msisdn: '',
target_api_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const { URLSearchParams } = require('url');
const encodedParams = new URLSearchParams();
encodedParams.set('country', '');
encodedParams.set('msisdn', '');
encodedParams.set('target_api_key', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/buy',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: encodedParams,
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const { URLSearchParams } = require('url');
const fetch = require('node-fetch');
const encodedParams = new URLSearchParams();
encodedParams.set('country', '');
encodedParams.set('msisdn', '');
encodedParams.set('target_api_key', '');
const url = '{{baseUrl}}/number/buy';
const options = {
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: encodedParams
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/x-www-form-urlencoded" };
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"country=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&msisdn=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&target_api_key=" dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/number/buy"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/number/buy" in
let headers = Header.add (Header.init ()) "content-type" "application/x-www-form-urlencoded" in
let body = Cohttp_lwt_body.of_string "country=&msisdn=&target_api_key=" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/number/buy",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "country=&msisdn=&target_api_key=",
CURLOPT_HTTPHEADER => [
"content-type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/number/buy', [
'form_params' => [
'country' => '',
'msisdn' => '',
'target_api_key' => ''
],
'headers' => [
'content-type' => 'application/x-www-form-urlencoded',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/number/buy');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/x-www-form-urlencoded'
]);
$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields([
'country' => '',
'msisdn' => '',
'target_api_key' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(new http\QueryString([
'country' => '',
'msisdn' => '',
'target_api_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/number/buy');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/x-www-form-urlencoded'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/number/buy' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'country=&msisdn=&target_api_key='
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/number/buy' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'country=&msisdn=&target_api_key='
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "country=&msisdn=&target_api_key="
headers = { 'content-type': "application/x-www-form-urlencoded" }
conn.request("POST", "/baseUrl/number/buy", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/number/buy"
payload = {
"country": "",
"msisdn": "",
"target_api_key": ""
}
headers = {"content-type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/number/buy"
payload <- "country=&msisdn=&target_api_key="
encode <- "form"
response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/number/buy")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
request.body = "country=&msisdn=&target_api_key="
response = http.request(request)
puts response.read_body
require 'faraday'
data = {
:country => "",
:msisdn => "",
:target_api_key => "",
}
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
)
response = conn.post('/baseUrl/number/buy') do |req|
req.body = URI.encode_www_form(data)
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/number/buy";
let payload = json!({
"country": "",
"msisdn": "",
"target_api_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/x-www-form-urlencoded".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.form(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/number/buy \
--header 'content-type: application/x-www-form-urlencoded' \
--data country= \
--data msisdn= \
--data target_api_key=
http --form POST {{baseUrl}}/number/buy \
content-type:application/x-www-form-urlencoded \
country='' \
msisdn='' \
target_api_key=''
wget --quiet \
--method POST \
--header 'content-type: application/x-www-form-urlencoded' \
--body-data 'country=&msisdn=&target_api_key=' \
--output-document \
- {{baseUrl}}/number/buy
import Foundation
let headers = ["content-type": "application/x-www-form-urlencoded"]
let postData = NSMutableData(data: "country=".data(using: String.Encoding.utf8)!)
postData.append("&msisdn=".data(using: String.Encoding.utf8)!)
postData.append("&target_api_key=".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/number/buy")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "200",
"error-code-label": "success"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "200",
"error-code-label": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "401",
"error-code-label": "authentication failed"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "401",
"error-code-label": "authentication failed"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "420",
"error-code-label": "Numbers from this country can be requested from the Dashboard (https://dashboard.nexmo.com/buy-numbers) as they require a valid local address to be provided before being purchased."
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "420",
"error-code-label": "Numbers from this country can be requested from the Dashboard (https://dashboard.nexmo.com/buy-numbers) as they require a valid local address to be provided before being purchased."
}
POST
Cancel a number
{{baseUrl}}/number/cancel
BODY formUrlEncoded
country
msisdn
target_api_key
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/number/cancel");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "country=&msisdn=&target_api_key=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/number/cancel" {:form-params {:country ""
:msisdn ""
:target_api_key ""}})
require "http/client"
url = "{{baseUrl}}/number/cancel"
headers = HTTP::Headers{
"content-type" => "application/x-www-form-urlencoded"
}
reqBody = "country=&msisdn=&target_api_key="
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/number/cancel"),
Content = new FormUrlEncodedContent(new Dictionary
{
{ "country", "" },
{ "msisdn", "" },
{ "target_api_key", "" },
}),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/number/cancel");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "country=&msisdn=&target_api_key=", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/number/cancel"
payload := strings.NewReader("country=&msisdn=&target_api_key=")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/number/cancel HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: example.com
Content-Length: 32
country=&msisdn=&target_api_key=
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/number/cancel")
.setHeader("content-type", "application/x-www-form-urlencoded")
.setBody("country=&msisdn=&target_api_key=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/number/cancel"))
.header("content-type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("country=&msisdn=&target_api_key="))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "country=&msisdn=&target_api_key=");
Request request = new Request.Builder()
.url("{{baseUrl}}/number/cancel")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/number/cancel")
.header("content-type", "application/x-www-form-urlencoded")
.body("country=&msisdn=&target_api_key=")
.asString();
const data = 'country=&msisdn=&target_api_key=';
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/number/cancel');
xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
xhr.send(data);
import axios from 'axios';
const encodedParams = new URLSearchParams();
encodedParams.set('country', '');
encodedParams.set('msisdn', '');
encodedParams.set('target_api_key', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/cancel',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: encodedParams,
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/number/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({country: '', msisdn: '', target_api_key: ''})
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/number/cancel',
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
data: {
country: '',
msisdn: '',
target_api_key: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/x-www-form-urlencoded")
val body = RequestBody.create(mediaType, "country=&msisdn=&target_api_key=")
val request = Request.Builder()
.url("{{baseUrl}}/number/cancel")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build()
val response = client.newCall(request).execute()
const qs = require('querystring');
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/number/cancel',
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(qs.stringify({country: '', msisdn: '', target_api_key: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/cancel',
headers: {'content-type': 'application/x-www-form-urlencoded'},
form: {country: '', msisdn: '', target_api_key: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/number/cancel');
req.headers({
'content-type': 'application/x-www-form-urlencoded'
});
req.form({
country: '',
msisdn: '',
target_api_key: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const { URLSearchParams } = require('url');
const encodedParams = new URLSearchParams();
encodedParams.set('country', '');
encodedParams.set('msisdn', '');
encodedParams.set('target_api_key', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/cancel',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: encodedParams,
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const { URLSearchParams } = require('url');
const fetch = require('node-fetch');
const encodedParams = new URLSearchParams();
encodedParams.set('country', '');
encodedParams.set('msisdn', '');
encodedParams.set('target_api_key', '');
const url = '{{baseUrl}}/number/cancel';
const options = {
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: encodedParams
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/x-www-form-urlencoded" };
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"country=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&msisdn=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&target_api_key=" dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/number/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/number/cancel" in
let headers = Header.add (Header.init ()) "content-type" "application/x-www-form-urlencoded" in
let body = Cohttp_lwt_body.of_string "country=&msisdn=&target_api_key=" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/number/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "country=&msisdn=&target_api_key=",
CURLOPT_HTTPHEADER => [
"content-type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/number/cancel', [
'form_params' => [
'country' => '',
'msisdn' => '',
'target_api_key' => ''
],
'headers' => [
'content-type' => 'application/x-www-form-urlencoded',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/number/cancel');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/x-www-form-urlencoded'
]);
$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields([
'country' => '',
'msisdn' => '',
'target_api_key' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(new http\QueryString([
'country' => '',
'msisdn' => '',
'target_api_key' => ''
]));
$request->setRequestUrl('{{baseUrl}}/number/cancel');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/x-www-form-urlencoded'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/number/cancel' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'country=&msisdn=&target_api_key='
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/number/cancel' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'country=&msisdn=&target_api_key='
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "country=&msisdn=&target_api_key="
headers = { 'content-type': "application/x-www-form-urlencoded" }
conn.request("POST", "/baseUrl/number/cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/number/cancel"
payload = {
"country": "",
"msisdn": "",
"target_api_key": ""
}
headers = {"content-type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/number/cancel"
payload <- "country=&msisdn=&target_api_key="
encode <- "form"
response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/number/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
request.body = "country=&msisdn=&target_api_key="
response = http.request(request)
puts response.read_body
require 'faraday'
data = {
:country => "",
:msisdn => "",
:target_api_key => "",
}
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
)
response = conn.post('/baseUrl/number/cancel') do |req|
req.body = URI.encode_www_form(data)
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/number/cancel";
let payload = json!({
"country": "",
"msisdn": "",
"target_api_key": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/x-www-form-urlencoded".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.form(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/number/cancel \
--header 'content-type: application/x-www-form-urlencoded' \
--data country= \
--data msisdn= \
--data target_api_key=
http --form POST {{baseUrl}}/number/cancel \
content-type:application/x-www-form-urlencoded \
country='' \
msisdn='' \
target_api_key=''
wget --quiet \
--method POST \
--header 'content-type: application/x-www-form-urlencoded' \
--body-data 'country=&msisdn=&target_api_key=' \
--output-document \
- {{baseUrl}}/number/cancel
import Foundation
let headers = ["content-type": "application/x-www-form-urlencoded"]
let postData = NSMutableData(data: "country=".data(using: String.Encoding.utf8)!)
postData.append("&msisdn=".data(using: String.Encoding.utf8)!)
postData.append("&target_api_key=".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/number/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "200",
"error-code-label": "success"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "200",
"error-code-label": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "401",
"error-code-label": "authentication failed"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "401",
"error-code-label": "authentication failed"
}
GET
List the numbers you own
{{baseUrl}}/account/numbers
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/numbers");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account/numbers")
require "http/client"
url = "{{baseUrl}}/account/numbers"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account/numbers"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/numbers");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/numbers"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account/numbers HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account/numbers")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/numbers"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/numbers")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account/numbers")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account/numbers');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/account/numbers'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/numbers';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/numbers',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/numbers")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/numbers',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/account/numbers'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account/numbers');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/account/numbers'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/numbers';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/numbers"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/numbers" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/numbers",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account/numbers');
echo $response->getBody();
setUrl('{{baseUrl}}/account/numbers');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/numbers');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/numbers' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/numbers' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/account/numbers")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/numbers"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/numbers"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account/numbers') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/numbers";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account/numbers
http GET {{baseUrl}}/account/numbers
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/account/numbers
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/numbers")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"count": 1
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"count": 1
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "401",
"error-code-label": "authentication failed"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "401",
"error-code-label": "authentication failed"
}
GET
Search available numbers
{{baseUrl}}/number/search
QUERY PARAMS
country
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/number/search?country=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/number/search" {:query-params {:country ""}})
require "http/client"
url = "{{baseUrl}}/number/search?country="
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/number/search?country="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/number/search?country=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/number/search?country="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/number/search?country= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/number/search?country=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/number/search?country="))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/number/search?country=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/number/search?country=")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/number/search?country=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/number/search',
params: {country: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/number/search?country=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/number/search?country=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/number/search?country=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/number/search?country=',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/number/search',
qs: {country: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/number/search');
req.query({
country: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/number/search',
params: {country: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/number/search?country=';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/number/search?country="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/number/search?country=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/number/search?country=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/number/search?country=');
echo $response->getBody();
setUrl('{{baseUrl}}/number/search');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'country' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/number/search');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'country' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/number/search?country=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/number/search?country=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/number/search?country=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/number/search"
querystring = {"country":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/number/search"
queryString <- list(country = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/number/search?country=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/number/search') do |req|
req.params['country'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/number/search";
let querystring = [
("country", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/number/search?country='
http GET '{{baseUrl}}/number/search?country='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/number/search?country='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/number/search?country=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"count": 1234
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"count": 1234
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "401",
"error-code-label": "authentication failed"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "401",
"error-code-label": "authentication failed"
}
POST
Update a number
{{baseUrl}}/number/update
BODY formUrlEncoded
app_id
country
messagesCallbackType
messagesCallbackValue
moHttpUrl
moSmppSysType
msisdn
voiceCallbackType
voiceCallbackValue
voiceStatusCallback
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/number/update");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/x-www-form-urlencoded");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/number/update" {:form-params {:app_id ""
:country ""
:messagesCallbackType ""
:messagesCallbackValue ""
:moHttpUrl ""
:moSmppSysType ""
:msisdn ""
:voiceCallbackType ""
:voiceCallbackValue ""
:voiceStatusCallback ""}})
require "http/client"
url = "{{baseUrl}}/number/update"
headers = HTTP::Headers{
"content-type" => "application/x-www-form-urlencoded"
}
reqBody = "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback="
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/number/update"),
Content = new FormUrlEncodedContent(new Dictionary
{
{ "app_id", "" },
{ "country", "" },
{ "messagesCallbackType", "" },
{ "messagesCallbackValue", "" },
{ "moHttpUrl", "" },
{ "moSmppSysType", "" },
{ "msisdn", "" },
{ "voiceCallbackType", "" },
{ "voiceCallbackValue", "" },
{ "voiceStatusCallback", "" },
}),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/number/update");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/number/update"
payload := strings.NewReader("app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/number/update HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: example.com
Content-Length: 155
app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/number/update")
.setHeader("content-type", "application/x-www-form-urlencoded")
.setBody("app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/number/update"))
.header("content-type", "application/x-www-form-urlencoded")
.method("POST", HttpRequest.BodyPublishers.ofString("app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback="))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=");
Request request = new Request.Builder()
.url("{{baseUrl}}/number/update")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/number/update")
.header("content-type", "application/x-www-form-urlencoded")
.body("app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=")
.asString();
const data = 'app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=';
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/number/update');
xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
xhr.send(data);
import axios from 'axios';
const encodedParams = new URLSearchParams();
encodedParams.set('app_id', '');
encodedParams.set('country', '');
encodedParams.set('messagesCallbackType', '');
encodedParams.set('messagesCallbackValue', '');
encodedParams.set('moHttpUrl', '');
encodedParams.set('moSmppSysType', '');
encodedParams.set('msisdn', '');
encodedParams.set('voiceCallbackType', '');
encodedParams.set('voiceCallbackValue', '');
encodedParams.set('voiceStatusCallback', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/update',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: encodedParams,
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/number/update';
const options = {
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
app_id: '',
country: '',
messagesCallbackType: '',
messagesCallbackValue: '',
moHttpUrl: '',
moSmppSysType: '',
msisdn: '',
voiceCallbackType: '',
voiceCallbackValue: '',
voiceStatusCallback: ''
})
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/number/update',
method: 'POST',
headers: {
'content-type': 'application/x-www-form-urlencoded'
},
data: {
app_id: '',
country: '',
messagesCallbackType: '',
messagesCallbackValue: '',
moHttpUrl: '',
moSmppSysType: '',
msisdn: '',
voiceCallbackType: '',
voiceCallbackValue: '',
voiceStatusCallback: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/x-www-form-urlencoded")
val body = RequestBody.create(mediaType, "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=")
val request = Request.Builder()
.url("{{baseUrl}}/number/update")
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.build()
val response = client.newCall(request).execute()
const qs = require('querystring');
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/number/update',
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(qs.stringify({
app_id: '',
country: '',
messagesCallbackType: '',
messagesCallbackValue: '',
moHttpUrl: '',
moSmppSysType: '',
msisdn: '',
voiceCallbackType: '',
voiceCallbackValue: '',
voiceStatusCallback: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/update',
headers: {'content-type': 'application/x-www-form-urlencoded'},
form: {
app_id: '',
country: '',
messagesCallbackType: '',
messagesCallbackValue: '',
moHttpUrl: '',
moSmppSysType: '',
msisdn: '',
voiceCallbackType: '',
voiceCallbackValue: '',
voiceStatusCallback: ''
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/number/update');
req.headers({
'content-type': 'application/x-www-form-urlencoded'
});
req.form({
app_id: '',
country: '',
messagesCallbackType: '',
messagesCallbackValue: '',
moHttpUrl: '',
moSmppSysType: '',
msisdn: '',
voiceCallbackType: '',
voiceCallbackValue: '',
voiceStatusCallback: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const { URLSearchParams } = require('url');
const encodedParams = new URLSearchParams();
encodedParams.set('app_id', '');
encodedParams.set('country', '');
encodedParams.set('messagesCallbackType', '');
encodedParams.set('messagesCallbackValue', '');
encodedParams.set('moHttpUrl', '');
encodedParams.set('moSmppSysType', '');
encodedParams.set('msisdn', '');
encodedParams.set('voiceCallbackType', '');
encodedParams.set('voiceCallbackValue', '');
encodedParams.set('voiceStatusCallback', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/number/update',
headers: {'content-type': 'application/x-www-form-urlencoded'},
data: encodedParams,
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const { URLSearchParams } = require('url');
const fetch = require('node-fetch');
const encodedParams = new URLSearchParams();
encodedParams.set('app_id', '');
encodedParams.set('country', '');
encodedParams.set('messagesCallbackType', '');
encodedParams.set('messagesCallbackValue', '');
encodedParams.set('moHttpUrl', '');
encodedParams.set('moSmppSysType', '');
encodedParams.set('msisdn', '');
encodedParams.set('voiceCallbackType', '');
encodedParams.set('voiceCallbackValue', '');
encodedParams.set('voiceStatusCallback', '');
const url = '{{baseUrl}}/number/update';
const options = {
method: 'POST',
headers: {'content-type': 'application/x-www-form-urlencoded'},
body: encodedParams
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/x-www-form-urlencoded" };
NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"app_id=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&country=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&messagesCallbackType=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&messagesCallbackValue=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&moHttpUrl=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&moSmppSysType=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&msisdn=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&voiceCallbackType=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&voiceCallbackValue=" dataUsingEncoding:NSUTF8StringEncoding]];
[postData appendData:[@"&voiceStatusCallback=" dataUsingEncoding:NSUTF8StringEncoding]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/number/update"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/number/update" in
let headers = Header.add (Header.init ()) "content-type" "application/x-www-form-urlencoded" in
let body = Cohttp_lwt_body.of_string "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/number/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=",
CURLOPT_HTTPHEADER => [
"content-type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/number/update', [
'form_params' => [
'app_id' => '',
'country' => '',
'messagesCallbackType' => '',
'messagesCallbackValue' => '',
'moHttpUrl' => '',
'moSmppSysType' => '',
'msisdn' => '',
'voiceCallbackType' => '',
'voiceCallbackValue' => '',
'voiceStatusCallback' => ''
],
'headers' => [
'content-type' => 'application/x-www-form-urlencoded',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/number/update');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/x-www-form-urlencoded'
]);
$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields([
'app_id' => '',
'country' => '',
'messagesCallbackType' => '',
'messagesCallbackValue' => '',
'moHttpUrl' => '',
'moSmppSysType' => '',
'msisdn' => '',
'voiceCallbackType' => '',
'voiceCallbackValue' => '',
'voiceStatusCallback' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(new http\QueryString([
'app_id' => '',
'country' => '',
'messagesCallbackType' => '',
'messagesCallbackValue' => '',
'moHttpUrl' => '',
'moSmppSysType' => '',
'msisdn' => '',
'voiceCallbackType' => '',
'voiceCallbackValue' => '',
'voiceStatusCallback' => ''
]));
$request->setRequestUrl('{{baseUrl}}/number/update');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/x-www-form-urlencoded'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/number/update' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback='
$headers=@{}
$headers.Add("content-type", "application/x-www-form-urlencoded")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/number/update' -Method POST -Headers $headers -ContentType 'application/x-www-form-urlencoded' -Body 'app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback='
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback="
headers = { 'content-type': "application/x-www-form-urlencoded" }
conn.request("POST", "/baseUrl/number/update", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/number/update"
payload = {
"app_id": "",
"country": "",
"messagesCallbackType": "",
"messagesCallbackValue": "",
"moHttpUrl": "",
"moSmppSysType": "",
"msisdn": "",
"voiceCallbackType": "",
"voiceCallbackValue": "",
"voiceStatusCallback": ""
}
headers = {"content-type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/number/update"
payload <- "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback="
encode <- "form"
response <- VERB("POST", url, body = payload, content_type("application/x-www-form-urlencoded"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/number/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/x-www-form-urlencoded'
request.body = "app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback="
response = http.request(request)
puts response.read_body
require 'faraday'
data = {
:app_id => "",
:country => "",
:messagesCallbackType => "",
:messagesCallbackValue => "",
:moHttpUrl => "",
:moSmppSysType => "",
:msisdn => "",
:voiceCallbackType => "",
:voiceCallbackValue => "",
:voiceStatusCallback => "",
}
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/x-www-form-urlencoded'}
)
response = conn.post('/baseUrl/number/update') do |req|
req.body = URI.encode_www_form(data)
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/number/update";
let payload = json!({
"app_id": "",
"country": "",
"messagesCallbackType": "",
"messagesCallbackValue": "",
"moHttpUrl": "",
"moSmppSysType": "",
"msisdn": "",
"voiceCallbackType": "",
"voiceCallbackValue": "",
"voiceStatusCallback": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/x-www-form-urlencoded".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.form(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/number/update \
--header 'content-type: application/x-www-form-urlencoded' \
--data app_id= \
--data country= \
--data messagesCallbackType= \
--data messagesCallbackValue= \
--data moHttpUrl= \
--data moSmppSysType= \
--data msisdn= \
--data voiceCallbackType= \
--data voiceCallbackValue= \
--data voiceStatusCallback=
http --form POST {{baseUrl}}/number/update \
content-type:application/x-www-form-urlencoded \
app_id='' \
country='' \
messagesCallbackType='' \
messagesCallbackValue='' \
moHttpUrl='' \
moSmppSysType='' \
msisdn='' \
voiceCallbackType='' \
voiceCallbackValue='' \
voiceStatusCallback=''
wget --quiet \
--method POST \
--header 'content-type: application/x-www-form-urlencoded' \
--body-data 'app_id=&country=&messagesCallbackType=&messagesCallbackValue=&moHttpUrl=&moSmppSysType=&msisdn=&voiceCallbackType=&voiceCallbackValue=&voiceStatusCallback=' \
--output-document \
- {{baseUrl}}/number/update
import Foundation
let headers = ["content-type": "application/x-www-form-urlencoded"]
let postData = NSMutableData(data: "app_id=".data(using: String.Encoding.utf8)!)
postData.append("&country=".data(using: String.Encoding.utf8)!)
postData.append("&messagesCallbackType=".data(using: String.Encoding.utf8)!)
postData.append("&messagesCallbackValue=".data(using: String.Encoding.utf8)!)
postData.append("&moHttpUrl=".data(using: String.Encoding.utf8)!)
postData.append("&moSmppSysType=".data(using: String.Encoding.utf8)!)
postData.append("&msisdn=".data(using: String.Encoding.utf8)!)
postData.append("&voiceCallbackType=".data(using: String.Encoding.utf8)!)
postData.append("&voiceCallbackValue=".data(using: String.Encoding.utf8)!)
postData.append("&voiceStatusCallback=".data(using: String.Encoding.utf8)!)
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/number/update")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "200",
"error-code-label": "success"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "200",
"error-code-label": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"error-code": "401",
"error-code-label": "authentication failed"
}
RESPONSE HEADERS
Content-Type
text/xml
RESPONSE BODY xml
{
"error-code": "401",
"error-code-label": "authentication failed"
}