Inspection Logic in Web API
Note: Due to a technical issue, this change was made to the Web API before the announcement was made. We wish to apologise for any inconvenience this has caused.
Overview
As part of work to remove limitations to the number of items allowed in operations on the Extended API (https://extended.api.uk.alloyapp.io/), the logic that's applied to inspection creation/updating/deletion will be moved to the Web API (https://api.uk.alloyapp.io/). This work is part of ongoing changes being made to functionality that has historically been available through the Extended API. This work is similar to the changes made to the defect logic in August (Defect Logic Announcement).
Who will be affected?
This change will affect any users who work with inspections in Alloy, as these changes will be introduced on the API used by both the web client and mobile apps.
Details
There have always been two routes to work with inspections:
- through the Web API, where inspections are treated like any other item
- through the Extended API, where certain inspection-specific logic is applied when carrying out the same operations. For example, limiting the number of asset parents an inspection can have, and applying relevant date values such as Raised Time.
However, the way in which this additional logic was applied in the Extended API required a limit on the number of items being operated on, to guard against service degradation. Therefore, we're moving this logic to the Web API, in order to remove these limits in the future.
As a result, there will be a few changes to the behaviour of the Web API Item endpoints when an inspection item is operated on in the following ways.
Application of Special Parent Logic
When creating or editing an inspection, geometry from the inspection's parent asset will typically be copied to the inspection if no geometry is supplied.
However, this will not happen if the parent asset is through a path more than two hops away (such as an inspection raised against a defect that is already linked to the asset). In these cases, the geometry from a parent non-asset item will be copied.
Required Geometry from Parent Items will not be copied
If Geometry is required on the inspection design, then specific geometry must be supplied to the API during any operation.
Previously, the Extended API would automatically copy geometry from the parent item for the inspection. This will not happen when using the Web API.
For activities where you would like the geometry to be automatically set to that of the parent (asset or activity), we recommend that Geometry is left optional (as per the Tasks interface).
Removing Inspection Geometry will force a re-fetch from the Special Parent
When editing an inspection, removing its geometry will cause the Web API to re-fetch the parent item's geometry and set the inspection's geometry to that. This means it's effectively impossible to set an inspection's geometry to null if it has parents with geometry.
Extended Logic will appear as another entry in Item Audit Logs
Previously, extended logic applied to inspection items would be included in a single edit record in the item audit. Following this change, extended logic operations will be added as a separate audit record to the main operation that triggered the change.
Changed Error Codes
Since this is effectively new logic being introduced, any errors encountered will generate different Alloy error numbers than the same error before the changes. This may affect error handling in any existing integrations.
Inspections can only have One Asset Parent Enforced
Previously, inspections created through the Extended API were only permitted to have one asset parent. Contravening this constraint would result in a server error (500) being thrown.
This has now been changed to return a bad user request (400) with detail being ItemParentsContraintViolated
instead of InternalError
.
Also, it was previously possible to create inspections with multiple asset parents by creating them through the Web API. This is now no longer possible, as the same constraint will now apply to the Web API Items endpoints.
No Automatic Raised Time
If no time is supplied for attributes_tasksRaisedTime
when creating a job, the Extended API will automatically set it to the current date/time.
This functionality is planned for the Web API but isn’t available yet.
No Automatic Team Assignment
If no team is supplied when creating a job, the Extended API will copy the default team from the parent asset (if set).
This functionality is planned for the Web API but isn’t available yet.
Expected Release Date
1st September 2022