Changes to the ApplicableTypes endpoints
Overview
We recently added several Applicable Type endpoints to the Web API: https://announcements.alloyapp.io/applicable-types-now-enforced-by-web-api-3jpgbe
Applicable Types define how items of various activity-related designs can link to each other, e.g.
- Which Asset types can each Job/Inspection/Defect type be linked to?
- Which Job types can each Job Work Unit type be linked to?
When using the api/applicable-type/applicable-from
endpoint, you may receive some unexpected results. Put simply, this is because the current logic is finding links that can be applicable but haven’t explicitly been made applicable.
To improve this, we’re changing how the endpoint behaves. Rather than accepting a list of designs, it will instead accept a list of items. The new logic will be able to use the parent or child items to determine which DoDIs or items are applicable from that item.
This should produce results that are more in line with expectations! However, it will require some breaking changes. 😐
Who will be affected?
These breaking changes will affect anyone who uses the ApplicableTypes endpoints on the Web API.
Details
New Endpoint Addresses
The addresses of the following endpoints will be changing.
List Applicable From Types endpoint
The request for this endpoint (ApplicableTypeFromWebRequestModel
) will be changing:
- The
toAll
property will be removed. - The
from
property will no longer accept aApplicableFromItemWebModel
(item IDs) and therefore will no longer require a discriminator. It will only acceptApplicableFromDodiWebModel
(DoDi codes). - The
toAllItems
required property will be added (to replacetoAll
). This is an array of item IDs that you wish to check. - The
filterAttributeCode
required property will be added. This specifies the link attribute to find applicable types on. The attribute must be present on all the items provided intoAllItems
.
For example, to query which job types can be raised against specific assets, you would provide these values for the aforementioned parameters:
ToAllItems
= an array of asset item IDsFilterAttributeCode
= attributes_tasksAssignableTasksFrom
= designInterfaces_jobs
(to exclude inspections and other task types)
Additionally, the response model for this endpoint (ApplicableTypeFromWebResponseModel
) will also be changing:
- The
NoRestrictions
property will be added. If no results are returned, this boolean explains why. If true, there are no restrictions, which means everything applies. If false, it means that nothing applies. - The results can be of type
ApplicableFromDodiWebResponseModel
orApplicableFromItemResultWebModel
, so these are the new discriminators to use (no moreApplicableItemWebModel
).
Importantly, this revised endpoint won’t support finding applicable job types for supplied work unit items. This will be handled by a new endpoint coming in future.
List Applicable To Types endpoint
The response for this endpoint will be changing:
- The results can only be of type
ApplicableToDodiWebResponseModel
. Therefore, it will no longer be necessary to supply a discriminator.
Expected Release
8th December 2022 as part of the Alloy v2.42 release.
The documentation available on Swagger and ReDoc will be updated accordingly.