At the moment, if a company wishes to interact and communicate with their customers daily in Madagascar using an SMS, it must enter into a contract with Malagasy operators to benefit from an SMS sending subscription.
This protocol will certainly be expensive for the company because of the time taken to integrate the solutions of each operator which are really different from each other, the tests, the maintenance and also the monthly, half-yearly or annual invoices to pay for each operator.
Thus, we decided to set up MAPI to manage these problems, MAPI will then take care of
the connection to the various Malagasy operators. MAPI will be smart enough to use the operator that will correspond
to the recipient’s number, and if any problem occurs with one of the operators, we can automatically switch to
another operator to send the SMS.
First, you must have a MAPI client account to be able to perform operations.
Navigate to https://messaging.mapi.mg/authentication/signup
for creating an account.
You can login after that.
The token obtained from the login has a limited life of 15 minutes (900 seconds) and must be renewed regularly.
curl --location 'https://messaging.mapi.mg/api/authentication/login'
--form "Username=your_username"
--form "Password=your_password"
POST /api/authentication/login HTTP/1.1
Host: messaging.mapi.mg
Content-Length: 248
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Username"
your_username
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Password"
your_password
------WebKitFormBoundary7MA4YWxkTrZu0gW--
import requests
url = "https://messaging.mapi.mg/api/authentication/login"
payload = {
'Username': 'your_username',
'Password': 'your_password'
}
files=[
]
headers = {
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("Username","your_username")
.addFormDataPart("Password","your_password")
.build();
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/authentication/login")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/authentication/login");
var content = new MultipartFormDataContent();
content.Add(new StringContent("your_username"), "Username");
content.Add(new StringContent("your_password"), "Password");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('Username', 'your_username');
data.append('Password', 'your_password');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/authentication/login',
headers: {
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/authentication/login',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('Username' => 'your_username','Password' => 'your_password'),
CURLOPT_HTTPHEADER => array(),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"bytes"
"mime/multipart"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/authentication/login"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("Username", "your_username")
_ = writer.WriteField("Password", "your_password")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 07:14:28 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 250 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 07:14:46 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 61 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
You can easily send a single SMS.
curl 'https://messaging.mapi.mg/api/msg/send' \
-H 'Authorization: {{mapi_token}}' \
-F 'Recipient="xxxxxxxxxx"' \
-F 'Message="Message you will sent"' \
-F 'Channel="sms"'
POST /api/msg/send HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
Content-Length: 345
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Recipient"
xxxxxxxxxx
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Message"
Message you will sent
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Channel"
sms
------WebKitFormBoundary7MA4YWxkTrZu0gW--
import requests
url = "https://messaging.mapi.mg/api/msg/send"
payload = {'Recipient': 'xxxxxxxxxx',
'Message': 'Message you will sent',
'Channel': 'sms'}
files=[
]
headers = {
'Authorization': '{{mapi_token}}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("Recipient","xxxxxxxxxx")
.addFormDataPart("Message","Message you will sent")
.addFormDataPart("Channel","sms")
.build();
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/msg/send")
.method("POST", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/msg/send");
request.Headers.Add("Authorization", "{{mapi_token}}");
var content = new MultipartFormDataContent();
content.Add(new StringContent("xxxxxxxxxx"), "Recipient");
content.Add(new StringContent("Message you will sent"), "Message");
content.Add(new StringContent("sms"), "Channel");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('Recipient', 'xxxxxxxxxx');
data.append('Message', 'Message you will sent');
data.append('Channel', 'sms');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/msg/send',
headers: {
'Authorization': '{{mapi_token}}',
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/msg/send',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('Recipient' => 'xxxxxxxxxx','Message' => 'Message you will sent','Channel' => 'sms'),
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"bytes"
"mime/multipart"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/msg/send"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("Recipient", "xxxxxxxxxx")
_ = writer.WriteField("Message", "Message you will sent")
_ = writer.WriteField("Channel", "sms")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 08:12:24 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 92 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 409 Conflict |
---|---|
Date | Wed, 04 Sep 2024 08:13:14 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 115 |
Keep-Alive | timeout=500, max=98 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 08:14:27 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Sending bulk SMS is possible, from an Excel file. The accepted format types are: xls, xlsx and csv.
The file structure is:
The first column of the Excel file must contain the last name (optional).
The second column must contain the first
name (optional).
The third column must contain the telephone number and is required.
The fourth column is for remarks and is optional.
The personalized message in the last columnEndFragment
curl --location 'https://messaging.mapi.mg/api/msg/sendBulkSms' \
--header 'Authorization: {{mapi_token}}' \
--header 'Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn' \
--form 'File=@"postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9"'
POST /api/msg/sendBulkSms HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn
Content-Length: 241
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="File"; filename="postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9"
Content-Type:
(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW--
import requests
url = "https://messaging.mapi.mg/api/msg/sendBulkSms"
payload = {}
files=[
('File',('1ef669c1-c2fc-4a00-ae04-071a9b002bd9',open('postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9','rb'),'application/octet-stream'))
]
headers = {
'Authorization': '{{mapi_token}}',
'Cookie': 'PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("File","postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9")))
.build();
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/msg/sendBulkSms")
.method("POST", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/msg/sendBulkSms");
request.Headers.Add("Authorization", "{{mapi_token}}");
request.Headers.Add("Cookie", "PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn");
var content = new MultipartFormDataContent();
content.Add(new StreamContent(File.OpenRead("postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9")), "File", "postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('File', fs.createReadStream('postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9'));
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/msg/sendBulkSms',
headers: {
'Authorization': '{{mapi_token}}',
'Cookie': 'PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn',
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/msg/sendBulkSms',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('File'=> new CURLFILE('postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9')),
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}',
'Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"bytes"
"mime/multipart"
"os"
"path/filepath"
"io"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/msg/sendBulkSms"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
file, errFile1 := os.Open("postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9")
defer file.Close()
part1,
errFile1 := writer.CreateFormFile("File",filepath.Base("postman-cloud:///1ef669c1-c2fc-4a00-ae04-071a9b002bd9"))
_, errFile1 = io.Copy(part1, file)
if errFile1 != nil {
fmt.Println(errFile1)
return
}
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
req.Header.Add("Cookie", "PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 08:16:57 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 58 |
Keep-Alive | timeout=500, max=97 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 08:16:24 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 422 Unprocessable Entity |
---|---|
Date | Wed, 04 Sep 2024 08:18:10 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 76 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 0 |
---|---|
Date | Wed, 04 Sep 2024 08:19:08 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 140 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
Status | 409 Conflict |
---|---|
Date | Wed, 04 Sep 2024 08:28:30 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 125 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
We can also send the same SMS to a list of recipients grouped together in an excel file. The accepted format types are: xls, xlsx and csv.
Put the recipients’ numbers in the first column of the file.
curl --location 'https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients' \
--header 'Authorization: {{mapi_token}}' \
--header 'Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn' \
--form 'File=@"postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad"' \
--form 'Message="Your message"'
POST /api/msg/sendUniqueSmsToRecipients HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn
Content-Length: 342
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="File"; filename="postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad"
Content-Type:
(data)
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Message"
Your message
------WebKitFormBoundary7MA4YWxkTrZu0gW--
import requests
url = "https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients"
payload = {'Message': 'Your message'}
files=[
('File',('1ef669b7-c7b1-45a0-b04e-db103e78f5ad',open('postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad','rb'),'application/octet-stream'))
]
headers = {
'Authorization': '{{mapi_token}}',
'Cookie': 'PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("File","postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad",
RequestBody.create(MediaType.parse("application/octet-stream"),
new File("postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad")))
.addFormDataPart("Message","Your message")
.build();
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients")
.method("POST", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients");
request.Headers.Add("Authorization", "{{mapi_token}}");
request.Headers.Add("Cookie", "PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn");
var content = new MultipartFormDataContent();
content.Add(new StreamContent(File.OpenRead("postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad")), "File", "postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad");
content.Add(new StringContent("Your message"), "Message");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('File', fs.createReadStream('postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad'));
data.append('Message', 'Your message');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients',
headers: {
'Authorization': '{{mapi_token}}',
'Cookie': 'PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn',
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('File'=> new CURLFILE('postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad'),'Message' => 'Your message'),
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}',
'Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"bytes"
"mime/multipart"
"os"
"path/filepath"
"io"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/msg/sendUniqueSmsToRecipients"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
file, errFile1 := os.Open("postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad")
defer file.Close()
part1,
errFile1 := writer.CreateFormFile("File",filepath.Base("postman-cloud:///1ef669b7-c7b1-45a0-b04e-db103e78f5ad"))
_, errFile1 = io.Copy(part1, file)
if errFile1 != nil {
fmt.Println(errFile1)
return
}
_ = writer.WriteField("Message", "Your message")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
req.Header.Add("Cookie", "PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 08:24:09 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 58 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 08:23:18 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 422 Unprocessable Entity |
---|---|
Date | Wed, 04 Sep 2024 08:25:06 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 140 |
Keep-Alive | timeout=500, max=98 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 409 Conflict |
---|---|
Date | Wed, 04 Sep 2024 08:28:30 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 125 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 422 Unprocessable Entity |
---|---|
Date | Wed, 04 Sep 2024 08:30:41 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 76 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 422 Unprocessable Entity |
---|---|
Date | Wed, 04 Sep 2024 08:31:48 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 47 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
You can get the list of messages you sent.
curl --location 'https://messaging.mapi.mg/api/msg?limit=2&offset=0' \
--header 'Authorization: {{mapi_token}}' \
--header 'Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
GET /api/msg?limit=2&offset=0 HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn
import requests
url = "https://messaging.mapi.mg/api/msg?limit=2&offset=0"
payload = {}
headers = {
'Authorization': '{{mapi_token}}',
'Cookie': 'PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/msg?limit=2&offset=0")
.method("GET", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://messaging.mapi.mg/api/msg?limit=2&offset=0");
request.Headers.Add("Authorization", "{{mapi_token}}");
request.Headers.Add("Cookie", "PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/msg?limit=2&offset=0',
headers: {
'Authorization': '{{mapi_token}}',
'Cookie': 'PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/msg?limit=2&offset=0',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}',
'Cookie: PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/msg?limit=2&offset=0"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
req.Header.Add("Cookie", "PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 08:34:05 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 431 |
Keep-Alive | timeout=500, max=98 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 08:33:27 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Set-Cookie | PHPSESSID=kv3agkrjhtm8b6imfcp8inbthn; path=/ |
Content-Length | 64 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
You can easily request an OTP.
curl --location 'https://messaging.mapi.mg/api/otp/verify' \
--form 'Recipient="03xxxxxxxx"' \
--form 'Code="xxxxxx"'
POST /api/otp/request HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
Content-Length: 235
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Recipient"
03xxxxxxxx
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Channel"
sms
------WebKitFormBoundary7MA4YWxkTrZu0gW--
import requests
url = "https://messaging.mapi.mg/api/otp/verify"
payload = {
'Recipient': '03xxxxxxxx',
'Code': 'xxxxxx'
}
files=[
]
headers = {}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("Recipient","03xxxxxxxx")
.addFormDataPart("Channel","sms")
.build();
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/otp/request")
.method("POST", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/otp/verify");
var content = new MultipartFormDataContent();
content.Add(new StringContent("03xxxxxxxx"), "Recipient");
content.Add(new StringContent("xxxxxx"), "Code");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('Recipient', '03xxxxxxxx');
data.append('Code', 'xxxxxx');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/otp/verify',
headers: {
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/otp/verify',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('Recipient' => '03xxxxxxxx','Code' => 'xxxxxx'),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"bytes"
"mime/multipart"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/otp/verify"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("Recipient", "03xxxxxxxx")
_ = writer.WriteField("Code", "xxxxxx")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 09:08:13 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 213 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 09:09:13 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=98 |
Connection | Keep-Alive |
Content-Type | application/json |
|
curl --location 'https://messaging.mapi.mg/api/otp/request' \
--header 'Authorization: {{mapi_token}}' \
--form 'Recipient="03xxxxxxxx"' \
--form 'Channel="sms"'
POST /api/otp/request HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
Content-Length: 235
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Recipient"
03xxxxxxxx
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="Channel"
sms
------WebKitFormBoundary7MA4YWxkTrZu0gW--
import requests
url = "https://messaging.mapi.mg/api/otp/request"
payload = {
'Recipient': '03xxxxxxxx',
'Channel': 'sms'
}
files=[
]
headers = {
'Authorization': '{{mapi_token}}'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("Recipient","03xxxxxxxx")
.addFormDataPart("Code","xxxxxx")
.build();
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/otp/verify")
.method("POST", body)
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/otp/request");
request.Headers.Add("Authorization", "{{mapi_token}}");
var content = new MultipartFormDataContent();
content.Add(new StringContent("03xxxxxxxx"), "Recipient");
content.Add(new StringContent("sms"), "Channel");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('Recipient', '03xxxxxxxx');
data.append('Channel', 'sms');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/otp/request',
headers: {
'Authorization': '{{mapi_token}}',
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/otp/request',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('Recipient' => '03xxxxxxxx','Channel' => 'sms'),
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"bytes"
"mime/multipart"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/otp/request"
method := "POST"
payload := &bytes.Buffer{}
writer := multipart.NewWriter(payload)
_ = writer.WriteField("Recipient", "03xxxxxxxx")
_ = writer.WriteField("Channel", "sms")
err := writer.Close()
if err != nil {
fmt.Println(err)
return
}
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
req.Header.Set("Content-Type", writer.FormDataContentType())
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 09:15:03 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 44 |
Keep-Alive | timeout=500, max=97 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 422 Unprocessable Entity |
---|---|
Date | Wed, 04 Sep 2024 09:15:14 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 55 |
Keep-Alive | timeout=500, max=96 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 422 Unprocessable Entity |
---|---|
Date | Wed, 04 Sep 2024 09:15:30 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 52 |
Keep-Alive | timeout=500, max=95 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 09:15:44 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=94 |
Connection | Keep-Alive |
Content-Type | application/json |
|
curl --location 'https://messaging.mapi.mg/api/otp?limit=10&offset=0' \
--header 'Authorization: {{mapi_token}}'
GET /api/otp?limit=10&offset=0 HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
import requests
url = "https://messaging.mapi.mg/api/otp?limit=10&offset=0"
payload = {}
headers = {
'Authorization': '{{mapi_token}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/otp?limit=10&offset=0")
.method("GET", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://messaging.mapi.mg/api/otp?limit=10&offset=0");
request.Headers.Add("Authorization", "{{mapi_token}}");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/otp?limit=10&offset=0',
headers: {
'Authorization': '{{mapi_token}}'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/otp?limit=10&offset=0',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/otp?limit=10&offset=0"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 09:19:26 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 475 |
Keep-Alive | timeout=500, max=97 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 09:21:18 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Get the number of SMS you can use.
curl --location --request GET 'https://messaging.mapi.mg/api/smsoffer/available' \
--header 'Authorization: {{mapi_token}}'
GET /api/smsoffer/available HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
import requests
url = "https://messaging.mapi.mg/api/smsoffer/available"
payload = {}
headers = {
'Authorization': '{{mapi_token}}'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/smsoffer/available")
.method("GET", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://messaging.mapi.mg/api/smsoffer/available");
request.Headers.Add("Authorization", "{{mapi_token}}");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
let config = {
method: 'get',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/smsoffer/available',
headers: {
'Authorization': '{{mapi_token}}'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/smsoffer/available',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/smsoffer/available"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 09:22:33 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 33 |
Keep-Alive | timeout=500, max=100 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 09:22:51 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=99 |
Connection | Keep-Alive |
Content-Type | application/json |
|
curl -X POST -H "Authorization: {{mapi_token}}" "https://messaging.mapi.mg/api/authentication/logout"
POST /api/authentication/logout HTTP/1.1
Host: messaging.mapi.mg
Authorization: {{mapi_token}}
import requests
url = "https://messaging.mapi.mg/api/authentication/logout"
payload = {}
headers = {
'Authorization': '{{mapi_token}}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://messaging.mapi.mg/api/authentication/logout")
.method("POST", body)
.addHeader("Authorization", "{{mapi_token}}")
.build();
Response response = client.newCall(request).execute();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://messaging.mapi.mg/api/authentication/logout");
request.Headers.Add("Authorization", "{{mapi_token}}");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
const axios = require('axios');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://messaging.mapi.mg/api/authentication/logout',
headers: {
'Authorization': '{{mapi_token}}'
}
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://messaging.mapi.mg/api/authentication/logout',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'Authorization: {{mapi_token}}'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://messaging.mapi.mg/api/authentication/logout"
method := "POST"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "{{mapi_token}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Status | 200 OK |
---|---|
Date | Wed, 04 Sep 2024 09:23:27 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 51 |
Keep-Alive | timeout=500, max=98 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 09:23:42 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 47 |
Keep-Alive | timeout=500, max=97 |
Connection | Keep-Alive |
Content-Type | application/json |
|
Status | 401 Unauthorized |
---|---|
Date | Wed, 04 Sep 2024 09:24:18 GMT |
Server | Apache |
Expires | Thu, 19 Nov 1981 08:52:00 GMT |
Cache-Control | no-store, no-cache, must-revalidate |
Pragma | no-cache |
Content-Length | 64 |
Keep-Alive | timeout=500, max=94 |
Connection | Keep-Alive |
Content-Type | application/json |
|