Create Actual

Estimated reading: 3 minutes

Description :

Use this API to create actual data, accessible from various platforms like web browsers, native applications in Android, or iOS.

URL :

				
					http://<server-ip-address>/custom_api/aliaxis_to_cap_ex_plan/actual_creation

				
			
Method : POST
URL PArametersRequired
JSON (May change to default in future)Yes
Amount in Company Code CurrencyNo
Amount in Global CurrencyNo
Invoice ReferenceNo
Purchasing DocumentNo

Form Data Parameters:

KeyValue
CompanyCodeFR52
ProfitCenterFR19012C
WBSElementExternalID1.30.15.05.05
ProjectExternalID9012034
Amount In Transaction Currency 123456
Transaction CurrencyUSD
Invoice Reference123
Posting Date2023-07-20 23:59:59
Purchasing Document123

Header Parameters:

Authorization :

Bearer <Token>

Example Request :

curl -X POST :

				
					"http://<server-ip-address>/custom_api/aliaxis_to_cap_ex_plan/actual_creation" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer <Token>" \
     -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:

				
					<?php

$url = "http://<server-ip-address>/custom_api/aliaxis_to_cap_ex_plan/actual_creation";

$headers = array(
    "Content-Type: application/json",
    "Authorization: Bearer <Token>"
);

$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://<server-ip-address>/custom_api/aliaxis_to_cap_ex_plan/actual_creation";
const headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <Token>"
};

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.

Share this Doc

Create Actual

Or copy link

CONTENTS