Task 3 – Upload an AppBundle to Design Automation
An AppBundle is a zipped folder containing the output files generated by Visual Studio when you build an Inventor add-in. The files are saved to a specific structure, and are accompanied by a file named PackageContents.xml, which describes the content of the folder.
An add-in uses the Inventor API to add new functionality to Inventor in the form of custom commands.
For information on how to create an Inventor add-in, see:
For information on creating a Design Automation-ready Inventor add-in, see:
- A Simple Introduction to Design Automation for Inventor
- Bring Your Inventor Add-in into Design Automation
By the end of this task you will be able to:
- Describe what an AppBundle is.
- Explain the role of PackageContents.xml and .addin files
- Upload an AppBundle to Design Automation.
- Create an alias for a version of the AppBundle.
You will use the following operations to handle AppBundles in this task:
HTTP Request | Description |
---|---|
POST /appbundles | Registers a new AppBundle. |
POST /appbundles/{id}/aliases | Creates a new alias for the AppBundle. |
POST /appbundles/{id}/versions | Creates a new version of the AppBundle. |
PATCH /appbundles/{id}/aliases/{aliasId} | Modify alias details. |
- More information on AppBundles can be found here.
Step 1 - Download or build an Inventor AppBundle
- Download the AppBunde, samplePlugin.bundle.zip from here.
Alternatively, you can use the SamplePlugin C# project from this Git repository to build both the Inventor add-in and AppBundle.
Step 2 - Understand the Structure of the AppBundle
An Inventor AppBundle is a zipped package of binaries and supporting files stored according to a specific structure. The following code block shows the structure of the AppBundle samplePlugin.zip, which you downloaded in Step 1.
samplePlugin.bundle.zip
|-- samplePlugin.bundle
| |-- PackageContents.xml
| |-- Contents
| | |-- samplePlugin.dll
| | |-- samplePlugin.pdb
| | |-- samplePlugin.Inventor.addin
| | |-- Newtonsoft.Json.dll
| | |-- Newtonsoft.Json.xml
File | Description |
---|---|
PackageContents.xml | Contains a description of the add-in, including the GUIDs and relative path to the add-in. For more information on PackageContents.xml, see PackageContents.xml Format Reference |
samplePlugin.dll | The Inventor add-in file. |
samplePlugin.pdb | Contains information for debugging. |
samplePlugin.Inventor.addin | A file generated by the build process. Contains information required by Inventor to load the add-in. |
Newtonsoft.Json.dll | A file referenced by the C# project that built the add-in. It enables the add-in to capture user input by way of a JSON file. You will use this capability in Task 6 of this walkthrough to specify the new height and width to resize the input Inventor part or assembly. |
Newtonsoft.Json.xml | A supporting file required by Newtonsoft.Json.dll, |
Step 3 - Register the AppBundle
Before you upload the AppBundle to Design Automation, you must register the AppBundle.
- Register an AppBundle named
ChangeParamApp
as per the following example. It uses Inventor 2020 as the target engine:
Request
curl -X POST \
'https://developer.api.autodesk.com/da/us-east/v3/appbundles' \
-H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"id": "ChangeParamApp",
"engine": "Autodesk.Inventor+2024",
"description": "Change Parameters AppBundle based on Inventor 2024"
}'
Response
{
"uploadParameters": {
"endpointURL": "https://dasprod-store.s3.amazonaws.com",
"formData": {
"key": "apps/<YOUR_APP_NICKNAME>/ChangeParamApp/1",
"content-type": "application/octet-stream",
"policy": "eyJleHBpcmF0aW9uIjo... (truncated)",
"success_action_status": "200",
"success_action_redirect": "",
"x-amz-signature": "27e07941f952... (truncated)",
"x-amz-credential": "ASIATGVJZKM3N... (truncated)",
"x-amz-algorithm": "AWS4-HMAC-SHA256",
"x-amz-date": "20191128T083159Z",
"x-amz-server-side-encryption": "AES256",
"x-amz-security-token": "IQoJb3JpZ2luX2VjEGgaC... (truncated)"
}
},
"id": "<YOUR_APP_NICKNAME>.ChangeParamApp",
"engine": "Autodesk.Inventor+2024",
"description": "Change Parameters AppBundle based on Inventor 2024",
"version": 1
}
Attribute | Description |
---|---|
endpointURL |
The URL you must upload the AppBundle zip file to. |
version |
The version number of the AppBundle created by the POST request. For new AppBundles, the returned version is always 1 . |
formData |
The form data that must accompany the AppBundle when you upload it to endpointURL. formData expires in 3600 seconds. |
Step 4 - Upload the AppBundle
Upload the AppBundle to the signed URL returned by endpointURL
in the previous step.
curl -X POST \
'https://dasprod-store.s3.amazonaws.com' \
-H 'Cache-Control: no-cache' \
-F key=apps/da4invent_app/ChangeParamApp/1 \
-F content-type=application/octet-stream \
-F policy=eyJleHBpcmF0aW9uIjoi... (truncated) \
-F success_action_status=200 \
-F x-amz-signature=27e07941f952d73d57eca... (truncated) \
-F x-amz-credential=ASIATGVJZKM3NNGDUZMR/20191128/us-east-1/s3/aws4_request/ \
-F x-amz-algorithm=AWS4-HMAC-SHA256 \
-F x-amz-date=20191128T083159Z \
-F x-amz-server-side-encryption=AES256 \
-F 'x-amz-security-token=IQoJb3JpZ2luX2VjEGgaCXVzLWVhc3QtMSJ... (truncated) ' \
-F success_action_redirect= \
-F file= @path/to/your/AppBundle/samplePlugin.bundle.zip
Note: Ensure that all the form-data from the Register AppBundle response is included in your request.
Step 5 - Create an alias for the AppBundle
When you registered the AppBundle in step 2, it was registered as version 1 of the AppBundle. In this step, you create an alias named my_working_version
to reference that version. You can think of the alias as a tag that points to a version of an AppBundle.
curl -X POST \
'https://developer.api.autodesk.com/da/us-east/v3/appbundles/ChangeParamApp/aliases' \
-H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"version": 1,
"id": "my_working_version"
}'
Note:
If you make changes to the AppBundle later, you must register it as a new version and then upload it. You can then update the alias to point to the newer version of the AppBundle. Consequently, endpoints referencing the AppBundle using the alias get access to the updated version of the AppBundle.
Additional notes
Notes on Engines
- Each AppBundle POST request specifies an
engine
on which the application runs. The following table shows the keywords to specify for the available Inventor engines. - The active engine version aliases are:
Engine | Description | JSON in AppBundle post |
---|---|---|
Autodesk.Inventor+23 |
Inventor 2019 | “engine”: “Autodesk.Inventor+23” |
Autodesk.Inventor+24 |
Inventor 2020 | “engine”: “Autodesk.Inventor+24” |
Autodesk.Inventor+2021 |
Inventor 2021 | “engine”: “Autodesk.Inventor+2021” |
Autodesk.Inventor+2022 |
Inventor 2022 | “engine”: “Autodesk.Inventor+2022” |
Autodesk.Inventor+2023 |
Inventor 2023 | “engine”: “Autodesk.Inventor+2023” |
Autodesk.Inventor+2024 |
Inventor 2024 | “engine”: “Autodesk.Inventor+2024” |
Notes:
- For the most current list of
engines
use the operation listed here. - If there is an error, refer the section on troubleshooting.
- The exact versions of the Inventor engines currently deployed are listed on the Inventor Release Notes page.