Job Logic in Web API
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 performed when creating/updating/deleting jobs 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. Similar changes were made to defect logic (August) and inspection logic (September).
Who will be affected?
This change will affect any users who work with jobs 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 working with jobs:
- Through the Web API, where jobs are treated like any other item.
- Through the Extended API, where certain job-specific logic is applied when performing the same operations (e.g. limiting the number of asset parents a job can have).
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, so these limits can be removed in future.
As a result, there will be some changes to the behaviour of the Web API Item endpoints when a job item is operated on.
Application of Special Parent Logic
When creating or editing a job via the Web API, if no geometry is supplied, geometry from the job's parent asset will be copied to the job.
However, this won’t happen if the parent asset is through a path more than two hops away (e.g. a job raised against a defect that’s already linked to the asset). In such cases, the geometry from a parent non-asset item will be copied instead.
Required Geometry from Parent Items will not be copied
If Geometry is required by the job's design, then specific geometry must be supplied to the Web API during any operation.
Previously, the Extended API would automatically copy geometry from the job’s parent item. This won’t happen when using the Web API.
Therefore, if you do want the job’s geometry to be copied from the parent (asset or activity), we recommend leaving Geometry as optional (as per the Tasks interface).
Removing Job Geometry will force a re-fetch from the Special Parent
When editing a job, removing its geometry will cause the Web API to copy the geometry from its parent item again.
This means it's effectively impossible to set a job's geometry to null if it has parents with geometry.
Extended Logic will appear as another entry in Item Audit Logs
Previously, any extended logic performed on a job item would be included in a single edit record in the item’s audit log.
Following this change, extended logic operations will be logged 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.
Jobs can only have One Asset Parent Enforced
Previously, jobs 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 the detail being ItemParentsContraintViolated
instead of InternalError
or DodiConstraint.
It was also possible to create jobs with multiple asset parents by creating them through the Web API instead of the Extended API. This will no longer be possible, as the same constraint will 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
27th October 2022 as part of the Alloy v2.41 release