How to Prepare for Using the Category Custom Field
Learn how to alter your API integrations to ensure a smooth transition from Categories functionality to the corresponding custom item field.
TABLE OF CONTENTS
Transition Timeline: Moving from Category to Custom Field
- 30-day transition period (current state):
- Responses include both category and dataItemCustomFields.
- Existing integrations continue working without change.
- Categories functionality removal:
- The category field will be completely removed from all API responses on September 1 for precoro.com and September 15 for precoro.us.
- Category values will be available only via the ICF in dataItemCustomFields using the custom field named "Category".
Please follow the steps below to configure your requests according to the new field structure.
Step 1: Get and Save the Category Custom Field Data
-
Fetch the list of custom item fields:
GET https://api.precoro.com/itemcustomfields
-
Find the object with name = "Category": this is a Drop-down type custom item field (ICF) that we have created for you based on your existing Categories.
Example response:
{
"id": <icfId>,
"name": "Category",
"options": {
"data": [
{ "id": <optionId>, "name": "Equipment" },
{ "id": <optionId>, "name": "Products" },
...
]
}
} -
Save
<icfId>
and the arrayoptions.data
for later use.These option names match your current Category names, and you will use their IDs (<optionId>) in your item and document create/update requests.
Step 2: Locate the Category Values in Responses
In the response to GET https://api.precoro.com/items
, you will see both the old category field (temporarily) and the new ICF data:
{
"id": 372161,
"name": "Home Desk",
...
"dataItemCustomFields": {
"data": [
{
"id": 116,
"value": "53151",
"itemCustomField": { "id": 5144 }
}
]
},
"category": { /* temporarily */ }
}
- itemCustomField.id = <icfId> (the ID of the "Category" custom field) (see step 1);
- value = <optionId> (the ID of the option in the ICF (from the
options.data
array) that matches the category name).
Step 3: Use Updated POST/PUT Requests for Items
Once the Categories functionality is removed, you will need to send altered create/update requests that include the Category custom field like this:
- dataItemCustomFields[data][0][itemCustomField][id] = <icfId> (the ID of the “Category” custom field (retrieved via
GET /itemcustomfields
)) - dataItemCustomFields[data][0][value] = <optionId> (the ID of the option matching the category name (found in the
options.data
array of the “Category” ICF))