Track Reception Fields

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

Form Data Parameters :

page_name: capex_track_receptions

Header Parameters :

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

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 : Please ensure to replace and with the actual server IP address and the valid API token, respectively, before using this cURL command. This format should work properly 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