autodesk-designautomation

Example for payload in the APS WorkItem using Revit Automation


I am trying to find an example of how to send a heavy json file as a payload in the workitem of the APS API. And also how can I retreive such json in the automation side in C#.

Thanks in advance.

I have been trying to use the information provided in the APS tutorials but can really understand.


Solution

  • There are limits to how many characters you can include in a a workitem payload. These are mentioned here as 16 kb. If your workitem payload is under that limit after embedding the json contents, you are free to include it like so:

    "countItParams": {
        "url": "data:application/json,{'walls': false, 'floors': true, 'doors': true, 'windows': true}"
    },
    

    For larger json files that cause the payload to go over limit (or even otherwise), we recommend uploading the json contents to a cloud storage and pass a signed url in the workitem payload, like so:

    "countItParams": {
        "url": "https://your-storage-server/signed-url/path.json"
    },
    
    

    This is similar to what you do for sending a Revit or any non json / text input. In both the examples above Design Automation will download and save the contents in a file on disk at the location specified by the localName field in the activity definition:

    "countItParams": {
        "verb": "get",
        "localName": "CountItParams.json"
    },