API Enhancements
This document describes API-related enhancements in Upchain 22.2. Changes that were a part of weekly updates are flagged by an asterisk(*).
Supplier
- *As expected, regular users receive a 403-http error code when using
GET /api/supplier/v1/parts/{partVersionId}. Only suppliers should use this endpoint to get information about supplier’s objects related to the part specified by partVersionId.
All others can useGET /api/supplier/v1/parts/{partVersionId}/suppliers. The response includes a new fieldpartSupplierIdfield that provides the location where supplier’s objects are saved.
User’s organization information
- The following endpoints now include
contact.organizationin their response payload:GET /api/user/v1/user/{userId}GET /api/user/v2/usersGET /api/user/v2/users/{username}GET /api/user/v2/users/current-user/details
- The Excel spreadsheet generated using
POST /api/user/v2/users/exportincludes users’ Organization. PUT /api/user/v1/user/{userId}includescontact.organizationin the request so that a user’s organization can be updated.
Manually attached translations using the API
Follow these steps to manually attach a translation to an item using the API:
- Use
GET /api/bom/v2/item_versions/{itemVersionId}/translationsto fetch all translations associated with the item identified by theitemVersionId.
By default, those with permission to access the item, can get all of the latest versions of translations for the specified itemVersionId. Set allVersions to true to get both the latest and earlier versions of translations. - Create the new translation using
POST /api/bom/v1/file-versions. Consider the following before sending the request (you will need to refer to the response payload from step 1):
| Does a translation with the same file name already exist? | |
|---|---|
| Yes | No |
a. If subCategory: USER_GENERATED, when creating the new translation, use fileId in the request payload. This adds the new version of the translation and increments the file version.b. If subCategory: SYSTEM_GENERATED, you will receive a 409-http error code and the operation terminates without creating the translation. |
a. To ensure that translations, with the same file name, associated with other items do not increment, set forceNewTranslationFile to true. |
3. Attach the newly created translation from step 3 to an iteming using `POST /api/bom/v1/item-versions/{itemVersionId}/file-versions-bulk`. You can attach multiple translations to the item identified by itemVersionId.
Note: Only support is permitted to attach a translation to a Released or Released_External item. All others will receive a 403 http-error code.
You can remove translations using the following endpoints:
DELETE /api/bom/v2/item-versions/{itemVersionId}/file-versions/{fileVersionId}This endpoint only breaks the link between the translation and the item. “Deleted translations” can still be found using search.DELETE /api/bom/v2/item-versions/{itemVersionId}/user-translationsremoves all manually attached translations associated with an item. Only support can use this endpoint to remove all manually attached translations.
Restrict roles from creating new versions of released items
When POST /api/bom/v2/items is used to create a new version of a released item and the individual calling this endpoint does not have one of the permitted roles, then a 403-http error code is returned.
Required configurations
Tenant Administrators must perform the following steps:
- Request support to make the following tenant properties available:
create.new.item.version.from.release.checkandcreate.new.item.version.from.release.allowed. - In Administration > Engineering > Tenant properties:
- Click Edit.
- For the tenant property
create.new.item.version.from.release.allowedtype: permitted role 1 = item type 1, item type 2; permitted role 2` = item type 2, item type 3; and so on. Separate each permission-configuration with a semicolon and separate multiple item types with a comma.
Example:create.new.item.version.from.release.allowed : Lead Mechanical Designer = Product Structure Item, Purchased Mechanical Part; Project Manager = Product Structure Item, Purchased Mechanical Part, Electrical Package.
Clear locks using the API
Tenant Administrators can use DELETE /api/lock/v1/item-versions/{itemVersionId}/locks to remove BOM-edit, edit, and check out locks for the item specified in itemVersionId.
DELETE /api/lock/v1/item-versions/{itemVersionId}/locks clears an item's edit lock and the checkout lock for any associated files. If this endpoint is used for any other lock types, then an error is returned. A 200-http response returns information about all cleared locks.
