not getting usable json from https://developer.api.autodesk.com/tandem/v1/groups/{groupID}/twins api call

not getting usable json from https://developer.api.autodesk.com/tandem/v1/groups/{groupID}/twins api call

JM_K
Advocate Advocate
867 Views
2 Replies
Message 1 of 3

not getting usable json from https://developer.api.autodesk.com/tandem/v1/groups/{groupID}/twins api call

JM_K
Advocate
Advocate

Hello,

I'm trying use the get Twins from GroupID call. When I use this in ACC Connect, there are no usable datapills that I can create a list of Twin Names, TwinIDs and Twin Regions from. This is caused by the fact that those fields are presented as wildcards. 

{ "name": "XXXXXX", "urn": "urn:adsk.dtg:9xxxxxXXXXxXxX3X51xXXx", "owner": "XXXXXF7X3XXX", "accessLevel": "Owner", "twins": { "urn:adsk.dtt:XxXXxxXXXxx-TgImX3WBxx": "Owner", "urn:adsk.dtt:XxxXXX1XXXXx-xXX5XxX2X": "Owner", "urn:adsk.dtt:_Xxx7XX5X9xXXxXxxx8XXx": "Owner" }, "twinRegions": { "urn:adsk.dtt:XxXXxxxXXxx-XxXxX3XXxx": "us", "urn:adsk.dtt:XxxXXX1XXXXx-xXX5XxX2X": "us", "urn:adsk.dtt:_Xxx7XX5X9xXXxYxxx8ZXx": "us" },

- ACC Connect cannot get the necessary datapills out of this. I have tried parsing the JSON and using Ruby code to convert the elements but to no avail. This same thing also happens in the other API Calls that list Twins. Is there any solution that can offered here that utilises parsing, ruby or formulas to extract the arrays of Twin Regions, Twins Names and Twin IDs in a usable array? 

 

Thanks in advance, Mark

Insert witty comment here.
0 Likes
Accepted solutions (1)
868 Views
2 Replies
Replies (2)
Message 2 of 3

jan.liska
Autodesk
Autodesk

Hello, the API returns dictionary where key is is facility id and value are facility details. To get name of the facility use props["Identity Data"]["Building Name"]. You can find JavaScript example here.

Looking on the example of your payload it seems you're using GET groups/:groupId rather than GET groups/:groupID/twins which includes facility details.

In the context of ACC Connect - I used Python code action to parse result into array of data (id, name, region) - see attachments.


Jan Liska
Developer Advocate, Autodesk Tandem

0 Likes
Message 3 of 3

JM_K
Advocate
Advocate
Accepted solution

I ended up using a ruby script

Insert witty comment here.