1. API Integration with Capexplan v1.2

Capexplan is the world’s most flexible capital expenditure management software. It provides companies and organizations with the tools to plan, approve, and track their entire capex and opex processes. With Capexplan, you can customize the software to align with your specific needs, including the terminology used for capex request fields. From budget planning to asset management, Capexplan offers comprehensive features for efficient capex and opex management.

Key Integration Features:

Capexplan provides APIs that enable smooth integration with your existing ERP system. This integration allows for the seamless transfer of data such as budgets, capex requests (both current and historical), and tracking information (purchase orders, receptions, invoices). By integrating with your ERP system, you can centralize and synchronize your financial and operational data effortlessly.

In addition to ERP integration, Capexplan allows you to perform custom imports and exports. Whether you need to import data from external sources or export data to specific formats, Capexplan provides flexible options to meet your needs. You can define custom import mappings and export templates, ensuring compatibility with various data formats and systems.

Capexplan supports integration with Single Sign-On systems, allowing users to access the software using their existing login credentials. By integrating Capexplan with your SSO system, you can streamline the user authentication process and enhance security.

With Capexplan’s integration capabilities, you can enhance the efficiency and accuracy of your capital expenditure process by seamlessly exchanging data with other systems. This eliminates the need for manual data entry and ensures data consistency across platforms.

Note: The integration capabilities mentioned above are subject to the specific features and configurations available in your Capexplan implementation. Please consult Capexplan’s documentation and support resources for detailed integration guidelines and specifications.

1.1 User Management Functions

Documentation for Web developers

Description

Use this API to login a user from anywhere, including web browsers, native applications on Android and iOS.

Base URL:

The following API Resources use http://<server-ip-address> as the base URL:

1.1.1 Login User

Login User

Use this API to login a user from anywhere, including web browsers, native applications on Android and iOS.

API URL:

				
					http://<server-ip-address>/custom_api/login
				
			

Method: POST

Form Data Parameters:
				
					{
  "username": "Your_Username",
  "password": "Your_Password",
  "parent_id": 50511
}

				
			
URL Parameters Required
format = json (In future, Maybe change to default)
Yes
parent_id
No
Success Response
				
					{
  "code": 200,
  "message": "success",
  "data": {
    "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
  }
}

				
			
Error Response
				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid email or password"
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[email]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This field is missing."
    ],
    "[email]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This value should not be blank."
    ]
  }
}


				
			

Code example

Here’s an example code snippet in Python using the requests library to make the API call to the “Login User” endpoint:

Python Example:

Here’s a corresponding example using cURL command in the command line:

cURL Example:

				
					import requests

url = 'http://<server-ip-address>/custom_api/login'
data = {
    'username': 'Your_Username',
    'password': 'Your_Password',
    'parent_id': 50511
}

response = requests.post(url, json=data)
if response.status_code == 200:
    json_response = response.json()
    token = json_response['data']['token']
    print('Login successful. Token:', token)
else:
    print('Login failed:', response.json()['data']['error'])

				
			
				
					curl -X POST -H "Content-Type: application/json" -d '{
    "username": "Your_Username",
    "password": "Your_Password",
    "parent_id": 50511
}' http://<server-ip-address>/custom_api/login

				
			

1.2 Request Type Management

1.2.1 Capex Request Type

Description:

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 Parametersr 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:

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));

				
			
Note:

1.3 Business Unit Management

1.3.1 Business Unit

Description:

This API allows you to retrieve Business Units from various platforms such as web browsers, native applications in Android, and iOS.

URL:

				
					http://<server-ip-address>/custom_api/business_unit
				
			
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": [
    {
      "id": 9096,
      "name": " / Aurora"
    },
    {
      "id": 9099,
      "name": " / Aurora / Group 1"
    },
    {
      "id": 9102,
      "name": " / Aurora / Group 1 / Building A New"
    }
  ]
}

				
			
Error Response:

Code: 401 BAD REQUEST

Content:

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

Notes

Code Examples:

cURL Example:

				
					curl -X GET "http://<server-ip-address>/custom_api/business_unit?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/business_unit?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/business_unit?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));

				
			
Note:

1.4 Cost Type Management

1.4.1 Cost Type

Description:

This API allows you to retrieve Cost Types from various platforms such as web browsers, native applications in Android, and iOS.

URL:

				
					http://<server-ip-address>/custom_api/cost_type
				
			
Method: GET
URL Parameters Required
format=json (In future, Maybe change to default)
Yes
Optional
No

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": {
    "7": "Engineering",
    "9": "Shipping",
    "10": "Contingency",
    "11": "Equipment & Material",
    "12": "Equipment Production",
    "108": "IT Specialist",
    "109": "Professional Services",
    "110": "Office Equipment",
    "158": "Contingency All",
    "300": "Editable Field",
    "302": "new"
  }
}

				
			

Error Response:

Code: 401 BAD REQUEST

Content:

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

Notes:

Code Examples:

cURL Example:

				
					curl -X GET "http://<server-ip-address>/custom_api/cost_type?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/cost_type?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/cost_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));

				
			
Note:

1.5 Permitted Currency Management

1.5.1 Permitted Currency Management

Description:

This API allows you to retrieve Permitted Currencies from various platforms such as web browsers, native applications in Android, and iOS.

URL:

				
					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:

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));

				
			
Note:

1.6 PO Fields

1.6.1 PO Fields

Description:

Use this API to get PO Fields from anywhere (Web Browser, Native application in android, iOS).

URL:

				
					http://<server-ip-address>/custom_api/tracking_page_fields
				
			
Method:GET
URL Parameters Required
format=json (In the future, maybe change to default)
Yes

Form Data Parameters :

Key Value
Page_name
Capex_track_purchase_orders

page_name: capex_track_purchase_orders

Header Parameters :

Authorization :

				
					Bearer <Token>
				
			
Success Response :

Code: 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": [
    {
      "field": "business_unit_name",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "request_number",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "PO_number",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "description",
      "field_type": "text",
      "field_size": 100
    },
    {
      "field": "vendor_name",
      "field_type": "text",
      "field_size": 50
    },
    {
      "field": "vendor_number",
      "field_type": "text",
      "field_size": 50
    },
    {
      "field": "PO_amount",
      "field_type": "currency",
      "field_size": 24
    },
    {
      "field": "vendor_currency",
      "field_type": "currency_value",
      "field_size": null
    },
    {
      "field": "capex_to_vendor_currency_rate",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "committed",
      "field_type": "currency",
      "field_size": 24
    },
    {
      "field": "status",
      "field_type": "select",
      "field_size": 200
    },
    {
      "field": "expense_type",
      "field_type": "select",
      "field_size": 255
    }
  ]
}

				
			
Error Response:

Code: 401 BAD REQUEST

Content:

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

OR

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[page_name]": [
      "This field is missing."
    ]
  }
}

				
			

Notes:

Sample Code :

JavaScript:

				
					// Using Fetch API
const apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields';
const token = '<Token>';

fetch(apiUrl, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
.then(response => response.json())
.then(data => {
  // Process the data here
})
.catch(error => {
  // Handle error
});

				
			
PHP Example :
				
					<?php
$apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields';
$token = '<Token>';

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (!$response) {
  // Handle cURL error
}

$data = json_decode($response, true);

if (isset($data['code']) && $data['code'] === 200) {
  // Process the data here
} else {
  // Handle API error
}

curl_close($ch);
?>

				
			
cURL Example :
cURL :
				
					curl --location --request GET 'http://<server-ip-address>/custom_api/tracking_page_fields' \
--header 'Authorization: Bearer <Token>'

				
			

In Postman, you can follow these steps to use the cURL command:

 

  1. Open Postman and create a new request.
  2. Choose the “GET” method.
  3. Enter the URL http://<server-ip-address>/custom_api/tracking_page_fields in the request URL field.
  4. Go to the “Headers” section and add a new header with the key “Authorization” and the value “Bearer <Token>” (replace <Token> with your actual API token).
  5. Click the “Send” button to execute the request.

This format should work correctly in Postman for making the cURL request to the API endpoint.

1.7 PO Line Items Fields

1.7.1 PO Line Items Fields

Description :

Use this API to get PO Line Items Fields from anywhere (Web Browser, Native application in android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/tracking_page_fields
				
			
Method: GET
URL Parameters Required
format=json (In the future, maybe change to default)
Yes

Form Data Parameters :

Key Value
page_name
capex_track_purchase_order_line_items

Header Parameters :

Authorization :

				
					Bearer <Token>
				
			

Success Response :

Code: 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": [
    {
      "field": "business_unit_name",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "request_number",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "PO_number",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "general_cost_type_id",
      "field_type": "select",
      "field_size": 255
    },
    {
      "field": "line_item_description",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "asset",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "work_order",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "CER",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "quantity",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "quantity_received",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "unit_cost",
      "field_type": "currency",
      "field_size": 11
    },
    {
      "field": "PO_line_status",
      "field_type": "select",
      "field_size": 255
    },
    {
      "field": "deposit",
      "field_type": "text",
      "field_size": 45
    }
  ]
}

				
			
Error Response :

Code: 401 BAD REQUEST

Content :

				
					json{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

OR

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[page_name]": [
      "This field is missing."
    ]
  }
}

				
			

Notes :

Sample Code :

JavaScript Example :

				
					const apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields';
const token = '<Token>';

fetch(apiUrl + '?format=json', {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
.then(response => response.json())
.then(data => {
  // Process the data here
})
.catch(error => {
  // Handle error
});

				
			
PHP Example:
				
					<?php
$apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields';
$token = '<Token>';

$ch = curl_init($apiUrl . '?format=json');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (!$response) {
  // Handle cURL error
}

$data = json_decode($response, true);

if (isset($data['code']) && $data['code'] === 200) {
  // Process the data here
} else {
  // Handle API error
}

curl_close($ch);
?>

				
			
cURL :
cURL Example :
				
					curl --location --request GET 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json' \
--header 'Authorization: Bearer <Token>'

				
			

1.8 Track Invoice Fields

1.8.1 Track Invoice Fields

Description :

Use this API to get Track Invoice Fields from anywhere (Web Browser, Native application in android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/tracking_page_fields

				
			
Method: GET
URL Parameters Required
format=json (In the future, maybe change to default)
Yes

Form Data Parameters :

Key Value
page_name
capex_track_invoices

Header Parameters :

Authorization :

				
					Bearer <Token>
				
			

Success Response :

Code: 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": [
    {
      "field": "business_unit_name",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "request_number",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "PO_number",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "invoice_number",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "amount_in_vendor_currency",
      "field_type": "currency",
      "field_size": 11
    },
    {
      "field": "vendor_currency",
      "field_type": "currency_value",
      "field_size": null
    },
    {
      "field": "asset",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "work_order",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "invoice_date",
      "field_type": "date",
      "field_size": null
    },
    {
      "field": "general_cost_type_id",
      "field_type": "select",
      "field_size": 255
    },
    {
      "field": "CER",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "quantity",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "quantity_received",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "unit_cost",
      "field_type": "currency",
      "field_size": 11
    },
    {
      "field": "rate",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "expense_type",
      "field_type": "select",
      "field_size": 255
    }
  ]
}

				
			
Error Response :

Code: 401 BAD REQUEST

Content :

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

OR

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[page_name]": [
      "This field is missing."
    ]
  }
}

				
			

Notes :

Success response may change in the future if required.

More Explanation:

The API provides information about various Track Invoice Fields, including business unit name, request number, PO number, invoice number, amount in vendor currency, vendor currency, asset, work order, invoice date, general cost type ID, CER (Cost and Equipment Request), quantity, quantity received, unit cost, rate, and expense type. The data is returned in JSON format.

Instructions to Use:

To use the API, follow these steps:

Obtain a valid API token.

Make a GET request to the API URL

				
					http://<server-ip-address>/custom_api/tracking_page_fields?format=json
				
			

Add the Authorization header with the value Bearer <Token> to authenticate the request.

Include the form data parameter page_name with the value capex_track_invoices.

Sample Code :

JavaScript Example :

				
					const apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json';
const token = '<Token>';

fetch(apiUrl, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
.then(response => response.json())
.then(data => {
  // Process the data here
})
.catch(error => {
  // Handle error
});
const apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json';
const token = '<Token>';

fetch(apiUrl, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
.then(response => response.json())
.then(data => {
  // Process the data here
})
.catch(error => {
  // Handle error
});

				
			
PHP Example :
				
					<?php
$apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json';
$token = '<Token>';

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (!$response) {
  // Handle cURL error
}

$data = json_decode($response, true);

if (isset($data['code']) && $data['code'] === 200) {
  // Process the data here
} else {
  // Handle API error
}

curl_close($ch);
?>

				
			
cURL :
cURL Example :
				
					curl --location --request GET 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json' \
--header 'Authorization: Bearer <Token>'

				
			

1.9 Track Reception Fields

1.9.1 Track Reception Fields

Description :

Use this API to get Track Reception Fields from anywhere (Web Browser, Native application in android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/tracking_page_fields

				
			
Method: GET
URL Parameters Required
format=json (In the future, maybe change to default)
Yes

Form Data Parameters :

page_name: capex_track_receptions

Header Parameters :

Key Value
Page_name:
capex_track_receptions

Authorization :

				
					Bearer <Token>
				
			

Success Response :

Code: 200

Content:

				
					{
  "code": 200,
  "message": "success",
  "data": [
    {
      "field": "business_unit_name",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "request_number",
      "field_type": "text",
      "field_size": null
    },
    {
      "field": "PO_number",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "reception_number",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "asset",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "work_order",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "general_cost_type_id",
      "field_type": "select",
      "field_size": 255
    },
    {
      "field": "CER",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "quantity",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "quantity_received",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "unit_cost",
      "field_type": "currency",
      "field_size": 11
    },
    {
      "field": "reception_date",
      "field_type": "date",
      "field_size": null
    },
    {
      "field": "receiver",
      "field_type": "text",
      "field_size": 255
    },
    {
      "field": "accepted",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "rejected",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "unit_cost_vendor_currency",
      "field_type": "currency",
      "field_size": 11
    },
    {
      "field": "vendor_currency",
      "field_type": "currency_value",
      "field_size": null
    },
    {
      "field": "rate",
      "field_type": "numeric",
      "field_size": 11
    },
    {
      "field": "expense_type",
      "field_type": "select",
      "field_size": 255
    }
  ]
}

				
			
Error Response

Code: 401 BAD REQUEST

Content :

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

OR

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[page_name]": [
      "This field is missing."
    ]
  }
}

				
			

Notes :

Sample Code

Javascript Example :

				
					const apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json';
const token = '<Token>';

fetch(apiUrl, {
  method: 'GET',
  headers: {
    'Authorization': `Bearer ${token}`
  }
})
.then(response => response.json())
.then(data => {
  // Process the data here
})
.catch(error => {
  // Handle error
});

				
			
PHP Example :
				
					<?php
$apiUrl = 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json';
$token = '<Token>';

$ch = curl_init($apiUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (!$response) {
  // Handle cURL error
}

$data = json_decode($response, true);

if (isset($data['code']) && $data['code'] === 200) {
  // Process the data here
} else {
  // Handle API error
}

curl_close($ch);
?>

				
			
cURL :
cURL Example :
				
					curl --location --request GET 'http://<server-ip-address>/custom_api/tracking_page_fields?format=json' \
--header 'Authorization: Bearer <Token>'

				
			
Note :

1.10 Create PO

1.10.1 Create PO

Description :

Use this API to create a new Purchase Order (PO) with the provided details.

URL :

				
					 http://<server-ip-address>/custom_api/capex_track_purchase_order/create
				
			
Method: POST
URL Parameters Required
format=json (In the future, maybe change to default)
Yes

Form Data Parameters :

Key Value
business_unit_name:
Almiranta1 / Aurora
request_number
AU-2020-4133
PO_number:
1
vendor_name
sdfsddf
vendor_number:
sdfsdf
PO_amount
5.85555
vendor_currency
USD
capex_to_vendor_currency_rate
1
committed
858
expense_type
Capital Expenditures

Header Parameters :

Authorization :

				
					Bearer <Token>
				
			

Success Response :

Code: 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": []
}

				
			

Error Response

Code: 401 BAD REQUEST

Content :

				
					json{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

OR

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[field_name]": [
      "This field is missing."
    ]
  }
}

				
			

Notes :

Explanation :

The API allows you to create a new Purchase Order (PO) by submitting the necessary details as form data parameters. These details include business unit name, request number, PO number, description, vendor name, vendor number, PO amount, vendor currency, conversion rate from capex to vendor currency, committed amount, status of the PO, and the expense type.

Sample Code :

JavaScript (Using Fetch API) :

				
					const apiUrl = 'http://<server-ip-address>/custom_api/capex_track_purchase_order/create';
const token = '<Token>';

const formData = new FormData();
formData.append('business_unit_name', 'Almiranta1 / Aurora');
formData.append('request_number', 'AU-2020-4133');
formData.append('PO_number', '1');
formData.append('description', 'sdfsdf');
formData.append('vendor_name', 'sdfsddf');
formData.append('vendor_number', 'sdfsdf');
formData.append('PO_amount', '5.85555');
formData.append('vendor_currency', 'USD');
formData.append('capex_to_vendor_currency_rate', '1');
formData.append('committed', '858');
formData.append('status', 'Open');
formData.append('expense_type', 'Capital Expenditures');

fetch(apiUrl + '?format=json', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${token}`
  },
  body: formData
})
.then(response => response.json())
.then(data => {
  // Process the response data here
})
.catch(error => {
  // Handle error
});

				
			
PHP (Using cURL) :
				
					<?php
$apiUrl = 'http://<server-ip-address>/custom_api/capex_track_purchase_order/create';
$token = '<Token>';

$data = array(
  'business_unit_name' => 'Almiranta1 / Aurora',
  'request_number' => 'AU-2020-4133',
  'PO_number' => '1',
  'description' => 'sdfsdf',
  'vendor_name' => 'sdfsddf',
  'vendor_number' => 'sdfsdf',
  'PO_amount' => '5.85555',
  'vendor_currency' => 'USD',
  'capex_to_vendor_currency_rate' => '1',
  'committed' => '858',
  'status' => 'Open',
  'expense_type' => 'Capital Expenditures'
);

$ch = curl_init($apiUrl . '?format=json');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $token));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

$response = curl_exec($ch);

if (!$response) {
  // Handle cURL error
}

$data = json_decode($response, true);

if (isset($data['code']) && $data['code'] === 200) {
  // Process the response data here
} else {
  // Handle API error
}

curl_close($ch);
?>

				
			
Note :

1.11 Create PO Line Items

1.11.1 Create PO Line Items

Description :

This API allows you to create PO (Purchase Order) line items. It can be used from various sources such as a web browser, native applications in Android, or iOS devices.

URL :

Endpoint:

				
					http://<server-ip-address>/custom_api/capex_track_purchase_order_line_item/create;
				
			
Method : Post
URL Parameters: Required:
format=json (In the future, this parameter might change to become the default format)
Yes

Form Data Parameters:

KeyDetailValue
business_unit_nameSpecify the business unit name.Almiranta1 / Aurora
request_numberThe request number associated with the purchase order AU-2020-4133
PO_numberThe purchase order number 1
general_cost_type_idID of the general cost type.7
line_item_descriptionDescription of the line item.
assetThe asset related to the line item.
work_orderWork order details.
CERCER (Cost Estimation Request) information.
quantityQuantity of items being ordered.10
quantity_receivedQuantity received for the ordered items. 895
unit_cost Unit cost of the items 9857
PO_line_statusStatus of the PO line.Open
depositDeposit details.

Header Parameters :

Authorization :

				
					Bearer <Token> (Include a valid access token to authorize the API request)

				
			
Success Response:

Code: 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": []
}

				
			

Error Responses:

Code: 401 BAD REQUEST

Content :

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

Code: 400

Content :

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[field_name]": [
      "This field is missing."
    ]
  }
}

				
			

Code: 400

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[PO_number]": "Multiple PO found!"
  }
}

				
			
Notes :

PHP Code :

				
					<?php
// API Endpoint URL
$url = 'http://<server-ip-address>/custom_api/capex_track_purchase_order_line_item/create';

// Form Data Parameters
$data = array(
    'business_unit_name' => 'Almiranta1', // Change this value accordingly
    'request_number' => 'AU-2020-4133', // Change this value accordingly
    'PO_number' => '1', // Change this value accordingly
    'general_cost_type_id' => '7', // Change this value accordingly
    'line_item_description' => 'Line Item Description', // Change this value accordingly
    'asset' => 'Asset', // Change this value accordingly
    'work_order' => 'Work Order', // Change this value accordingly
    'CER' => 'CER', // Change this value accordingly
    'quantity' => '10', // Change this value accordingly
    'quantity_received' => '895', // Change this value accordingly
    'unit_cost' => '9857', // Change this value accordingly
    'PO_line_status' => 'Open', // Change this value accordingly
    'deposit' => 'Deposit', // Change this value accordingly
);

// HTTP Header with Authorization Bearer Token
$headers = array(
    'Authorization: Bearer <Token>', // Replace <Token> with your actual access token
);

// Initialize cURL session
$ch = curl_init();

// Set cURL options
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and capture the response
$response = curl_exec($ch);

// Close cURL session
curl_close($ch);

// Process the response
if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    // Decode the JSON response
    $responseData = json_decode($response, true);

    // Check the response code for success/failure
    if ($responseData['code'] === 200) {
        // Success
        echo 'Successfully created PO Line Item!';
    } else {
        // Failure
        echo 'Error: ' . $responseData['message'];
    }
}
?>

				
			
JavaScript Code (using fetch):
				
					// API Endpoint URL
const url = 'http://<server-ip-address>/custom_api/capex_track_purchase_order_line_item/create';

// Form Data Parameters
const data = new URLSearchParams();
data.append('business_unit_name', 'Almiranta1'); // Change this value accordingly
data.append('request_number', 'AU-2020-4133'); // Change this value accordingly
data.append('PO_number', '1'); // Change this value accordingly
data.append('general_cost_type_id', '7'); // Change this value accordingly
data.append('line_item_description', 'Line Item Description'); // Change this value accordingly
data.append('asset', 'Asset'); // Change this value accordingly
data.append('work_order', 'Work Order'); // Change this value accordingly
data.append('CER', 'CER'); // Change this value accordingly
data.append('quantity', '10'); // Change this value accordingly
data.append('quantity_received', '895'); // Change this value accordingly
data.append('unit_cost', '9857'); // Change this value accordingly
data.append('PO_line_status', 'Open'); // Change this value accordingly
data.append('deposit', 'Deposit'); // Change this value accordingly

// Fetch POST request
fetch(url, {
    method: 'POST',
    body: data,
    headers: {
        'Authorization': 'Bearer <Token>', // Replace <Token> with your actual access token
    },
})
.then(response => response.json())
.then(responseData => {
    // Check the response code for success/failure
    if (responseData.code === 200) {
        // Success
        console.log('Successfully created PO Line Item!');
    } else {
        // Failure
        console.error('Error: ' + responseData.message);
    }
})
.catch(error => console.error('Error: ', error));
				
			
Note :

Here’s an example of how you can use cURL to make a POST request to the API endpoint:

Explanation :

curl -X POST :

				
					'http://<server-ip-address>/custom_api/capex_track_purchase_order_line_item/create' \
     -H 'Authorization: Bearer <Token>' \
     -H 'Content-Type: application/x-www-form-urlencoded' \
     -d 'business_unit_name=Almiranta1' \
     -d 'request_number=AU-2020-4133' \
     -d 'PO_number=1' \
     -d 'general_cost_type_id=7' \
     -d 'line_item_description=Line Item Description' \
     -d 'asset=Asset' \
     -d 'work_order=Work Order' \
     -d 'CER=CER' \
     -d 'quantity=10' \
     -d 'quantity_received=895' \
     -d 'unit_cost=9857' \
     -d 'PO_line_status=Open' \
     -d 'deposit=Deposit'

				
			
  • curl: The command-line tool to perform HTTP requests.
  • -X POST: Specifies that we are making a POST request.
  • -H ‘Authorization: Bearer <Token>’: Sets the Authorization header with the Bearer Token. Replace <Token> with your actual access token.
  • -H ‘Content-Type: application/x-www-form-urlencoded’: Specifies the content type of the data being sent as URL-encoded form data.
  • -d ‘parameter=value’: Adds the form data parameters as key-value pairs in the request body.
  • Replace <server-ip-address> and <Token> in the URL and Authorization header, respectively, with the actual server IP address and valid access token.

1.12 Create Invoice Line Items

1.12.1 Create Invoice Line Items

Description :

This API allows you to create invoice line items. It can be used from various sources such as a web browser, native applications in Android, or iOS devices.

URL :

Endpoint :

				
					http://<server-ip-address>/custom_api/capex_track_invoice_line_item/create

				
			
Method : POST
URL Parameters Required
json (In the future, this parameter might change to become the default format)
Yes

Form Data Parameters:

KeyDetailValue
business_unit_name:Specify the business unit name Almiranta1 / Aurora
request_numberThe request number associated with the invoice.AU-2020-4133
PO_numberThe associated purchase order number1
invoice_numberThe invoice number .1
amount_in_vendor_currencyThe amount in the vendor's currency.58
vendor_currencyThe currency of the vendor USD
assetThe asset related to the invoice line item.
work_orderWork order details.
invoice_dateThe date of the invoice . 2020-02-02
general_cost_type_idID of the general cost type 7
CERCER (Cost Estimation Request) information.
quantityQuantity of items being invoiced10
quantity_receivedQuantity received for the invoiced items 895
unit_cost:Unit cost of the items 9857
rateThe rate associated with the invoice. 2
expense_typeType of expense, such as "Capital Expenditures".

Header Parameters :

Authorization :

				
					Bearer <Token> (Include a valid access token to authorize the API request)
				
			
Success Response:

Code : 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": []
}

				
			

Error Response :

Code: 401 BAD REQUEST

Content :

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

Code: 400

Content :

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[field_name]": [
      "This field is missing."
    ]
  }
}

				
			

Code: 400

Content :

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[PO_number]": "Multiple PO found!"
  }
}

				
			
Note :

Curl Command :

Here’s an example of how you can use cURL to make a POST request to the API endpoint:

curl -X POST :

				
					'http://<server-ip-address>/custom_api/capex_track_invoice_line_item/create' \

     -H 'Authorization: Bearer <Token>' \

     -H 'Content-Type: application/x-www-form-urlencoded' \

     -d 'business_unit_name=Almiranta1' \

     -d 'request_number=AU-2020-4133' \

     -d 'PO_number=1' \

     -d 'invoice_number=I1' \

     -d 'amount_in_vendor_currency=58' \

     -d 'vendor_currency=USD' \

     -d 'asset=Asset' \

     -d 'work_order=Work Order' \

     -d 'invoice_date=2020-02-02' \

     -d 'general_cost_type_id=7' \

     -d 'CER=CER' \

     -d 'quantity=10' \

     -d 'quantity_received=895' \

     -d 'unit_cost=9857' \

     -d 'rate=2' \

     -d 'expense_type=Capital Expenditures'
				
			
Note :

1.13 Create Reception Line Items

1.13.1 Create Reception Line Items

Description :

This API allows you to create reception line items. It can be used from various sources such as a web browser, native applications in Android, or iOS devices.

URL :

Endpoint :

				
					http://<server-ip-address>/custom_api/capex_track_reception_line_item/create
				
			
Method : POST
URL Parameters Required
format=json (In the future, this parameter might change to become the default format)
Yes

Form Data Parameters :

KeyDetrailsValue
business_unit_nameSpecify the business unit name Almiranta1 / Aurora
request_numberThe request number associated with the reception. AU-2020-4133
PO_number:The associated purchase order number 1
reception_numberThe reception number R1
vendor_currencyThe currency of the vendor. USD
assetThe asset related to the reception line item.
work_orderWork order details
general_cost_type_idID of the general cost type7
CER:CER (Cost Estimation Request) information.
quantity10Quantity of items being received
quantity_receivedQuantity received for the items 895
unit_costUnit cost of the items 9857
reception_dateThe date of the reception 2020-02-02
receiverThe receiver's name or identifier Receiver 1
acceptedQuantity of items accepted from the reception 10
rejectedQuantity of items rejected from the reception 2
unit_cost_vendor_currencyUnit cost of the items in the vendor's currency58
rateThe rate associated with the reception2
expense_type Type of expense, such as "Capital Expenditures".

Header Parameters :

Authorization :

				
					Bearer <Token> (Include a valid access token to authorize the API request)
				
			
Success Response :

Code: 200

Content :

				
					{
  "code": 200,
  "message": "success",
  "data": []
}

				
			

Error Responses :

Code: 401 BAD REQUEST

Content :

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			

Code: 400

Content :

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[field_name]": [
      "This field is missing."
    ]
  }
}


				
			

Code: 400

Content :

				
					{
  "code": 400,
  "message": "fail",
  "data": {
    "[PO_number]": "Multiple PO found!"
  }
}

				
			
Curl Command :

Here’s an example of how you can use cURL to make a POST request to the API endpoint:

curl -X POST :

				
					'http://<server-ip-address>/custom_api/capex_track_reception_line_item/create' \

     -H 'Authorization: Bearer <Token>' \

     -H 'Content-Type: application/x-www-form-urlencoded' \

     -d 'business_unit_name=Almiranta1' \

     -d 'request_number=AU-2020-4133' \

     -d 'PO_number=1' \

     -d 'reception_number=R1' \

     -d 'vendor_currency=USD' \

     -d 'asset=Asset' \

     -d 'work_order=Work Order' \

     -d 'general_cost_type_id=7' \

     -d 'CER=CER' \

     -d 'quantity=10' \

     -d 'quantity_received=895' \

     -d 'unit_cost=9857' \

     -d 'reception_date=2020-02-02' \

     -d 'receiver=Receiver 1' \

     -d 'accepted=10' \

     -d 'rejected=2' \

     -d 'unit_cost_vendor_currency=58' \

     -d 'rate=2' \

     -d 'expense_type=Capital Expenditures'
				
			
Note :

1.14 DISBURSEMENT TIMELINE

  •  1.1 Description
  • 1.2 URL
  • 1.3 Method
  • 1.4 URL Parameters
  • 1.5 URL Data Parameters
  • 1.6 Header Parameters
  • 1.7 Success Response
  • 1.8 Error Response
  • 1.9 Notes

Description :

This API is designed to fetch the Capex Request DISBURSEMENT TIMELINE and can be accessed through web browsers, native applications on Android, and iOS.

URL :

				
					http://<server-ip-address>/custom_api/export_capex_details/capex_disbursement_spend_timeline
				
			
Method : GET
URL ParametersRequiredValue
Content Type FormatYesjson or form-data
data_from_timestampYesCapex_id
URL Data ParametersNo
data_from_timestampYes1
capex_idYes1
current_pageYes1
ExampleYes?capex_id=1&data_from_timestamp=1¤t_page=1

Header Parameters:

Authorization :

Bearer <Token>

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "number_of_results": "4897",
        "number_of_pages": 245,
        "results_per_page": 20,
        "current_page": "1",
        "entity_name": "capex_request_disbursement_spend_timeline",
        "resultset": [
            {
                "timeline_type": {
                    "label": "Monthly",
                    "value": "Monthly"
                },
                "year": {
                    "label": "Year",
                    "value": "2021"
                },
                "amount": {
                    "label": "Amount",
                    "value": "54516.00"
                },
                "month_or_qtr": {
                    "label": "Month or Quarter",
                    "value": "08"
                },
                "capex_id": {
                    "label": "Capex Id",
                    "value": "11252"
                },
                "id": {
                    "label": "Id",
                    "value": "4202"
                },
                "currency": {
                    "label": "Currency",
                    "value": "$"
                }
            }
}

				
			
Error Response :
  • Code: 401 BAD REQUEST
  • Content:
				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid API Token"
  }
}

				
			
Note :

Code Examples :

JavaScript Code (Fetch API) :
				
					fetch("http://<server-ip-address>/custom_api/export_capex_details/capex_disbursement_spend_timeline?capex_id=1&data_from_timestamp=1&current_page=1", {
  method: "GET",
  headers: {
    "Authorization": "Bearer <Token>"
  }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log("Error:", error));

				
			
PHP Code :
				
					$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "http://<server-ip-address>/custom_api/export_capex_details/capex_disbursement_spend_timeline?capex_id=1&data_from_timestamp=1&current_page=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer <Token>"
  ),
));

$response = curl_exec($curl);
$error = curl_error($curl);

curl_close($curl);

if ($error) {
  echo "cURL Error: $error";
} else {
  echo $response;
}

				
			
curl Cammand :
				
					curl -H "Authorization: Bearer <Token>" -X GET "http://<server-ip-address>/custom_api/export_capex_details/capex_disbursement_spend_timeline?capex_id=1&data_from_timestamp=1&current_page=1"

				
			
Final Answer :

This documentation provides a detailed overview and examples for the DISBURSEMENT TIMELINE API, describing its URL, methods, parameters, and responses. Code examples are provided in JavaScript, PHP, and cURL for easy implementation.

2. User Management Functions

Documentation for Web developers

Description

Use this API to login a user from anywhere, including web browsers, native applications on Android and iOS.

Base URL:

The following API Resources use http://<server-ip-address> as the base URL:

2.1 Login User

Login User

Use this API to login a user from anywhere, including web browsers, native applications on Android and iOS.

API URL:

				
					http://<server-ip-address>/custom_api/login
				
			

Method: POST

Form Data Parameters:
				
					{
  "username": "Your_Username",
  "password": "Your_Password",
  "parent_id": 50511
}

				
			
URL Parameters Required
format = json (In future, Maybe change to default)
Yes
parent_id
No
Success Response
				
					{
  "code": 200,
  "message": "success",
  "data": {
    "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
  }
}

				
			
Error Response
				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid email or password"
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[email]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This field is missing."
    ],
    "[email]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This value should not be blank."
    ]
  }
}


				
			

Code example

Here’s an example code snippet in Python using the requests library to make the API call to the “Login User” endpoint:

Python Example:

Here’s a corresponding example using cURL command in the command line:

cURL Example:

				
					import requests

url = 'http://<server-ip-address>/custom_api/login'
data = {
    'username': 'Your_Username',
    'password': 'Your_Password',
    'parent_id': 50511
}

response = requests.post(url, json=data)
if response.status_code == 200:
    json_response = response.json()
    token = json_response['data']['token']
    print('Login successful. Token:', token)
else:
    print('Login failed:', response.json()['data']['error'])

				
			
				
					curl -X POST -H "Content-Type: application/json" -d '{
    "username": "Your_Username",
    "password": "Your_Password",
    "parent_id": 50511
}' http://<server-ip-address>/custom_api/login

				
			

3. Login User

Login User

Use this API to login a user from anywhere, including web browsers, native applications on Android and iOS.

API URL:

				
					http://<server-ip-address>/custom_api/login
				
			

Method: POST

Form Data Parameters:
				
					{
  "username": "Your_Username",
  "password": "Your_Password",
  "parent_id": 50511
}

				
			
URL Parameters Required
format = json (In future, Maybe change to default)
Yes
parent_id
No
Success Response
				
					{
  "code": 200,
  "message": "success",
  "data": {
    "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
  }
}

				
			
Error Response
				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "error": "Invalid email or password"
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[email]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This field is missing."
    ],
    "[email]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This field is missing."
    ]
  }
}

				
			

OR

				
					{
  "code": 401,
  "message": "fail",
  "data": {
    "[password]": [
      "This value should not be blank."
    ]
  }
}


				
			

Code example

Here’s an example code snippet in Python using the requests library to make the API call to the “Login User” endpoint:

Python Example:

Here’s a corresponding example using cURL command in the command line:

cURL Example:

				
					import requests

url = 'http://<server-ip-address>/custom_api/login'
data = {
    'username': 'Your_Username',
    'password': 'Your_Password',
    'parent_id': 50511
}

response = requests.post(url, json=data)
if response.status_code == 200:
    json_response = response.json()
    token = json_response['data']['token']
    print('Login successful. Token:', token)
else:
    print('Login failed:', response.json()['data']['error'])

				
			
				
					curl -X POST -H "Content-Type: application/json" -d '{
    "username": "Your_Username",
    "password": "Your_Password",
    "parent_id": 50511
}' http://<server-ip-address>/custom_api/login

				
			

4. API Login User

4.1 API Login User

Description :

Use this API to log in a user from various platforms like web browsers, native applications in Android, or iOS.

URL :

Endpoint :

				
					http://<server-ip-address>/custom_api/external_login

				
			
Method : POST
URL Parameters Required
Content type format: JSON or form-data
Yes

Form Data Parameters:

KeyValue
client_idAlphanumeric value identifying the client.
client_secretAlphanumeric value identifying the client's secret.
environmentSpecifies the environment. Valid values are localhost, development:sandbox, or production.

Example Request :

				
					{
  "client_id": "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
  "client_secret": "gGQlhpSl5Rpanz0m",
  "environment": "localhost"
}

				
			
PHP code :
				
					<?php
$url = "http://<server-ip-address>/custom_api/external_login";
$data = array(
  "client_id" => "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
  "client_secret" => "gGQlhpSl5Rpanz0m",
  "environment" => "localhost"
);

$options = array(
  "http" => array(
    "header" => "Content-type: application/json",
    "method" => "POST",
    "content" => json_encode($data)
  )
);

$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
?>

				
			
Javascript code :
				
					var xhr = new XMLHttpRequest();
var url = "http://<server-ip-address>/custom_api/external_login";
var data = JSON.stringify({
  "client_id": "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
  "client_secret": "gGQlhpSl5Rpanz0m",
  "environment": "localhost"
});

xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data)

				
			
cURL code :
				
					curl -X POST "http://<server-ip-address>/custom_api/external_login" \
     -H "Content-Type: application/json" \
     -d '{
           "client_id": "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
           "client_secret": "gGQlhpSl5Rpanz0m",
           "environment": "localhost"
         }'

				
			
Success Response:

Code : 200

Content :

The token to be used for authenticated requests.

Error Response :

Code: 401 BAD REQUEST

Content :

Various error messages depending on whether the client_id, client_secret, or both are missing or blank.

Note :

Error Responses:

Invalid client_id or client_secret:

Code:

401 BAD REQUEST

Content :

				
						{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid client_id or client_secret"
    }
}

				
			

1- Missing client_id :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_id]": [
            "This field is missing."
        ]
    }
}

				
			

2- Missing client_secret and client_id:

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This field is missing."
        ],
        "[client_id]": [
            "This field is missing."
        ]
    }
}

				
			

3- Missing client_secret:

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This field is missing."
        ]
    }
}

				
			

4- Blank client_secret :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This value should not be blank."
        ]
    }
}

				
			

5- Blank client_secret and client_id :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This value should not be blank."
        ],
        "[client_id]": [
            "This value should not be blank."
        ]
    }
}

				
			

These error responses cover various cases of missing or blank client ID and client secret, thereby providing clear feedback on what might have gone wrong with the request. The error messages are designed to assist the developer in quickly identifying and correcting any mistakes in the request.

5. Request Type Management

5.1 Capex Request Type

Description:

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 Parametersr 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:

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));

				
			
Note:

6. Capex Request Type

Description:

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 Parametersr 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:

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));

				
			
Note:

7. API Login User

Description :

Use this API to log in a user from various platforms like web browsers, native applications in Android, or iOS.

URL :

Endpoint :

				
					http://<server-ip-address>/custom_api/external_login

				
			
Method : POST
URL Parameters Required
Content type format: JSON or form-data
Yes

Form Data Parameters:

KeyValue
client_idAlphanumeric value identifying the client.
client_secretAlphanumeric value identifying the client's secret.
environmentSpecifies the environment. Valid values are localhost, development:sandbox, or production.

Example Request :

				
					{
  "client_id": "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
  "client_secret": "gGQlhpSl5Rpanz0m",
  "environment": "localhost"
}

				
			
PHP code :
				
					<?php
$url = "http://<server-ip-address>/custom_api/external_login";
$data = array(
  "client_id" => "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
  "client_secret" => "gGQlhpSl5Rpanz0m",
  "environment" => "localhost"
);

$options = array(
  "http" => array(
    "header" => "Content-type: application/json",
    "method" => "POST",
    "content" => json_encode($data)
  )
);

$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
?>

				
			
Javascript code :
				
					var xhr = new XMLHttpRequest();
var url = "http://<server-ip-address>/custom_api/external_login";
var data = JSON.stringify({
  "client_id": "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
  "client_secret": "gGQlhpSl5Rpanz0m",
  "environment": "localhost"
});

xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data)

				
			
cURL code :
				
					curl -X POST "http://<server-ip-address>/custom_api/external_login" \
     -H "Content-Type: application/json" \
     -d '{
           "client_id": "cOaWg1cFuBK7ytOOdnSjxf536R1ANIA3",
           "client_secret": "gGQlhpSl5Rpanz0m",
           "environment": "localhost"
         }'

				
			
Success Response:

Code : 200

Content :

The token to be used for authenticated requests.

Error Response :

Code: 401 BAD REQUEST

Content :

Various error messages depending on whether the client_id, client_secret, or both are missing or blank.

Note :

Error Responses:

Invalid client_id or client_secret:

Code:

401 BAD REQUEST

Content :

				
						{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid client_id or client_secret"
    }
}

				
			

1- Missing client_id :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_id]": [
            "This field is missing."
        ]
    }
}

				
			

2- Missing client_secret and client_id:

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This field is missing."
        ],
        "[client_id]": [
            "This field is missing."
        ]
    }
}

				
			

3- Missing client_secret:

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This field is missing."
        ]
    }
}

				
			

4- Blank client_secret :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This value should not be blank."
        ]
    }
}

				
			

5- Blank client_secret and client_id :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[client_secret]": [
            "This value should not be blank."
        ],
        "[client_id]": [
            "This value should not be blank."
        ]
    }
}

				
			

These error responses cover various cases of missing or blank client ID and client secret, thereby providing clear feedback on what might have gone wrong with the request. The error messages are designed to assist the developer in quickly identifying and correcting any mistakes in the request.

8. 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://<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.

9. User Management: Login User

9.1 User Management: Login User

Description :

Use this API to Login user from anywhere (Web Browser, Native application in Android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/login

				
			
Method : POST
URL Parameters Required
json or form-data
Yes
Optional
Parent_id

Form Data Parameters:

KeyValue
Email[string]
password[alphanumeric]
parent_id[integer]

Example :

				
					{
	"email": "abc111@gmail.com",
	"password": "comples@&*@#",
	"parent_id": 50511
}

				
			

Success Response :

code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
    }
}

				
			
PHP Code :
				
					<?php

$url = "http://<server-ip-address>/custom_api/login";
$headers = array(
    'Content-type: application/json'
);
$data = array(
    "email" => "abc111@gmail.com",
    "password" => "comples@&*@#",
    "parent_id" => 50511
);

$options = array(
    'http' => array(
        'header' => $headers,
        'method' => 'POST',
        'content' => json_encode($data)
    )
);

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response === FALSE) {
    // Handle error
}

var_dump($response);

?>

				
			
Javascript Code :
				
					const url = "http://<server-ip-address>/custom_api/login";
const data = {
  email: "abc111@gmail.com",
  password: "comples@&*@#",
  parent_id: 50511
};

fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));

				
			

cURL Code :

				
					curl -X POST "http://<server-ip-address>/custom_api/login" \
     -H "Content-Type: application/json" \
     -d '{
          "email":"abc111@gmail.com",
          "password":"comples@&*@#",
          "parent_id":50511
         }'

				
			

Make sure to replace <server-ip-address> with the actual server IP address or hostname where the API is hosted.

Please note that the password provided in the examples might need to be properly encoded or handled depending on the exact requirements of the API. Always ensure that you are following the proper security practices for handling user authentication.

Error Response :

Invalid API Token

Code :

  • Various 401 BAD REQUEST responses detailed in the request

Note :

Refer to the code examples in the previous response for how to make a request to this endpoint using PHP, JavaScript, and cURL. Make sure to replace <server-ip-address> with the actual server IP address or hostname where the API is hosted.

10. User Management: Login User

Description :

Use this API to Login user from anywhere (Web Browser, Native application in Android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/login

				
			
Method : POST
URL Parameters Required
json or form-data
Yes
Optional
Parent_id

Form Data Parameters:

KeyValue
Email[string]
password[alphanumeric]
parent_id[integer]

Example :

				
					{
	"email": "abc111@gmail.com",
	"password": "comples@&*@#",
	"parent_id": 50511
}

				
			

Success Response :

code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
    }
}

				
			
PHP Code :
				
					<?php

$url = "http://<server-ip-address>/custom_api/login";
$headers = array(
    'Content-type: application/json'
);
$data = array(
    "email" => "abc111@gmail.com",
    "password" => "comples@&*@#",
    "parent_id" => 50511
);

$options = array(
    'http' => array(
        'header' => $headers,
        'method' => 'POST',
        'content' => json_encode($data)
    )
);

$context = stream_context_create($options);
$response = file_get_contents($url, false, $context);

if ($response === FALSE) {
    // Handle error
}

var_dump($response);

?>

				
			
Javascript Code :
				
					const url = "http://<server-ip-address>/custom_api/login";
const data = {
  email: "abc111@gmail.com",
  password: "comples@&*@#",
  parent_id: 50511
};

fetch(url, {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));

				
			

cURL Code :

				
					curl -X POST "http://<server-ip-address>/custom_api/login" \
     -H "Content-Type: application/json" \
     -d '{
          "email":"abc111@gmail.com",
          "password":"comples@&*@#",
          "parent_id":50511
         }'

				
			

Make sure to replace <server-ip-address> with the actual server IP address or hostname where the API is hosted.

Please note that the password provided in the examples might need to be properly encoded or handled depending on the exact requirements of the API. Always ensure that you are following the proper security practices for handling user authentication.

Error Response :

Invalid API Token

Code :

  • Various 401 BAD REQUEST responses detailed in the request

Note :

Refer to the code examples in the previous response for how to make a request to this endpoint using PHP, JavaScript, and cURL. Make sure to replace <server-ip-address> with the actual server IP address or hostname where the API is hosted.

12. User Management - Login User

12.1 User Management - Login User

Description :

Use this API to login a user from anywhere (Web Browser, Native application in Android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/login

				
			
Method : POST
URL Parameters Required
JSON or form-data
Yes
optional
parent_id

Form Data Parameters:

KeyValue
Email[string]
password[alphanumeric]
parent_id[integer]

Example :

				
					{
	"email": "satim@almiranta.com",
	"password": "comples@&*@#",
	"parent_id": 50511
}

				
			

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
    }
}

				
			
Error Response :

There are several potential error responses:

1- Invalid e-mail or password :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid e-mail or password"
    }
}

				
			
2- E-mail field is missing :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[email]": [
            "This field is missing."
        ]
    }
}

				
			

3- Password and e-mail fields are missing :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This field is missing."
        ],
        "[email]": [
            "This field is missing."
        ]
    }
}

				
			

4- Password field is missing:

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This field is missing."
        ]
    }
}
				
			

5- Password field should not be blank :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This value should not be blank."
        ]
    }
}

				
			
6- Password and email fields should not be blank :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This value should not be blank."
        ],
        "[email]": [
            "This value should not be blank."
        ]
    }
}

				
			

These are the detailed error responses that could be returned by the API based on the provided request parameters. It covers every scenario where the request might be incorrect or incomplete.

PHP Code :
				
					<?php

$url = "http://<server-ip-address>/custom_api/login";
$data = array(
    "email" => "satim@almiranta.com",
    "password" => "comples@&*@#",
    "parent_id" => 50511
);

$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, array('Content-Type: application/json'));

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);

?>

				
			
Javascript Code :
				
					const url = "http://<server-ip-address>/custom_api/login";
const headers = {
    "Content-Type": "application/json"
};

const data = {
    "email": "satim@almiranta.com",
    "password": "comples@&*@#",
    "parent_id": 50511
};

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));

				
			

Replace <server-ip-address> with your actual server IP address. The provided examples demonstrate how to make a POST request to this endpoint using PHP and JavaScript, including all required parameters and handling potential error responses.

13. User Management - Login User

Description :

Use this API to login a user from anywhere (Web Browser, Native application in Android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/login

				
			
Method : POST
URL Parameters Required
JSON or form-data
Yes
optional
parent_id

Form Data Parameters:

KeyValue
Email[string]
password[alphanumeric]
parent_id[integer]

Example :

				
					{
	"email": "satim@almiranta.com",
	"password": "comples@&*@#",
	"parent_id": 50511
}

				
			

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "token": "b9e223b8c1d2917a28f6cf774c3ef720356cef7a6f37189db66ef41e3d468587e11b157e872c99d82935e5292f2f31944e48017a930e9a128c494e63"
    }
}

				
			
Error Response :

There are several potential error responses:

1- Invalid e-mail or password :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid e-mail or password"
    }
}

				
			
2- E-mail field is missing :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[email]": [
            "This field is missing."
        ]
    }
}

				
			

3- Password and e-mail fields are missing :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This field is missing."
        ],
        "[email]": [
            "This field is missing."
        ]
    }
}

				
			

4- Password field is missing:

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This field is missing."
        ]
    }
}
				
			

5- Password field should not be blank :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This value should not be blank."
        ]
    }
}

				
			
6- Password and email fields should not be blank :

Code : 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "[password]": [
            "This value should not be blank."
        ],
        "[email]": [
            "This value should not be blank."
        ]
    }
}

				
			

These are the detailed error responses that could be returned by the API based on the provided request parameters. It covers every scenario where the request might be incorrect or incomplete.

PHP Code :
				
					<?php

$url = "http://<server-ip-address>/custom_api/login";
$data = array(
    "email" => "satim@almiranta.com",
    "password" => "comples@&*@#",
    "parent_id" => 50511
);

$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, array('Content-Type: application/json'));

$response = curl_exec($ch);

if ($response === false) {
    echo 'Error: ' . curl_error($ch);
} else {
    echo $response;
}

curl_close($ch);

?>

				
			
Javascript Code :
				
					const url = "http://<server-ip-address>/custom_api/login";
const headers = {
    "Content-Type": "application/json"
};

const data = {
    "email": "satim@almiranta.com",
    "password": "comples@&*@#",
    "parent_id": 50511
};

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));

				
			

Replace <server-ip-address> with your actual server IP address. The provided examples demonstrate how to make a POST request to this endpoint using PHP and JavaScript, including all required parameters and handling potential error responses.

14. Export Data - Export Users

Description :

Use this API to export users. This API can provide data from a specific timestamp, or if requested earlier, the next request will retrieve new or modified data since the last request. This can be used in various platforms like Web Browser, Native application in Android, iOS, etc.

URL :

				
					 http://<server-ip-address>/custom_api/export_capex_details/users
				
			
Method : GET
Data ParametersRequiredValue
json or form-dataYes
data_from_timestampNo
URL Data ParametersNo
data_from_timestampYesTimestamp from which data is required (e.g., 1663999021)
current_pageYesCurrent page number (e.g., 1)
ExampleYesdata_from_timestamp=1663999021¤t_page=1

Header Parameters:

Authorization :

Bearer <Token>

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "number_of_results": "508",
        "number_of_pages": 6,
        "results_per_page": 100,
        "current_page": "1",
        "entity_name": "users",
        "resultset":[
            {
                "email": "test@test.com",
                "name": "Adrian",
                "job_title": "Regional VP",
                "address": "77 5th Avenue",
                "city": "New York",
                "state": "New York",
                "zip": "10001",
                "phone": "888-1236-4281",
                "business_units": [
                    "16844",
                    "16932"
                ]
            },
            {
                "email": "test1@test.com",
                "name": "Fred Smith",
                "job_title": "Executive Vice President",
                "address": "442 Saint-Gabriel",
                "city": "Montreal",
                "state": "Quebec",
                "zip": "H2Y 2Z9",
                "phone": "866-123-4281",
                "business_units": [
                    "0"
                ]
            }
        ]
    }
}

				
			
Error Response :
  • Code: 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid API Token"
    }
}

				
			
PHP Code :
				
					<?php
$url = "http://<server-ip-address>/custom_api/export_capex_details/users?data_from_timestamp=1663999021&current_page=1";

$headers = [
    'Authorization: Bearer <Token>',
];

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}

curl_close($ch);
echo $response;
?>

				
			
JavaScript Code (using Fetch) :
				
					var url = "http://<server-ip-address>/custom_api/export_capex_details/users?data_from_timestamp=1663999021&current_page=1";

fetch(url, {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer <Token>',
    }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('An error occurred:', error));

				
			
curl Cammand :
				
					curl -X GET "http://<server-ip-address>/custom_api/export_capex_details/users?data_from_timestamp=1663999021&current_page=1" \
     -H "Authorization: Bearer <Token>"

				
			

These examples demonstrate how to make a GET request to the “Export Users” endpoint, using the authorization token and including the optional URL data parameters data_from_timestamp and current_page. Make sure to replace <server-ip-address> and <Token> with your actual server IP address and authorization token, respectively.

Note :

15. Business Unit

Description :

Use this API to get Business Unit from anywhere (Web Browser, Native application in Android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/export_capex_details/business_units

				
			
Method : GET
Data ParametersRequiredValue
json or form-dataYes
data_from_timestampNo
URL Data ParametersNo
data_from_timestampYes1663999021
current_pageYes1
ExampleYes?data_from_timestamp=1663999021¤t_page=1

Header Parameters:

Authorization :

Bearer <Token>

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "number_of_results": "489",
        "number_of_pages": 25,
        "results_per_page": 20,
        "current_page": "1",
        "entity_name": "business_units",
        "resultset": [
            {
                "id": "20317",
                "name": "MyCompany / MYCOMPANY2",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
	{
                "id": "20324",
                "name": "MyCompany / MYCOMPANY3",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "20325",
                "name": "MyCompany / Central",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "20326",
                "name": "MyCompany / Latin America",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "20327",
                "name": "MyCompany / Ventures",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "20648",
                "name": "MyCompany / APAC",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "20752",
                "name": "MyCompany / Asia",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "21645",
                "name": "MyCompany / MyCompany Next",
                "parent": "0",
                "business_unit_code": null,
                "type": "Division"
            },
            {
                "id": "16758",
                "name": "MyCompany / MYCOMPANY2 / United States",
                "parent": "20317",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "16759",
                "name": "MyCompany / MYCOMPANY2 / Canada",
                "parent": "20317",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20330",
                "name": "MyCompany / MYCOMPANY3 / Benelux",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20336",
                "name": "MyCompany / MYCOMPANY3 / France",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20344",
                "name": "MyCompany / MYCOMPANY3 / Eastern Europe",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20361",
                "name": "MyCompany / MYCOMPANY3 / Germany & Switzerland",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20371",
                "name": "MyCompany / MYCOMPANY3 / India",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20374",
                "name": "MyCompany / MYCOMPANY3 / Italy",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20380",
                "name": "MyCompany / MYCOMPANY3 / Iberia",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20384",
                "name": "MyCompany / MYCOMPANY3 / United Kingdom",
                "parent": "20324",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20389",
                "name": "MyCompany / Central / Holding",
                "parent": "20325",
                "business_unit_code": null,
                "type": "Sub Division"
            },
            {
                "id": "20417",
                "name": "MyCompany / Central / Germany & Switzerland",
                "parent": "20325",
                "business_unit_code": null,
                "type": "Sub Division"
            }


        ]
    }
}

				
			
Error Response :
  • Code: 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid API Token"
    }
}

				
			

Note :

PHP Code :
				
					<?php
$url = "http://<server-ip-address>/custom_api/export_capex_details/business_units?data_from_timestamp=1663999021&current_page=1";
$headers = ['Authorization: Bearer <Token>'];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    $data = json_decode($response);
    if ($data->code === 200) {
        echo 'Success: ' . $data->message;
        // Handle the success response data
    } else {
        // Handle the error response
    }
}
curl_close($ch);
?>

				
			
JavaScript Code (using Fetch) :
				
					var url = "http://<server-ip-address>/custom_api/export_capex_details/business_units?data_from_timestamp=1663999021&current_page=1";
fetch(url, {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer <Token>',
    }
})
.then(response => response.json())
.then(data => {
    if (data.code === 200) {
        console.log('Success:', data.message);
        // Handle the success response data
    } else {
        // Handle the error response
    }
})
.catch(error => console.error('An error occurred:', error));

				
			
curl Cammand :
				
					curl -X GET "http://<server-ip-address>/custom_api/export_capex_details/business_units?data_from_timestamp=1663999021&current_page=1" \
     -H "Authorization: Bearer <Token>"

				
			

These examples demonstrate how to make a GET request to the “Export Users” endpoint, using the authorization token and including the optional URL data parameters data_from_timestamp and current_page. Make sure to replace <server-ip-address> and <Token> with your actual server IP address and authorization token, respectively.

16. Capex Request

Description :

Use this API to get Capex Requests from various sources, such as web browsers, native applications on Android, and iOS.

URL :

				
					http://<server-ip-address>/custom_api/export_capex_details/capex_requests

				
			
Method : GET
Data ParametersRequiredValue
json or form-dataYes
data_from_timestampNo
URL Data ParametersNo
data_from_timestampYes1663999021
current_pageYes1

Example :

?data_from_timestamp=1663999021&current_page=1

Header Parameters:

Authorization :

Bearer <Token>

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "number_of_results": "1",
        "number_of_pages": 1,
        "results_per_page": 20,
        "current_page": "1",
           "entity_name": "capex_requests",
        "resultset": [
{
            "20142": {
                "capex_request": {
                    "capex_request-name": {
                        "label": "Capex Request Name",
                        "value": "test Capex Request"
                    },
                    "capex_request-business_unit": {
                        "label": "Entity",
                        "value": "20332"
                    },
                    "capex_request-request_number": {
                        "label": "Request number",
                        "value": "AL-2022-2040"
                    },
                    "capex_request-capex_type": {
                        "label": "Category",
                        "value": "Project"
                    },
                    "capex_request-description": {
                        "label": "Description",
                        "value": "test"
                    },
                    "capex_request-sub_number": {
                        "label": "Extra Tracking Number",
                        "value": "xtra Tracking Numbe"
                    },
                    "capex_request-project_start": {
                        "label": "Anticipated Project Start",
                        "value": "10/14/2022"
                    },
                    "capex_request-project_end": {
                        "label": "Anticipated Project End",
                        "value": "10/29/2022"
                    },
                    "capex_request-amount": {
                        "label": "Amount requested",
                        "value": "$582"
                    },
                    "capex_request-priority": {
                        "label": "Priority",
                        "value": "379"
                    },
                    "capex_request-date_initiated": {
                        "label": "Date started",
                        "value": "10/19/2022"
                    },
                    "capex_request-status": {
                        "label": "Status",
                        "value": "Not yet submitted for approval"
                    },
                    "capex_request-currency": {
                        "label": "Currency",
                        "value": "USD"
                    },
                    "capex_request-budgeted_status": {
                        "label": "Is this request already budgeted",
                        "value": "No"
                    },
                    "capex_request-approval_date": {
                        "label": "Approval date",
                        "value": ""
                    },
                    "capex_request-next_approver": {
                        "label": "Next Approver",
                        "value": "Marc Lacombe"
                    },
                    "capex_request-expense_type": {
                        "label": "Subcategory",
                        "value": "Capex and Opex"
                    },
                    "capex_request-reason": {
                        "label": "Reason for Capex",
                        "value": "Maintenance"
                    },
                    "capex_request-request_type_id": {
                        "label": "Request Type",
                        "value": "Request type 1"
                    },
                    "capex_request_executive_summary-background_summary": {
                        "label": "Background Summary",
                        "value": "Background Summary"
                    },
                    "capex_request_executive_summary-current_issues": {
                        "label": "Current issue(s)",
                        "value": "Current issue(s)\t"
                    },
                    "capex_request_executive_summary-project_scope": {
                        "label": "Project Scope",
                        "value": "Project Scope"
                    },
                    "capex_request_executive_summary-benefits": {
                        "label": "Benefits",
                        "value": "Benefits"
                    },
                    "capex_request-alternatives": {
                        "label": "Alternatives considered",
                        "value": "Alternatives considered"
                    },
                    "capex_request-recommendation": {
                        "label": "Recommendation",
                        "value": "Recommendation\t"
                    },
                    "capex_request-capex_request_state_id": {
                        "label": "State",
                        "value": null
                    },
                    "capex_request-originator_id": {
                        "label": "Requested by",
                        "value": "Marc Lacombe - CapExPlan Administrator"
                    },
                    "capex_request-asset_type": {
                        "label": "Asset Type",
                        "value": "Building Structure1"
                    },
                    "capex_request-stage_type_id": {
                        "label": "Stage Type",
                        "value": "Stage 1"
                    }
                },
                "capexRequestTrackingAssignTo": {
                    "3442": {
                        "label": "Adding Assignees 1",
                        "name": "Finance team",
                        "role": "Site Controller"
                    },
                    "3441": {
                        "label": "Adding Assignees 2",
                        "name": "Andrew Joseph",
                        "role": "Project Manager"
                    },
                    "3443": {
                        "label": "If Request is Approved, Assign To 5",
                        "name": "Katia Kelly",
                        "role": ""
                    },
                    "3444": {
                        "label": "If Request is Approved, Assign To 6",
                        "name": "Serge Leonard",
                        "role": ""
                    }
                },
                "capex_request_equipment": {
                    "17710": {
                        "capex_request_eq_eq_type": {
                            "label": "Equipment Type",
                            "value": "Chiller ( refrigeration)"
                        },
                        "capex_request_eq_category": {
                            "label": "Asset Category Type",
                            "value": "Building HVAC"
                        },
                        "capex_request_eq_description": {
                            "label": "Description",
                            "value": "trtet"
                        },
                        "capex_request_eq_sub_description": {
                            "label": "Sub Description",
                            "value": "test"
                        },
                        "capex_request_eq_asset_name": {
                            "label": "Asset Name",
                            "value": "test"
                        },
                        "capex_request_eq_assetNumber": {
                            "label": "Asset Number",
                            "value": "test"
                        },
                        "capex_request_eq_useful_life": {
                            "label": "Useful Life",
                            "value": "5 years"
                        },
                        "capex_request_eq_eq_make": {
                            "label": "Make",
                            "value": "fsdf"
                        },
                        "capex_request_eq_eq_model": {
                            "label": "Model",
                            "value": "sdf"
                        },
                        "capex_request_eq_modelName": {
                            "label": "Model Name",
                            "value": "sdfsf"
                        },
                        "capex_request_eq_vendor": {
                            "label": "Vendor/Supplier",
                            "value": "sdfsf"
                        },
                        "capex_request_eq_vcode": {
                            "label": "Vendor Code",
                            "value": "sdf"
                        },
                        "capex_request_eq_buy_cost": {
                            "label": "Purchase/Lease Cost",
                            "value": "$6"
                        },
                        "capex_request_eq_transport_cost": {
                            "label": "Transport Cost",
                            "value": "$60"
                        },
                        "capex_request_eq_taxes_fees": {
                            "label": "Taxes/Fees",
                            "value": "$66"
                        },
                        "capex_request_eq_import_cost": {
                            "label": "Import and Customs",
                            "value": "$6"
                        },
                        "capex_request_eq_install_cost": {
                            "label": "Installation",
                            "value": "$6,565"
                        },
                        "capex_request_eq_startup_cost": {
                            "label": "Startup Costs",
                            "value": "$5"
                        },
                        "capex_request_eq_equipment_cost": {
                            "label": "Equipment Cost",
                            "value": "$6,708"
                        },
                        "capex_request_eq_expected_delivery": {
                            "label": "Expected Delivery",
                            "value": "10/26/2022"
                        },
                        "capex_request_eq_actual_delivery": {
                            "label": "Actual Delivery",
                            "value": ""
                        },
                        "capex_request_eq_capex_initial_investment_type": {
                            "label": "Initial Investment Type",
                            "value": ""
                        },
                        "capex_request_eq_residual_value": {
                            "label": "Residual Value",
                            "value": "$5"
                        }
                    },
                    "17711": {
                        "capex_request_eq_eq_type": {
                            "label": "Equipment Type",
                            "value": "Heating Rooftop"
                        },
                        "capex_request_eq_category": {
                            "label": "Asset Category Type",
                            "value": "Heaters"
                        },
                        "capex_request_eq_description": {
                            "label": "Description",
                            "value": "54"
                        },
                        "capex_request_eq_sub_description": {
                            "label": "Sub Description",
                            "value": "545"
                        },
                        "capex_request_eq_asset_name": {
                            "label": "Asset Name",
                            "value": "45"
                        },
                        "capex_request_eq_assetNumber": {
                            "label": "Asset Number",
                            "value": "454"
                        },
                        "capex_request_eq_useful_life": {
                            "label": "Useful Life",
                            "value": "54 years"
                        },
                        "capex_request_eq_eq_make": {
                            "label": "Make",
                            "value": "54"
                        },
                        "capex_request_eq_eq_model": {
                            "label": "Model",
                            "value": "5"
                        },
                        "capex_request_eq_modelName": {
                            "label": "Model Name",
                            "value": "45"
                        },
                        "capex_request_eq_vendor": {
                            "label": "Vendor/Supplier",
                            "value": "45"
                        },
                        "capex_request_eq_vcode": {
                            "label": "Vendor Code",
                            "value": "45"
                        },
                        "capex_request_eq_buy_cost": {
                            "label": "Purchase/Lease Cost",
                            "value": "$45"
                        },
                        "capex_request_eq_transport_cost": {
                            "label": "Transport Cost",
                            "value": "$45"
                        },
                        "capex_request_eq_taxes_fees": {
                            "label": "Taxes/Fees",
                            "value": "$45"
                        },
                        "capex_request_eq_import_cost": {
                            "label": "Import and Customs",
                            "value": "$45"
                        },
                        "capex_request_eq_install_cost": {
                            "label": "Installation",
                            "value": "$45"
                        },
                        "capex_request_eq_startup_cost": {
                            "label": "Startup Costs",
                            "value": "$45"
                        },
                        "capex_request_eq_equipment_cost": {
                            "label": "Equipment Cost",
                            "value": "$270"
                        },
                        "capex_request_eq_expected_delivery": {
                            "label": "Expected Delivery",
                            "value": "10/28/2022"
                        },
                        "capex_request_eq_actual_delivery": {
                            "label": "Actual Delivery",
                            "value": ""
                        },
                        "capex_request_eq_capex_initial_investment_type": {
                            "label": "Initial Investment Type",
                            "value": ""
                        },
                        "capex_request_eq_residual_value": {
                            "label": "Residual Value",
                            "value": "$5"
                        }
                    }
                },
                "financialDetail": [
                    {
                        "capex_request-return_amount": {
                            "label": "Capital expenditure amount (or total expense)",
                            "value": "$582"
                        },
                        "capex_request-return_discount_rate": {
                            "label": "Discount Rate",
                            "value": "9%"
                        },
                        "capex_request-sales_contribution": {
                            "label": "Sales Contribution",
                            "value": "100%"
                        },
                        "capex_request-capex_tax_rate": {
                            "label": "Tax Rate",
                            "value": "30%"
                        },
                        "capex_request-capex_interest_rate": {
                            "label": "Interest Rate",
                            "value": "9%"
                        },
                        "capex_request-period": {
                            "label": "Period",
                            "value": "3 Years\n Months"
                        },
                        "capex_request-number_of_years_to_amortize": {
                            "label": "Number of years to amortize",
                            "value": ""
                        },
                        "capex_request-residual_value": {
                            "label": "Residual Value",
                            "value": "$10"
                        },
                        "capex_request-return_npv": {
                            "label": "Net present value (NPV)",
                            "value": "$245"
                        },
                        "capex_request-return_npv_with_tax": {
                            "label": "Net present value (NPV) incl tax advantage",
                            "value": ""
                        },
                        "capex_request-return_irr": {
                            "label": "Internal rate of return (IRR)",
                            "value": "0%"
                        },
                        "capex_request-return_irr_with_tax": {
                            "label": "Internal rate of return (IRR) w/deprec. effect on tax",
                            "value": ""
                        },
                        "capex_request-return_payback": {
                            "label": "Simple payback period",
                            "value": "0.0 Years"
                        },
                        "capex_request-is_residual_value_in_paypabck": {
                            "label": "Include Residual Value",
                            "value": "No"
                        },
                        "capex_request-return_payback_with_tax": {
                            "label": "return_payback_with_tax",
                            "value": ""
                        }
                    }
                ],
                "capexRequestAttachment": {
                    "21848": {
                        "capex_request_attachments-filename": {
                            "label": "Filename",
                            "value": "test.png"
                        },
                        "capex_request_attachments-type": {
                            "label": "Attachment Type",
                            "value": "Other"
                        },
                        "capex_request_attachments-tags": {
                            "label": "Tags",
                            "value": "test\n"
                        },
                        "capex_request_attachments-description": {
                            "label": "Description",
                            "value": "test"
                        }
                    }
                },
                "capexApprovalList": [
                    {
                        "name": {
                            "label": "Name",
                            "value": "Marc Lacombe"
                        },
                        "title": {
                            "label": "Title",
                            "value": "CapExPlan Administrator"
                        },
                        "date_sent": {
                            "label": "Date Notified",
                            "value": "10/25/2022"
                        },
                        "is_observer": {
                            "label": "User Type",
                            "value": "Approver"
                        }
                    },
                    {
                        "name": {
                            "label": "Name",
                            "value": "Adrian"
                        },
                        "title": {
                            "label": "Title",
                            "value": "Regional VP"
                        },
                        "date_sent": {
                            "label": "Date Notified",
                            "value": "10/25/2022"
                        },
                        "is_observer": {
                            "label": "User Type",
                            "value": "Approver"
                        }
                    },
                    {
                        "name": {
                            "label": "Name",
                            "value": "Norm Blouin"
                        },
                        "title": {
                            "label": "Title",
                            "value": "Senior VP"
                        },
                        "date_sent": {
                            "label": "Date Notified",
                            "value": "10/25/2022"
                        },
                        "is_observer": {
                            "label": "User Type",
                            "value": "Approver"
                        }
                    }
                ]
            }
]
        }
    }
}

				
			
Error Response :
  • Code: 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid API Token"
    }
}

				
			

Note :

PHP Code :
				
					$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://<server-ip-address>/custom_api/export_capex_details/capex_requests?data_from_timestamp=1663999021&current_page=1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <Token>'
  ),
));

$response = curl_exec($curl);

$data = json_decode($response);

if ($data->code === 200) {
    // Handle success response
} else {
    // Handle error response
}

curl_close($curl);

				
			
JavaScript:
				
					fetch('http://<server-ip-address>/custom_api/export_capex_details/capex_requests?data_from_timestamp=1663999021&current_page=1', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <Token>'
  }
})
.then(response => response.json())
.then(data => {
  if (data.code === 200) {
    // Handle success response
  } else {
    // Handle error response
  }
});

				
			
cURL :
				
					curl -X GET "http://<server-ip-address>/custom_api/export_capex_details/capex_requests?data_from_timestamp=1663999021&current_page=1" \
     -H "Authorization: Bearer <Token>"

				
			

This documentation should provide a comprehensive overview of the Capex Request API endpoint, including how to make requests using PHP, JavaScript, and cURL. If you have any further requirements, please let me know!

17. Capex Request Tracking

Description :

Use this API to get Capex Request Tracking from various sources, such as web browsers, native applications on Android, and iOS.

URL :

				
					http://<server-ip-address>/custom_api/export_capex_details/capex_request_trackings

				
			
Method : GET
Data ParametersRequiredValue
json or form-dataYes
capex_idYes1234
URL Data ParametersNo
current_pageYes1
ExampleYes ?current_page=1

Header Parameters:

Authorization :

Bearer <Token>

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "number_of_results": "6915",
        "number_of_pages": 346,
        "results_per_page": 20,
        "current_page": "1",
        "entity_name": "capex_request_trackings",
        "resultset": [
            {
                "request_id": {
                    "label": "Request ID",
                    "value": 410376
                },
                "request_number": {
                    "label": "Request number",
                    "value": "LUE-2023-100350-STD1"
                },
                "forcast_month_year": {
                    "label": "Month",
                    "value": "January 2023"
                },
                "amount": {
                    "label": "Budget Amount",
                    "value": 0
                },
                "amount_currency": {
                    "label": "Budget Amount Currency",
                    "value": "EUR"
                },
                "approved_amount": {
                    "label": "Approved Amount",
                    "value": "0.00"
                },
                "approved_amount_currency": {
                    "label": "Approved Amount Currency",
                    "value": "EUR"
                },
                "engaged_amount": {
                    "label": "Actual",
                    "value": "0.00"
                },
                "engaged_amount_currency": {
                    "label": "Actual Currency",
                    "value": "EUR"
                },
                "forecast_amount": {
                    "label": "Forecast",
                    "value": "0.00"
                },
                "forecast_amount_currency": {
                    "label": "Forecast Currency",
                    "value": "EUR"
                },
                "total_budgeted": {
                    "label": "Total Budgeted",
                    "value": ""
                },
                "total_budgeted_currency": {
                    "label": "Total Budgeted Currency",
                    "value": "EUR"
                },
                "total_approved_amount": {
                    "label": "Total Approved",
                    "value": 0
                },
                "total_approved_amount_currency": {
                    "label": "Total Approved Currency",
                    "value": "EUR"
                },
                "total_spent_actual": {
                    "label": "Total Spent (Actual)",
                    "value": 0
                },
                "total_spent_actual_currency": {
                    "label": "Total Spent Currency (Actual)",
                    "value": "EUR"
                },
                "variance": {
                    "label": "Variance",
                    "value": 0
                },
                "variance_currency": {
                    "label": "Variance Currency",
                    "value": "EUR"
                },
                "variance_percentage": {
                    "label": "% Variance",
                    "value": "0%"
                },
                "forecast_amount_total": {
                    "label": "Total Forecast",
                    "value": 0
                },
                "forecast_amount_total_currency": {
                    "label": "Total Forecast Currency",
                    "value": "EUR"
                },
                "revised_forecast_amount": {
                    "label": "Revised Forecast",
                    "value": 0
                },
                "revised_forecast_amount_currency": {
                    "label": "Revised Forecast Currency",
                    "value": "EUR"
                }
            },
            {
                "request_id": {
                    "label": "Request ID",
                    "value": 410377
                },
                "request_number": {
                    "label": "Request number",
                    "value": "LUE-2023-100350-STD1"
                },
                "forcast_month_year": {
                    "label": "Month",
                    "value": "February 2023"
                },
                "amount": {
                    "label": "Budget Amount",
                    "value": 0
                },
                "amount_currency": {
                    "label": "Budget Amount Currency",
                    "value": "EUR"
                },
                "approved_amount": {
                    "label": "Approved Amount",
                    "value": "0.00"
                },
                "approved_amount_currency": {
                    "label": "Approved Amount Currency",
                    "value": "EUR"
                },
                "engaged_amount": {
                    "label": "Actual",
                    "value": "0.00"
                },
                "engaged_amount_currency": {
                    "label": "Actual Currency",
                    "value": "EUR"
                },
                "forecast_amount": {
                    "label": "Forecast",
                    "value": "0.00"
                },
                "forecast_amount_currency": {
                    "label": "Forecast Currency",
                    "value": "EUR"
                },
                "total_budgeted": {
                    "label": "Total Budgeted",
                    "value": ""
                },
                "total_budgeted_currency": {
                    "label": "Total Budgeted Currency",
                    "value": "EUR"
                },
                "total_approved_amount": {
                    "label": "Total Approved",
                    "value": 0
                },
                "total_approved_amount_currency": {
                    "label": "Total Approved Currency",
                    "value": "EUR"
                },
                "total_spent_actual": {
                    "label": "Total Spent (Actual)",
                    "value": 0
                },
                "total_spent_actual_currency": {
                    "label": "Total Spent Currency (Actual)",
                    "value": "EUR"
                },
                "variance": {
                    "label": "Variance",
                    "value": 0
                },
                "variance_currency": {
                    "label": "Variance Currency",
                    "value": "EUR"
                },
                "variance_percentage": {
                    "label": "% Variance",
                    "value": "0%"
                },
                "forecast_amount_total": {
                    "label": "Total Forecast",
                    "value": 0
                },
                "forecast_amount_total_currency": {
                    "label": "Total Forecast Currency",
                    "value": "EUR"
                },
                "revised_forecast_amount": {
                    "label": "Revised Forecast",
                    "value": 0
                },
                "revised_forecast_amount_currency": {
                    "label": "Revised Forecast Currency",
                    "value": "EUR"
                }
            }            
        ]
    }
}

				
			
Error Response :
  • Code: 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid API Token"
    }
}

				
			

Note :

PHP Code :
				
					$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://<server-ip-address>/custom_api/export_capex_details/capex_request_trackings?current_page=1&capex_id=123456',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <Token>'
  ),
));

$response = curl_exec($curl);

$data = json_decode($response);

if ($data->code === 200) {
    // Handle success response
} else {
    // Handle error response
}

curl_close($curl);

				
			
JavaScript :
				
					fetch('http://<server-ip-address>/custom_api/export_capex_details/capex_request_trackings?current_page=1&capex_id=123456', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <Token>'
  }
})
.then(response => response.json())
.then(data => {
  if (data.code === 200) {
    // Handle success response
  } else {
    // Handle error response
  }
});

				
			
cURL ::
				
					curl -X GET "http://<server-ip-address>/custom_api/export_capex_details/capex_request_trackings?current_page=1&capex_id=123456" \
     -H "Authorization: Bearer <Token>"

				
			

This comprehensive documentation should provide all the details related to the Capex Request Tracking API endpoint, including example code snippets for PHP, JavaScript, and cURL. If you need any further information or adjustments, please let me know!

18. Budget

Description :

Use this API to get Capex Request for Budget Management from various sources (Web Browser, Native application in Android, iOS).

URL :

				
					http://<server-ip-address>/custom_api/export_capex_details/budgets

				
			
Method : GET
Data ParametersRequiredValue
json or form-dataYes
capex_idYes1
current_pageYes1
ExampleYes?capex_id=1¤t_page=1

Header Parameters:

Authorization :

Bearer <Token>

Success Response :

Code : 200

Content :

				
					{
    "code": 200,
    "message": "success",
    "data": {
        "number_of_results": 3446,
        "number_of_pages": 173,
        "results_per_page": 20,
        "current_page": "1",
        "entity_name": "budget_line_item_details",
        "resultset": [
            {
                "budget_status": {
                    "label": "Budget Status",
                    "value": ""
                },
                "calfield_15": {
                    "label": "Project Score",
                    "value": ""
                },
                "capex_type": {
                    "label": "Category",
                    "value": "standalone"
                },
                "expense_type": {
                    "label": "Subcategory",
                    "value": "Capital Expenditure"
                },
                "budget_owner_user_id": {
                    "label": "Budget Owner",
                    "value": ""
                },
                "budget_wbs_element": {
                    "label": "Budget WBS Element",
                    "value": "Softwares"
                },
                "budget_wbs_number": {
                    "label": "Budget WBS Number",
                    "value": "2.20"
                },
                "capex_request_type_asset_category_id": {
                    "label": "Asset Category Description",
                    "value": null
                },
                "capex_request_type_asset_category_sub_category_id": {
                    "label": "Asset Equipment Description",
                    "value": null
                },
                "name_of_expense": {
                    "label": "Name of Expense",
                    "value": "Hypar BIM - BIM design and engineering for UK (global platform)"
                },
                "priority": {
                    "label": "Engineering Category",
                    "value": ""
                },
                "project_end": {
                    "label": "Anticipated Project End",
                    "value": ""
                },
                "project_manager_user_id": {
                    "label": "Project Manager",
                    "value": "Craig Norman - Segment Manager Building Services"
                },
                "reason": {
                    "label": "Capex Driver",
                    "value": "DIG"
                },
                "request_number": {
                    "label": "Request number",
                    "value": "GB040-HU-2023-31"
                },
                "sub_number": {
                    "label": "Temp Number",
                    "value": "GB040_9026"
                },
                "business_unit": {
                    "label": "Entity",
                    "value": "21119"
                },
                "detailed_path_business_unit": {
                    "label": "Entity (detailed path)",
                    "value": ""
                },
                "currency": {
                    "label": "Currency",
                    "value": "GBP"
                },
                "years": {
                    "2023_1": {
                        "label": "2023 Jan",
                        "value": 23000
                    },
                    "2023_2": {
                        "label": "2023 Feb",
                        "value": 0
                    },
                    "2023_3": {
                        "label": "2023 Mar",
                        "value": null
                    },
                    "2023_4": {
                        "label": "2023 Apr",
                        "value": null
                    },
                    "2023_5": {
                        "label": "2023 May",
                        "value": null
                    },
                    "2023_6": {
                        "label": "2023 Jun",
                        "value": null
                    },
                    "2023_7": {
                        "label": "2023 Jul",
                        "value": null
                    },
                    "2023_8": {
                        "label": "2023 Aug",
                        "value": null
                    },
                    "2023_9": {
                        "label": "2023 Sep",
                        "value": null
                    },
                    "2023_10": {
                        "label": "2023 Oct",
                        "value": null
                    },
                    "2023_11": {
                        "label": "2023 Nov",
                        "value": null
                    },
                    "2023_12": {
                        "label": "2023 Dec",
                        "value": null
                    }
                }
            }            
        ]
    }
}

				
			
Error Response :
  • Code: 401 BAD REQUEST

Content :

				
					{
    "code": 401,
    "message": "fail",
    "data": {
        "error": "Invalid API Token"
    }
}

				
			

Note :

PHP Code :
				
					PHP:$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'http://<server-ip-address>/custom_api/export_capex_details/budgets?capex_id=1&current_page=1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer <Token>'
  ),
));

$response = curl_exec($curl);

$data = json_decode($response);

if ($data->code === 200) {
    // Handle success response
} else {
    // Handle error response
}

curl_close($curl);

				
			
JavaScript Code (using Fetch) :
				
					fetch('http://<server-ip-address>/custom_api/export_capex_details/budgets?capex_id=1&current_page=1', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <Token>'
  }
})
.then(response => response.json())
.then(data => {
  if (data.code === 200) {
    // Handle success response
  } else {
    // Handle error response
  }
});

				
			
curl Cammand :
				
					curl -X GET "http://<server-ip-address>/custom_api/export_capex_details/budgets?capex_id=1&current_page=1" \
     -H "Authorization: Bearer <Token>"

				
			

This documentation includes all the required details for the Budget Management’s Budget API, as well as code examples for PHP, JavaScript, and cURL. If there are any other details or changes needed, please let me know!

19. Business Unit Management

19.1 Business Unit

Description:

This API allows you to retrieve Business Units from various platforms such as web browsers, native applications in Android, and iOS.

URL:

				
					http://<server-ip-address>/custom_api/business_unit
				
			
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": [
    {
      "id": 9096,
      "name": " / Aurora"
    },
    {
      "id": 9099,
      "name": " / Aurora / Group 1"
    },
    {
      "id": 9102,
      "name": " / Aurora / Group 1 / Building A New"
    }
  ]
}

				
			
Error Response:

Code: 401 BAD REQUEST