Looking at the documentation at the Autodesk Forge site, I noticed I can provide JSON information to a Design Automation Activity. My question is: how would I reference the JSON information in a bundled AutoCAD application. Is there a filename reference in the shown -curl example I'm not seeing or understand? What am I not getting?
Asked
Active
Viewed 581 times
2 Answers
1
Found my answer: Below is the example in the documentation:
curl -X POST \
https://developer.api.autodesk.com/da/us-east/v3/workitems \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-d '{
"activityId": "YOUR_NICKNAME.CountItActivity+test",
"arguments": {
"rvtFile": {
"url": "https://s3.amazonaws.com/revitio-dev/test-data/CountIt.rvt"
},
"countItParams": {
"url": "data:application/json,{'walls': false, 'floors': true, 'doors': true, 'windows': true}"
},
"result": {
"verb": "put",
"url": "SIGNED_URL_TO_RESULT"
}
}
}'
countItParams is the name of the created .json file and is placed in the same folder as the input files. https://github.com/Autodesk-Forge/design.automation-csharp-revit.local.debug.tool
You can later access the file in your bundled application by referencing the current directory.
Sorry about answering my own question. I feel like I'm cheating. lol

Charles Dodson
- 27
- 6
-
`"countItParams": { "url": "data:application/json,{'walls': false, 'floors': true, 'doors': true, 'windows': true}" }` This is only recommend if you have less number of parameters, if the JSON parameter are more, you need put the JSON file in a storage box and provide its url like any other input object, to avoid `HTTP 413 Payload Too Large` – Madhukar Moogala Jun 09 '20 at 16:38
-
First things, first. How I do structure this as a new parameter argument in C#? – Charles Dodson Jun 09 '20 at 18:07
-
Correction: This doesn't go in the Activity, it goes in the workitem. { "inputJson", new XrefTreeArgument() {Verb= Verb.Put, LocalName = "parameters.json", Url = "data:application/json,{'ProtoCycle':" + protocycle} } where protocycle is an argument to my method. Does this look correct? – Charles Dodson Jun 09 '20 at 18:32
-
*exhale* So, there has to be a matching dictionary parameter in the Activity: Does this look right? { "inputJson", new Parameter() { LocalName = "parameters.json", Required = true} }. Is there a Verb I should use? The WorkItem looks like this: { "inputJson", new XrefTreeArgument() { LocalName = "parameters.json", Url = "data:application/json,{'ProtoCycle':" + protocycle} }. Once again, I removed the verb. – Charles Dodson Jun 09 '20 at 18:41
-
Hi, First ,you need to create a compatible class structure in your C# refer https://github.com/KeanW/Jigsawify/blob/43c8ddabb75f1f2a8b1649c3552584b25c932594/management/ClientV3/App.cs#L31, second, you need to pass it as serializedJson, refer https://github.com/KeanW/Jigsawify/blob/43c8ddabb75f1f2a8b1649c3552584b25c932594/management/ClientV3/App.cs#L146, the verb should `get`, or leave it blank, by default it assumes `get` – Madhukar Moogala Jun 10 '20 at 10:10
-
Thank you Mr. Moogala. Looking at my log file, that seems to have done the trick. One last question, if I may: Am I the only that's disappointed in the documentation. I see it getting better from V1 to V2 to V3, but still...... – Charles Dodson Jun 10 '20 at 13:48
-
Sorry!, please do ask as many as questions as possible, however we are trying our best to update documentation. – Madhukar Moogala Jun 10 '20 at 17:09
-
So, here's my followup, starting with my Activity: { "inputJson", new Parameter() { Verb= Verb.Get, LocalName = "parameters.json", Required = true} }. Here's my WorkItem: { "inputJson", new XrefTreeArgument() { LocalName = "parameters.json", Url = $"data:application/json,{JsonConvert.SerializeObject(new Parameters{ PDFProtoCycle = protocycle})}"} }. And here's my class I'm serializing against:public class Parameters { public string PDFProtoCycle { get; set; } } – Charles Dodson Jun 11 '20 at 21:42
0
You reference JSON like any other input: by its filename. The server will download your json the same way it downloads DWG/RVT etc. The file will be located in the working directory of the worker process.

Albert Szilvasy
- 461
- 3
- 5
-
Well, I assumed that, but I didn't recognize what the actual filename was. – Charles Dodson Jun 09 '20 at 16:30