My Integration Failed to Update a Part
This article explains how to troubleshoot issues with a MaintainX integration when it fails to update parts assigned to multiple locations. You'll learn how to update your integration to use the new locations
array, reactivate the multi-location parts feature, and prevent MaintainX from deactivating it again if necessary.
Issue​
Your organization includes the multi-location parts feature. You have an integration with MaintainX that updates the parts inventory using one of the following REST API endpoints:
When the integration attempts to update the parts inventory, multi-location parts is temporarily deactivated for your organization. While it's deactivated, users can't add new locations to parts. If a user tries to add a location, they see an error message stating that multi-location parts are temporarily deactivated due to a legacy integration.
Additionally, if the integration attempts to update a part assigned to multiple locations, it fails. The REST API request returns an error message stating that the integration must update the new field.
Cause​
If the integration was created before MaintainX introduced multi-location parts, it's configured to update one or more of the following deprecated fields via the REST API.
-
Update part information fields:
area
availableQuantity
locationId
minimumQuantity
-
Fulfill Purchase Order fields:
items[array_of_items].quantityReceived
If the integration attempts to update the deprecated fields for a part with multiple locations, it will fail. The integration fails because the deprecated fields are designed to handle single-location parts. When a part has multiple locations, these fields can't accommodate the additional data, which causes an error.
To help ensure that your integration continues to work, MaintainX triggers a "safety switch" that temporarily deactivates multi-location parts. This prevents your organization from adding multiple locations to parts until you have a chance to update the integration.
Recommended Solution: Update the Integration​
MaintainX recommends that organizations impacted by this issue update their integrations to use the updated REST API fields.
- For the Update part information endpoint, use the
locations
array. - For the Fulfill Purchase Order, use the
fulfillments
array.
After you update your integration, you can reactivate multi-location parts from the Parts settings.
If updating the integration isn't feasible, you can reactivate multi-location parts and bypass the safety switch to keep it on. This approach isn't recommended unless you're certain your integration will only update parts that have one location.
Update Part Endpoint Fields​
The locations
array replaces the deprecated fields in the Update part information REST API endpoint. It allows you to specify multiple locations for a part. Each location in the array includes properties such as locationId
, availableQuantity
, and minimumQuantity
.
Here's an example of how to structure an API request payload for the Update part information endpoint using the locations
array:
BEFORE:
If your integration uses the deprecated parts fields, your API request payload should look something like this:
{
"name": "Locknut - 1/8",
"area": "tool room",
"unitCost": 120,
"availableQuantity": 10,
"minimumQuantity": 5,
"locationId": 852,
}
AFTER:
When you update your integration to use the multi-location parts fields, your API request payload should look something like this:
{
"name": "Locknut - 1/8",
"locations": {
"addedUpdated": [
{
"locationId": 852,
"availableQuantity": 10,
"minimumQuantity": 5,
"area": "tool room"
}
],
"removedLocationIds": [
742,
514
]
}
}
- The
addedUpdated
array contains locations to add or update. - The
removedLocationIds
array is optional and contains location IDs to remove.
For more information about the deprecated fields and the new locations
array, see Update part information (PATCH) in the REST API Documentation.