简体   繁体   中英

How to change the name of the input and output file dynamically in workitem method in design automation api for Revit

I am working on a project where I need to generate output Revit file based on the input json file in the Design automation API for Revit.
Since my input json string was large, I create a json file example "InputFile.json" and upload it to the cloud and pass the signed url to it to the work item and activity as input parameter, the generated output is a zip file example "OutputFile.zip" which is again uploaded to the cloud using the signed url. My project works properly using this process.

But since the name used for the input and output files are fixed, I am facing issue when I send continuous request, I get mismatched output.

Activity request
..
"parameters": {
      "Inputs": {
        "zip": false,
        "ondemand": false,
        "verb": "get",
        "description": "Element parameters",
        "required": true,
        "localName": "InputFile.json"
      },
      "Result": {
        "zip": true,
        "ondemand": false,
        "verb": "put",
        "description": "new created element",
        "required": true,
        "localName": "OutputFile"
      }
    },
...

and the WorkItem request

...
"arguments":{
        "Inputs":{
            "url":"https://storage.googleapis.com/XXXXXXX/InputFile.json?XXXXXXXXXXXXXXXsigned-url"
            },

        "Result":{
            "verb":"put",
            "url":"https://storage.googleapis.com/XXXXXXX/OutputFile.zip?XXXXXXXXXXXXXXXsigned-url",
...

How can I pass dynamically generated names like "InputFile_[DATE].json" and "OutputFile_[DATE].zip"?

Thanks in advance

Regards

You should be able to replace the localName value when submitting the workitem by adding the "localName" attribute to your argument. Example:

"arguments":{
        "Inputs":{
            "url":"https://storage.googleapis.com/XXXXXXX/InputFile.json?XXXXXXXXXXXXXXXsigned-url"
            },

        "Result":{
            "verb":"put",
            "url":"https://storage.googleapis.com/XXXXXXX/OutputFile.zip?XXXXXXXXXXXXXXXsigned-url",
            "localName": "myOutputFileName"
        }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM