Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Create and transform assembly instances: endpoint

connor_holjesconnor_holjes Member Posts: 9 PRO
getting this response when hitting the 'Create and transform assembly instances' endpoint.

u 'status': 400,
u 'message': u 'Linked document references require a version identifier',
u 'code': 9999,
u 'moreInfoUrl': u ''

is this the microversion key that is available in the request body?
and is it saying that it wants the microversion id of the linked document's partstudio I am pulling from?

or is it something in the url parameters...


  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,372 PRO
    Are you using the API ? which API : I don't know answer;

    In the makeup of assemblies, the instances need to know where to go and have transformations describing where they belong. Seems like this is where you're at. 

    When dealing with linked documents, the 'w' changes to a 'v'.

    I'm hoping this is an API question otherwise nothing I've said will matter.

  • connor_holjesconnor_holjes Member Posts: 9 PRO
    edited May 2018
    Yeah one of the assembly API endpoints. I have done a test on a non-linked document and everything is working. Transformations etc. But I need to pull partstudio configurations from one document to another. It seems like your answer is in the right area, but can you be more specific? Are you suggesting to change the 'w' to a 'v' in the url parameters?

    it was my understanding that:
    the url params for this endpoint are the TARGET document > workspace > element(assembly)
    the payload for the request is the (these are the options i am using now):
        transformGroups: [{
                 "instances": [{
                        "microversionId": "",
                        "configuration": "",
                        "elementId": "",
                        "documentId": "",
                        "isWholePartStudio": true
                  "transform": []
        microversionId: ''
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,372 PRO
    edited May 2018
    Not sure about the transformations, not working on them. But to access a linked document in an assembly, I'm using 


    This returns the information about the part being used in the assembly which is versioned. 

    Not sure if this is a solution for you.

    I don't remember where I got V from, but it might be in the same rest call you got the workspace (w) from.

    If you wish, I'll look up in my code and see where I get it from.

  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,372 PRO
    edited May 2018
    So thinking about this on my way into work:

    You will have the same problem I had when accessing a linked document.

    So let me setup the problem:
    -You're in a document and you're querying an assembly 
    -You have a list of stuff in this assembly from your query
    -One of these items has a 'documentVersion' property set and now you want to access it's details
    -If 'documentVersion' property is set, then you know it's a link document
    -In your case, it's an assembly in a linked document
    -You want those assembly details in a linked document
    -Since you're in an assembly and want details of an assembly in another document, it's a 'v' not 'w'
    -/assemblies/d/:did/v/:vid/e/:eid/transformedinstances should work to get linked document assembly element details

    So what you know is that because it has a 'documentVersion', this element is in another document making it a linked document. To access this document, use /assemblies/d/:did/v/:vid/e/:eid/transformedinstances. This will return the details for the assembly in another document which is stored in a version. When accessing a linked document, workspaces aren't available, you have to use a version which is the 'documentVersion' property.

    In my case, I try and change the versioned part which is not possible and the best I can do is show a message that this document can't be changed. I'm looking at ways to switch to a workspace, and save an updated version. Then in the assembly, I need to update the assembly version link. I haven't had the chance to implement this. 

    I haven't tested your case, but I believe this will work for you, let me know.

  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,372 PRO
    reread your post and you're trying to get to the partstudio. This is what I do. Change the 'w' to 'v' and it'll work.

    'v' is the 'documentVersion' property. When it's there, switch to 'v' vs. 'w'.

  • connor_holjesconnor_holjes Member Posts: 9 PRO
    Maybe I should frame the entire setup:

    1. I have a document "source" with a partstudio.

    2. I use the documents api to create a new document "target" and a new assembly inside the target document.

    3. I want to use the transform assembly instances to...

    (THIS FAILS) take the source document's partstudio and add that to the target document's assembly 

    (THIS WORKS) take the source document's partstudio and add that to the same document's assembly

    the one that fails gives me the linked document error which makes sense, but I am not sure where that version goes.

    ***it doesn't make sense that I would have to change the url parameters b/c those point to the target in the instance that works so I am assuming the same is true for the linked scenario
  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,506

    If you go into the Onshape UI rather than the API, you'll notice that you can only 'link' to a version of a document.  You cannot link to a workspace at all.  In other words, if you have a part studio in document A, and an assembly in document B, when you attempt to insert a part from A into B, you must pick the version of A that you wish to insert (or create a new version from the dialog).

    As an example, here is what the dialog looks like if I try to insert something from a different document that has not been versioned yet:

    This is why the parameters are different when you are inserting from a linked document rather than from the same document.  In the same document, you can insert a part from a workspace (w), whereas when inserting from a different document, you must insert from a version (v).  This requirement is present across the entire product, not just from the API
    Jake Rosenfeld - Modeling Team
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 1,372 PRO

    interesting concept creating an assembly from a part studio.

    -You may want to keep the new assembly & the part studio in the same document at first to avoid versioning
    -In the part studio, how do you know where the origins are for each part? How will you compose transformations for assy?
    -Just looked it up, you can create a document version with API which means we could handle versions in linked documents
    -I think you could make your app work
    -I've noticed in the history that when I update a part with the API, the history has 'updated with api'.
    -Thinking if I create a version for linked documents, people won't object due to the easy functionality, I'll name version 'created by billy'.
    -How'd you figure out the API?

  • mark_noyesmark_noyes Member, Onshape Employees, Developers Posts: 21
    The API documentation is missing documentation for the versionId field as an alternative to 

    transformGroups.0.instances.0.microversionId. When the documentId of the instance differs from the documentId of the assembly you must use versionId instead of microversionId. The versionId field is similarly omitted in the Create assembly instance API documentation. This omission will be corrected soon.

Sign In or Register to comment.