How can I change the BOM behavior of an assembly through the API?

I have a lot of drawings from my top assembly, I am kind of new to this API thing.
I would like to get a list of assemblies from the top assembly, use that list to go to the respective studios,
and then change the BOM behavior to Components only.

Is there a way that i can do this with the API? 
I took a look  through glassworks but i admit that i don't understand much of it.
Tagged:

Answers

  • caden_armstrong2
    caden_armstrong2 Member, User Group Leader Posts: 121 ✭✭✭
    You can get the current assembly using the endpoint


    /assemblies/d/{did}/{wvm}/{wvmid}/e/{eid}


    In the assembly definition, the field "subassemblies" gives a list of each subassembly.
    Each subassembly has a documentId, documentVersion, and elementId.
    These three fields will locate the assembly studio of each subassembly.

    You can then use the endpoint

    /metadata/d/{did}/wvm}/{wvmid}/e/{eid}

    to update the metadata property for subassembly bom behaviour.

    With a body similar to (replace href with your document href):

    {
       "items":[
          {
             "properties":[
                {
                   "value":"2",
                   "propertyId":"57f3fb8efa3416c06701d633"
                }
             ]
          }
       ]
    }

    Luckily, this field is editable in versions, so you can update the field without having to find the workspace and create a new version.
    The values are 0,1,2, where 0 is assembly and components, 1 is assembly, 2 is components.