Hello I am struggling with finding a working example on how to convert a DWG file to a PDF file. I am using Autodesk Design Automation API and Dropbox. I try to use following command to place a WorkItem
{
"Arguments":{
"InputArguments":[
{
"Resource": "https://content.dropboxapi.com/2/files/download",
"Name": "HostDwg",
"Headers":[
{
"Name":"Authorization",
"Value":"Bearer xxxxxxxxxxxxxxxxxxxxxxxx"
},{
"Name":"Dropbox-API-Arg",
"Value" : {"path":"/original.dwg"}
}
]
}
],
"OutputArguments":[
{
"Name": "Result",
"HttpVerb": "PUT",
"Resource": "https://content.dropboxapi.com/2/files/upload",
"StorageProvider": "Generic",
"Headers":[
{
"Name":"Authorization",
"Value":"Bearer xxxxxxxxxxxxxx"
},{
"Name":"Dropbox-API-Arg",
"Value": {"path":"/test.pdf"}
}
]
}
]
}, "ActivityId": "PlotToPDF","Id": ""}
Unfortunately I get following Error message
An unexpected 'StartObject' node was found for property named 'Value' when reading from the JSON reader. A 'PrimitiveValue' node was expected.
I think it has to do with the second Header I have defined, to specify the file to be downloaded or uploaded. It is unclear to me how to set this value correct. If Iam using dropbox api without Design Automation API this is working. I can define a Header named Dropbox-API-Arg and define to download/upload path.
Any help would be appreciated. Thankyou
We have improved Design Automation so that now using Dropbox-API-Arg
header works both for upload and download. The following will convert a DWG to PDF in your dropbox account:
{
"Arguments": {
"InputArguments": [
{
"Resource": "https://content.dropboxapi.com/2/files/download",
"Name": "HostDwg",
"Headers" : [
{
"Name" : "Authorization",
"Value" : "Bearer ..."
},
{
"Name" : "Dropbox-API-Arg",
"Value" : "{\"path\":\"/test/test.dwg\"}"
}
]
}
],
"OutputArguments": [
{
"Name": "Result",
"HttpVerb": "POST",
"Resource": "https://content.dropboxapi.com/2/files/upload",
"Headers" : [
{
"Name" : "Authorization",
"Value" : "Bearer ..."
},
{
"Name" : "Content-Type",
"Value" : "application/octet-stream"
},
{
"Name" : "Dropbox-API-Arg",
"Value" : "{\"path\":\"/test/test.pdf\", \"mode\":\"add\"}"
}
]
}
]
},
"ActivityId": "PlotToPDF"
}