Data Bundle
Purchase Data Bundle
post
{{base_url}}/databundle
Data Bundle
Take a look at how you might do this:
cURL
NodeJS
PHP - cURL
Python
Dart
1
curl --location --request POST 'https://api.1app.online/v1/databundle' \
2
--header 'Authorization: Bearer SECREY_KEY' \
3
--form 'datacode="1000"' \
4
--form 'network_id="2"' \
5
--form 'phoneno="07012345678"' \
6
--form 'reference="DJIEJ2MEUE2EN34"'
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://api.1app.online/v1/databundle',
5
'headers': {
6
'Authorization': 'Bearer SECREY_KEY'
7
},
8
formData: {
9
'datacode': '1000',
10
'network_id': '2',
11
'phoneno': '07012345678',
12
'reference': 'DJIEJ2MEUE2EN34'
13
}
14
};
15
request(options, function (error, response) {
16
if (error) throw new Error(error);
17
console.log(response.body);
18
});
19
Copied!
1
$curl = curl_init();
2
3
curl_setopt_array($curl, array(
4
CURLOPT_URL => 'https://api.1app.online/v1/databundle',
5
CURLOPT_RETURNTRANSFER => true,
6
CURLOPT_ENCODING => '',
7
CURLOPT_MAXREDIRS => 10,
8
CURLOPT_TIMEOUT => 0,
9
CURLOPT_FOLLOWLOCATION => true,
10
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
11
CURLOPT_CUSTOMREQUEST => 'POST',
12
CURLOPT_POSTFIELDS => array('datacode' => '1000','network_id' => '2','phoneno' => '07012345678','reference' => 'DJIEJ2MEUE2EN34'),
13
CURLOPT_HTTPHEADER => array(
14
'Authorization: Bearer SECREY_KEY'
15
),
16
));
17
18
$response = curl_exec($curl);
19
20
curl_close($curl);
21
echo $response;
Copied!
1
import requests
2
3
url = "https://api.1app.online/v1/databundle"
4
5
payload={'datacode': '1000',
6
'network_id': '2',
7
'phoneno': '07012345678',
8
'reference': 'DJIEJ2MEUE2EN34'}
9
files=[
10
11
]
12
headers = {
13
'Authorization': 'Bearer SECREY_KEY'
14
}
15
16
response = requests.request("POST", url, headers=headers, data=payload, files=files)
17
18
print(response.text)
Copied!
1
var headers = {
2
'Authorization': 'Bearer SECREY_KEY'
3
};
4
var request = http.MultipartRequest('POST', Uri.parse('https://api.1app.online/v1/databundle'));
5
request.fields.addAll({
6
'datacode': '1000',
7
'network_id': '2',
8
'phoneno': '07012345678',
9
'reference': 'DJIEJ2MEUE2EN34'
10
});
11
12
request.headers.addAll(headers);
13
14
http.StreamedResponse response = await request.send();
15
16
if (response.statusCode == 200) {
17
print(await response.stream.bytesToString());
18
}
19
else {
20
print(response.reasonPhrase);
21
}
22
Copied!

Sample Response

1
{
2
"status": true,
3
"message": "Success",
4
"txref": "API1090229525d60",
5
"charged": "260.00",
6
"newbal": 40083.79
7
}
Copied!