Task 5 - Submit a WorkItem
Submitting a WorkItem is the way to request the Automation Service to execute an Activity. This is where you will specify the different input and output values required by the Activity. You defined these inputs when you created the Activity during Task 3. You obtained the signed URLs to the input and output locations in Task 4.
By the end of this task, you will be able to create a WorkItem to execute an Activity.
You will use the following operations to work with WorkItems in this task:
| HTTP Request | Description |
|---|---|
| POST /workitems | Creates a new WorkItem and queues it for processing. |
Step 1 - Create a WorkItem
Request
curl -X POST \
'https://developer.api.autodesk.com/da/us-east/v3/workitems' \
-H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"activityId":"<YOUR_NICKNAME>.ExecuteMaxscript+tutorial",
"arguments":{
"InputMaxScene":{
"url":"urn:adsk.objects:os.object:<YOUR_BUCKET_KEY>/<OBJECT_KEY_4_INPUT_ZIP_FILE>",
"pathInZip":"<RELATIVE_PATH_TO_MAX_SCENE_INSIDE_ZIP_FILE>",
"verb":"get",
"headers":{
"Authorization":"Bearer <YOUR_ACCESS_TOKEN>"
}
},
"MaxscriptToExecute":{
"url":"urn:adsk.objects:os.object:<YOUR_BUCKET_KEY>/<OBJECT_KEY_4_MAXSCRIPT_FILE>",
"verb":"get",
"headers":{
"Authorization":"Bearer <YOUR_ACCESS_TOKEN>"
}
},
"OutputZip":{
"url":"urn:adsk.objects:os.object:<YOUR_BUCKET_KEY>/<OBJECT_KEY_4_OUTPUT_FILE>",
"verb":"put",
"headers":{
"Authorization":"Bearer <YOUR_ACCESS_TOKEN>"
}
}
}
}'
Notes:
activityIdis the fully qualified id to identify the Activity you created in Task 3. This id is created with 3 pieces as described here.- Replace the
pathInZipvalues inside theInputMaxSceneargument with the path to the 3ds Max scene file inside your zip file. If the 3ds Max file is at the root of your zip, simply specify the 3ds Max file name. - If you do not wish to use a zip file to hold the 3ds Max scene, but prefer to use the 3ds Max scene itself, provide the URN of the scene file directly and remove the
pathInZipattribute inside theInputMaxSceneargument.
Response
{
"status": "pending",
"stats": {
"timeQueued": "2023-10-05T03:54:15.0618534Z"
},
"id": "<YOUR_WORKITEM_ID>"
}
Notes:
- Jot down the
idin the response. This is the id that identifies your WorkItem. You will use this id in Task 6.
Additional notes
(Beta) Priority Pass is coming soon for 3ds Max during the public beta. Until then, a P1 request for 3ds Max is rejected with an error. To check whether it is available, call GET engines/:id and look for "priorityPass": true.
The optional WorkItem attribute priority places a WorkItem in a priority queue. Priority affects the position of the WorkItem in the queue; it is not a commitment on queue time, processing time or completion time. During the beta, each client ID can have one P1 WorkItem. A second P1 request is rejected with an error that includes the reason.
Process a priority WorkItem
To use a priority queue, add "priority": "P1" to the WorkItem payload. Supported values are P1 and P3, case-insensitive. P3 is equivalent to leaving it out.
{
"activityId": "<YOUR_NICKNAME>.ExecuteMaxscript+tutorial",
"arguments": { ... },
"priority": "P1"
}
For when to use Priority Pass, the beta limits and the beta terms, see High Memory, GPU and Priority Pass (Beta). Send feedback and questions about the beta at feedback.autodesk.com/flexiblecompute.