PO Fields

Estimated reading: 3 minutes

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.

Share this Doc

PO Fields

Or copy link

CONTENTS