This API allows you to retrieve Permitted Currency from various platforms such as web browsers, native applications in Android, and iOS.
URL For Permitted Currency:
http://<server-ip-address>/custom_api/permitted_currency
Method: GET
| URL Parameters | Required |
|---|---|
| format=json (In future, Maybe change to default) | Yes |
| Optional | No |
Form Data Parameters:
No
Header Parameters:
Authorization:
Bearer <Token> (Replace <Token> with the actual access token)
Success Response:
Code: 200
Content:
{
"code": 200,
"message": "success",
"data": [
"ARS",
"AUD",
"BRL",
"CAD",
"EUR",
"JOD",
"USD"
]
}
Error Response:
Code: 401 BAD REQUEST
Content:
{
"code": 401,
"message": "fail",
"data": {
"error": "Invalid API Token"
}
}
Notes: The structure of the success response may change in the future if required.
Code Examples:
cURL Example:
curl -X GET "http://<server-ip-address>/custom_api/permitted_currency?format=json" -H "Authorization: Bearer <Token>"
PHP Example:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://<server-ip-address>/custom_api/permitted_currency?format=json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <Token>'
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
JavaScript Example (using Fetch API):
const url = 'http://<server-ip-address>/custom_api/permitted_currency?format=json';
const token = '<Token>';
fetch(url, {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));