Create a Review
This tutorial demonstrates how to create a review in a project. The steps include preparing the review details, creating the review, confirming the review, and optionally using webhooks to monitor creation status.
Before You Begin
-
Register an app, and select
Forma APIsin theAPI Accessdropdown. -
Acquire a 3-legged or 2-legged OAuth token with
data:readanddata:writescopes.- For a 3-legged token, ensure that the user has permission to access the project and files.
- For a 2-legged token, the
x-user-idheader is required. Retrieve the user’s Autodesk ID by calling GET projects/:projectId/users with your 2-legged OAuth token and the user’s email address. Ensure that the user is a project administrator or a candidate in the workflow.
-
Find the project ID for the project you want to work with by following the Retrieve a Forma Hub ID and Project ID tutorial. In this example, assume the project ID is
9ba6681e-1952-4d54-aac4-9de6d9858dd4. -
Find the workflow ID for the approval workflow you want to use by calling GET workflows. In this example, assume the workflow ID is
a4e60936-e950-4097-b7d3-e6cf1c3c5415. -
Obtain the URNs of the file versions that you want to include in the review. To find file version URNs, follow the first four steps of the Download a File tutorial.
-
Verify that you have access to the relevant Forma hub, project, folders, and files.
Step 1 (optional): Gather Required IDs and URNs
Use the project ID (9ba6681e-1952-4d54-aac4-9de6d9858dd4) to call GET workflows and retrieve available approval workflows (including their steps). Choose a workflow, note its id and the Reviewer step id, then gather the file version URNs you want to include (and optionally a target folder URN).
Request
Response
Notes
- Reviewer step ID — Use the Reviewer step
id(e.g.,Lane_3ReoxO2T0o) if you plan to override candidates in your request (workflowOptions.steps[].id). - File version URNs — To find file version URNs, follow the first four steps of the Download a File tutorial and note the
included.idvalues. - Target folder URN (optional) — If you plan to set
workflowOptions.copyFilesOptions.folderUrn, ensure the workflow allows it (copyFilesOptions.enabled = trueandcopyFilesOptions.allowOverride = true). You can locate a folder URN using the Upload Files to the Forma Files tool tutorial and note thedata.id. - To override reviewer candidates, the workflow must allow it:
additionalOptions.initiatorEditPermissionsmust includeREVIEWER_ASSIGNMENTS_AND_DURATION.
Step 2: Create a Review
Use the project ID (9ba6681e-1952-4d54-aac4-9de6d9858dd4) to call POST reviews with the request payload you prepared in Step 1. This creates a new review instance in the project.
Request
Response
Notes
- When a review is created, its
statusisOPENand thecurrentStepIdis the first Reviewer step ID, or the Approver step ID if no Reviewer step exists. - To query the note created during review creation, call GET reviews/progress.
Step 3: Confirm the Review
After creating a review, confirm that it was created successfully by calling GET reviews/:reviewId with the review ID returned in Step 2. This retrieves the full details of the new review.
Request
Response
Notes
- Confirm that the
statusisOPENand that theworkflowIdmatches the workflow you selected. - If you need to inspect the review’s steps and progress, use GET reviews/workflow for the workflow snapshot or GET reviews/progress for progress updates.
Step 4 (optional): Use a Webhook to Monitor Review Creation
When a review is created, the system validates its files in the background. If any file is invalid or missing, the review may later change from OPEN to FAILED even though the initial request returned 201 Created.
Rather than repeatedly calling GET reviews/:id, register a webhook for the review.created-1.0 event. See the Creating a Webhook and Listening to Events tutorial for more details. Forma sends a POST message to your callback URL when the review finishes initialization—whether successful or failed.
When registering a webhook, you must provide a callback endpoint with a POST method to receive messages about the result of the Review creation.
In this example, assume the callback URL is:
Request
After the review finishes initialization, Forma sends a POST request to your callback URL with the following payload:
Response
Notes
- The default value for
regionisUS, but we recommend explicitly specifying the region when sending requests. For the complete list of supported region API values, see the Regions page. - The
payloadincludes the review’s creation status. If an error occurs, anerrorCodefield is returned.
Example of a failed payload:
The errorCode value indicates the type of error that occurred:
NO_VALID_VERSION_URN– Some of the provided URNs are invalid.MALWARE_DETECTED– A file was detected as malware.VERSIONS_NOT_EXISTED– One or more version files no longer exist (for example, they were deleted).DIFFERENT_PROJECT_VERSIONS– One or more URNs belong to a different project.PARENT_FOLDER_NOT_EXISTED– A parent folder no longer exists (it may have been deleted).VERSIONS_ACCESS_DENIED– The initiator does not have permission to access the specified files.RETRYABLE_TEMP_ERROR– The review creation failed due to a temporary error; you can retry the request later.
Step 5 (optional): List Reviews in a Project
To retrieve all reviews that you can access in a project, call GET reviews. Use the limit and offset parameters for pagination. The default limit is 50 and the default offset is 0.
If the response does not include a nextUrl, it means you have reached the last page of results.
Request
Response
Notes
- Use the
filter[status]parameter (as shown above) to restrict results by status, such asOPENorCLOSED. - Use
filter[approvedBy]to filter reviews by the Autodesk ID of the user who approved them, andfilter[approvedAt]to filter by approval timestamp. - Use the
nextUrlfield in the response to retrieve additional pages of results.
Imported from the Autodesk Platform Services documentation: https://aps.autodesk.com/en/docs/acc/v1/tutorials/reviews/reviews-create-review.