Add References To Issues
This tutorial demonstrates how to add references such as Forma photos to Forma issues. The steps include verifying the user’s permissions, finding the ID of the references (in this example, the photo) you want to add to the issue, and using the Relationships API to add it to the issue.
Before You Begin
- Register an app
- Acquire a 3-legged OAuth token with the
data:writescope. - Verify that you have access to the relevant hub and Forma project.
- Find the relevant project ID for the project you want to create an issue in by following the Retrieve Forma Hub and Project ID tutorial. In this example, assume the project ID is
f6a1e3b5-abaa-4b01-b33a-5d55f36ba047.
Note that we do not currently support document-related (pusphin) issues or linked documents.
Step 1: Verify the User’s Permissions
We recommend that you call GET users/me to verify that the user has permissions to add photos to issues. The user can add photos if the issues.new object appears in the response. See the Permissions Table for more information about permissions.
Request
Response
The user can add photos to issues if the issues.new object appears in the response. The user has manage issues permissions if create, write, read appears in the permissionLevels array. For more details about permission levels, see Issues Permissions.
Step 2: Find the Issue ID
To find the issue ID of the issue you want to add the photo to, call `GET issues /en/docs/acc/v1/reference/http/issues-issues-GET/`_ using the project ID (f6a1e3b5-abaa-4b01-b33a-5d55f36ba047).
Request
Response
Note the ID (results.[id]) - (3570f222-6c54-4b01-90e6-e701749f0222) of the issue you want to add the photo to.
Step 3: Find the Reference (Photo) ID
To find the ID of the photo you want to add to the issue, call GET photos using the project ID (f6a1e3b5-abaa-4b01-b33a-5d55f36ba047) to get a list of all the photos for the project.
Note you cannot currently upload photos to the Forma Photo tool using the Photos API. You can only upload photos via the Photos UI. We will be supporting the photos API upload in the near future. As a workaround you can upload photos to the Forma Files tool using the Data Management API and add a file reference to the issue. See the Upload Files tutorial for details.
Request
Response
Note the ID (results.[id]) - (5439bfb7-8006-4388-a454-f02560f99566) of the photo you want to add to the issue.
If you want to add a new photo to the issue, upload the photo to Forma Data Management using the Data Management API. See the Upload Files tutorial for details. Note the item ID (included.[id]) in the response.
Step 4: Add the Reference (Photo) to the Issue
Use the Relationships API to add the photo to the issue. Call PUT relationships using the project ID (f6a1e3b5-abaa-4b01-b33a-5d55f36ba047), the photo ID (5439bfb7-8006-4388-a454-f02560f99566), and the issue ID (3570f222-6c54-4b01-90e6-e701749f0222).
If you uploaded the photo via the Photos UI, use the following types and domains:
For the issue: use an issue type, and an autodesk-bim360-issue domain. For the photo: use a photo type, and an autodesk-contruction-photo domain.
If you uploaded the photo to Forma Files using the Data Management API, use the following types and domains:
For the issue: use an issue type, and an autodesk-bim360-issue domain. (Note that the issues API currently uses the autodesk-bim360-issue domain for both for both Forma and BIM 360 relationships.) For the file: use a documentlineage type, and an autodesk-bim360-documentmanagement domain.
Note that container ID in the relationships ID is equivalent to the project ID.
Request
Response (200)
Congratulations! You have added a photo to a Forma issue.
Imported from the Autodesk Platform Services documentation: https://aps.autodesk.com/en/docs/acc/v1/tutorials/issues/add-references-to-issues.