Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
API get request: Get all Variables over all configurations
Hello i'm Daniel,
I want to use the API of Onsahpe to get all the variables of all configurations in a Part Studio. Actually, i was already able to do this with the following REST Api endpoints.
Step 1: First catch all the configurations in the partstudio
/elements/d/{did}/{wvm}/{wvmid}/e/{eid}/configuration
https://cad.onshape.com/glassworks/explorer#/Element/getConfiguration
Step 2: Create a for loop in python over all configuration and call the following API endpoint
/variables/d/{did}/{wv}/{wvid}/e/{eid}/variables
https://cad.onshape.com/glassworks/explorer#/Variables/getVariables
So far so good, but each call takes a wile and if you have some configurations the program runtime is too long. The second API endpoint does have the parameter "configuration" and the note next to it mentions that it is possible to request multiple configurations if you separate it with a semicolon. But I tried the following formats and I only get the values of the first configuration. Does someone know how to use this API correctly?
List_YMg2l8wT1PqIXY=Copy_of_TX018_012;Copy_of_TX018_018
List_YMg2l8wT1PqIXY=Copy_of_TX018_012;List_YMg2l8wT1PqIXY=Copy_of_TX018_018
The api can be used and tested via the following link:
https://cad.onshape.com/glassworks
Thanks for your help,
regards
Daniel
Answers
You can only do one configuration at a time with that endpoint.
The semi-colon separator is for studios with multiple configuration tables/variables, so it would be something like:
List_Table_A_ID=Value_1;List_Table_B_ID=Value_2;
I've built a few tools that do this or similar processes and if speed is really a concern, the best option I found was to parallelize the requests. Just keep in mind that the Onshape API has rate limits.
Custom FeatureScript and Onshape Integrated Applications
Thanks for your help! Now I know what the semicolon is for.
regards
Daniel