PO Line Items Fields | Capexplan Knowledge Base

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 ParametersRequired
format=json (In the future, maybe change to default)Yes

Form Data Parameters :

KeyValue
page_namecapex_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 : Success response may change in the future if required.

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>'

Please make sure to replace and with the actual server IP address and the valid API token, respectively, before using this cURL command in Postman. This format should work properly in Postman for making the GET request to the API endpoint.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top