Create Actual
Description :
Use this API to create actual data, accessible from various platforms like web browsers, native applications in Android, or iOS.
URL :
http:///custom_api/aliaxis_to_cap_ex_plan/actual_creation
Method : POST
URL PArameters | Required |
---|---|
JSON (May change to default in future) | Yes |
Amount in Company Code Currency | No |
Amount in Global Currency | No |
Invoice Reference | No |
Purchasing Document | No |
Form Data Parameters:
Key | Value |
---|---|
CompanyCode | FR52 |
ProfitCenter | FR19012C |
WBSElementExternalID | 1.30.15.05.05 |
ProjectExternalID | 9012034 |
Amount In Transaction Currency | 123456 |
Transaction Currency | USD |
Invoice Reference | 123 |
Posting Date | 2023-07-20 23:59:59 |
Purchasing Document | 123 |
Header Parameters:
Authorization :
Bearer <Token>
Example Request :
curl -X POST :
"http:///custom_api/aliaxis_to_cap_ex_plan/actual_creation" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer " \
-d '{
"CompanyCode": "FR52",
"ProfitCenter": "FR19012C",
"WBSElementExternalID": "1.30.15.05.05",
"ProjectExternalID": "9012034",
"AmountInTransactionCurrency": "123456",
"TransactionCurrency": "USD",
"InvoiceReference": "123",
"PostingDate": "2023-07-20 23:59:59",
"PurchasingDocument": "123"
}'
PHP Code :
Using cURL in PHP, you can create a POST request as follows:
/custom_api/aliaxis_to_cap_ex_plan/actual_creation";
$headers = array(
"Content-Type: application/json",
"Authorization: Bearer "
);
$data = array(
"CompanyCode" => "FR52",
"ProfitCenter" => "FR19012C",
"WBSElementExternalID" => "1.30.15.05.05",
"ProjectExternalID" => "9012034",
"AmountInTransactionCurrency" => "123456",
"TransactionCurrency" => "USD",
"InvoiceReference" => "123",
"PostingDate" => "2023-07-20 23:59:59",
"PurchasingDocument" => "123"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
if ($response === false) {
echo 'Error: ' . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
?>
Javascript Code :
Using the Fetch API in JavaScript, you can make the POST request as follows:
const url = "http:///custom_api/aliaxis_to_cap_ex_plan/actual_creation";
const headers = {
"Content-Type": "application/json",
"Authorization": "Bearer "
};
const data = {
"CompanyCode": "FR52",
"ProfitCenter": "FR19012C",
"WBSElementExternalID": "1.30.15.05.05",
"ProjectExternalID": "9012034",
"AmountInTransactionCurrency": "123456",
"TransactionCurrency": "USD",
"InvoiceReference": "123",
"PostingDate": "2023-07-20 23:59:59",
"PurchasingDocument": "123"
};
fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
These code snippets send the required data to the given endpoint with the appropriate headers. In both examples, replace <server-ip-address> and <Token> with your actual server IP address and authorization token.
Success Response:
Code : 200
Content :
Indicates successful creation of the actual.
Error Response :
Invalid API Token
Code :
Code: 401 BAD REQUEST
Content :
{
"code": 401,
"message": "fail",
"data": {
"error": "Invalid API Token"
}
}
1- Missing Fields :
Code: 400
Content :
Multiple messages corresponding to missing required fields, such as:
{
"code": 400,
"message": "fail",
"data": {
"[CompanyCode]": [
"This field is missing."
]
}
}
2- Missing ProfitCenter :
Code: 400
Content :
{
"code": 400,
"message": "fail",
"data": {
"[ProfitCenter]": [
"This field is missing."
]
}
}
3- Missing WBSElementExternalID :
Code: 400
Content :
{
"code": 400,
"message": "fail",
"data": {
"[WBSElementExternalID]": [
"This field is missing."
]
}
}
4- Missing Project External ID:
Code: 400
Content :
{
"code": 400,
"message": "fail",
"data": {
"[ProjectExternalID]": [
"This field is missing."
]
}
}
5- Missing Amount InTransaction Currency:
Code: 400
Content :
{
"code": 400,
"message": "fail",
"data": {
"[AmountInTransactionCurrency]": [
"This field is missing."
]
}
}
Missing Posting Date:
Code: 400
Content :
{
"code": 400,
"message": "fail",
"data": {
"[PostingDate]": [
"This field is missing."
]
}
}
These detailed error messages provide clear guidance on which specific required fields were missing from the request. This assists the developer in quickly identifying and correcting the issue, making for a more robust and user-friendly API experience.