This API allows you to retrieve Capex Request Types from various platforms such as web browsers, native applications in Android, and iOS.
API URL:
http://<server-ip-addres>/custom_api/capex_type
Method: GET
URL Parameters:
| URL Parameters | Required |
|---|---|
| format=json (In future, Maybe change to default) | Yes |
| Optional | None |
Form Data Parameters:
None
Header Parameters:
Authorization:
Bearer <Token> (Replace <Token> with the actual access token)
Success Response:
Code: 200
Content:
{
"code": 200,
"message": "success",
"data": {
"standalone": "Standalone Capex",
"project": "Project",
"envelope": "Envelope",
"other": "Other",
"Test Satish": "Test Satish"
}
}
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/capex_type?format=json" -H "
Authorization:
Bearer <Token>"
PHP Code:
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://<server-ip-address>/custom_api/capex_type?format=json',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <Token>'
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
JavaScript code:
const url = 'http://<server-ip-address>/custom_api/capex_type?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));