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.
Adding part to assembly via API

I am trying to add an assembly into another assembly via API. Trying out the REST call in glassworks i get an error saying i am using a microversion even though i am using a version:
This is the document I am pasting:
https://cad.onshape.com/documents/ba1fece8e8480bb1fa5c2089/v/6d2dabf62ee2588360f457fe/e/ab51836df1310fcc7922ea92
Response bodyDownload { "message": "Microversions may not be used with linked document references", "status": 400, "code": 9999, "moreInfoUrl": ""} |
---|
I also don't understand how that API call should work since it only specifies one part/assembly. Is it the target or the payload?
I also have tried the same in python wihtout success but thats a different topic. Lets get this glassworks example working first. Any pointers welcome, thank you!
Comments
It would help to know the body you are using for your request. Your body is probably the problem.
I know you can do it with just:
documentId
versionId
elementId
isWholePartStudio=false
isAssembly=true
configuration={config if applicable}
You might be adding extra parameters that you don't need to add. The API can be a bit fussy if you include unnecessary parameters
Custom FeatureScript and Onshape Integrated Applications
Ok, I didn't fill in anything besides the autofill option in the glassworks. Now it works with the additional payload parameters.
Not able to get the inserted assembly to appear at a different location though - I am using:
{
"documentId": "5ec100e212a5fab5ff355415",
"elementId": "883aca11d7be9449d88a79a6",
"includePartTypes": [
"PARTS"
],
"transform" : [
1, 0, 0, 0,
0, 0, -1, 0,
0, 1, 0, 1,
0, 0, 0, 1
],
"isAssembly": true,
"versionId": "5aa8b24aaac7e7881e21e1f2"
}
Any hints, should this work?
Thanks @Caden_Armstrong for the response, that helped. Just realizing that for a transform I probably have to use the occurrencetransforms.
Can you advise on how to use it, what do i need from the payload and how do i determine path?
{
"isRelative": true,
"occurrences": [
{
"fullPathAsString": "string",
"headInstanceId": "string",
"internalOccurrence": true,
"occurrenceWithoutHead": "string",
"occurrenceWithoutTail": "string",
"parent": "string",
"path": [
"string"
],
"rootOccurrence": true,
"tailInstanceId": "string"
}
],
"transform": [
0
]
}
you're better off using "transformedinstances", inserted with a specific transform.
If you insert and then transform it requires a bunch of extra API calls, where as the transformedinstances endpoint lets you do all your insertions/transforms in a single call. With Onshape's API limits that can make a big difference to your usage.
Custom FeatureScript and Onshape Integrated Applications
thanks!