Insomnia.REST workflow to create App, define activity, and call the WorkItem.
Before start with Design Automaiton workflow, I strongly recommend you to read throught all the details at
Design Automation for Revit Documenation, and check the following steps if you already have basic understanding.
-
Download or update Insomnia.REST from here.
-
Create a Forge App. If you have already created a Forge App then you can skip this and proceed to the next step.
-
From your local clone of the repository, import our
Insomnia data
Sketchit-App_Insomnia into the Insomnia REST application. You can find more details about it here
- After the import to Insomnia, we can see there is a predefined Enviorment called SketchIt-RevitIO-Env which will need your input for the variable values (client ID, client Secret...) This will make the process smoother and faster to use. You can find more details about it here
-
Select the environment and enter your Forge App's
Client ID
andClient Secret
. This is used for authentication. In the environment variables give your app an easy to manage unique nickname. -
Compile and package the sample applications as noted here. You will need this to upload the app to Design Automation. Alternatively you may also download the packages from SketchIt.zip.
-
Create a nickname for your Forge App.
-
Publish your Design Automation appbundle.
Create an appbundle
zip package from the build outputs and publish the appbundle
to Design Automation.
The JSON
in your appbundle POST should look like this:
{
"id": "SketchItApp",
"engine": "Autodesk.Revit+2019",
"description": "SketchIt appbundle based on Revit 2019"
}
Notes:
engine
=Autodesk.Revit+2019
- A list of engine versions can be found here.
After you upload the appbundle
zip package, you should create an alias for this appbundle. The JSON
in the POST should look like this:
{
"version": 1,
"id": "test"
}
The instructions for these steps and more about
appbundle
are here.
- Publish your Design Automation activity.
Define an activity
to run against the appbundle
.
The JSON
that accompanies the activity
POST will look like this:
{
"id": "SketchItActivity",
"commandLine": [ "$(engine.path)\\\\revitcoreconsole.exe /al $(appbundles[SketchItApp].path)" ],
"parameters": {
"sketchItInput": {
"zip": false,
"ondemand": false,
"verb": "get",
"description": "SketchIt input parameters",
"required": true,
"localName": "SketchItInput.json"
},
"result": {
"zip": false,
"ondemand": false,
"verb": "put",
"description": "Results",
"required": true,
"localName": "sketchIt.rvt"
}
},
"engine": "Autodesk.Revit+2019",
"appbundles": [ "YourNickname.SketchItApp+test" ],
"description": "Creates walls and floors from an input JSON file."
}
Notes:
engine
=Autodesk.Revit+2019
- A list of engine versions can be found here.YourNickname
- The owner of appbundleSketchItApp
. More information can be found here.
Then you should create an alias for this activity. The JSON
in the POST should look like this:
{
"version": 1,
"id": "test"
}
The instructions for these steps and more about
activity
are here.
-
Prepare your input and output url.
-
Post your Design Automation workitem.
Now POST a workitem
against the activity
to run a job on your appbundle
.
The JSON
that accompanies the workitem
POST will look like this:
{
"activityId": "YourNickname.SketchItActivity+test",
"arguments": {
"sketchItInput": {
"url": "data:application/json,{ 'walls': [ {'start': { 'x': -100, 'y': 100, 'z': 0.0}, 'end': { 'x': 100, 'y': 100, 'z': 0.0}}, {'start': { 'x': -100, 'y': 100, 'z': 0.0}, 'end': { 'x': 100, 'y': 100, 'z': 0.0}}, {'start': { 'x': 100, 'y': 100, 'z': 0.0}, 'end': { 'x': 100, 'y': -100, 'z': 0.0}}, {'start': { 'x': 100, 'y': -100, 'z': 0.0}, 'end': { 'x': -100, 'y': -100, 'z': 0.0}}, {'start': { 'x': -100, 'y': -100, 'z': 0.0}, 'end': { 'x': -100, 'y': 100, 'z': 0.0}}, {'start': { 'x': -500, 'y': -300, 'z': 0.0}, 'end': { 'x': -300, 'y': -300, 'z': 0.0}}, {'start': { 'x': -300, 'y': -300, 'z': 0.0}, 'end': { 'x': -300, 'y': -500, 'z': 0.0}}, {'start': { 'x': -300, 'y': -500, 'z': 0.0}, 'end': { 'x': -500, 'y': -500, 'z': 0.0}}, {'start': { 'x': -500, 'y': -500, 'z': 0.0}, 'end': { 'x': -500, 'y': -300, 'z': 0.0}}],'floors' : [ [{'x': -100, 'y': 100, 'z':0.0}, {'x': 100, 'y': 100, 'z': 0.0}, {'x': 100, 'y': -100, 'z': 0.0}, {'x': -100, 'y': -100, 'z': 0.0}], [{'x': -500, 'y': -300, 'z':0.0}, {'x': -300, 'y': -300, 'z': 0.0}, {'x': -300, 'y': -500, 'z': 0.0}, {'x': -500, 'y': -500, 'z': 0.0}] ]}"
},
"result": {
"verb": "put",
"url": "https://myWebsite/signed/url/to/sketchIt.rvt"
}
}
}
Notes:
YourNickname
- The owner of activitySketchItActivity
. More information can be found here.
The instructions for this step and more about
workitem
are here.
These Insomnia samples will allow you to easily issue REST API calls without using cumbersome cURL commands.
Note that you will have to carefully read through the requests - DELETE
-ing an app
or activity
will delete all its associated versions!
Note that for all workitems
kindly provide signed URL for the expected output file. Else the workitem
post will result with failedUpload
.
REST API documentation on Design Automation V3 can be found here.