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.

Onshape API: How to get the source Part (Part ID like #JFD) of a Derived part?

FladdieFladdie Member Posts: 8

Hi all,
I’m trying to determine—via API—from which exact source Part a given Derived part was created. Concretely, I want the short Part ID from the source Part Studio (e.g., #JFD), not just the document/element pointers.

What I’ve checked so far

  • I can read the target Part Studio’s feature list (GET /partstudios/d/{did}/{wvm}/{wvmid}/e/{eid}/features) and find the derive feature.

What I’m missing

I don’t see a reliable, documented way to map the derive selection back to the exact source Part ID (the short ID like #JFD) programmatically. The derive feature parameters show the selection, but I haven’t found a stable key that resolves directly to the source part’s short ID.

Questions

  1. Is there a supported API pattern to resolve a derived part’s provenance to the exact source Part ID (e.g., #JFD)?
  2. If yes, which fields in the derive feature response should be used to match the selection to a specific source part?
  3. If the short Part ID isn’t exposed, is there another stable identifier I should use instead for cross-document provenance?

I’m hoping there’s a documented way to correlate the derive selection to one of the parts returned above and extract that part’s short ID.

Thanks!
Eric

Tagged:

Best Answer

  • Caden_ArmstrongCaden_Armstrong Member Posts: 321 PRO
    Answer ✓

    You can get the source part id from the /partstudios/…./features endpoint.

    The parameter "partStudio" → partQuery → Queries → geometry IDs

    The caveat is that it also depends on what version of the api endpoint you use.

    for example:
    doing /api/v12/partstudios/…/features won't give it to you (Gives a compressed query)
    but /api/v1/partstudios/…/features will give it to you (gives a list of geometry ids).
    Some API versions are slightly different in what information they give you. Sometimes you need to try a couple different ones to find the one that works for your specific needs.

    image.png
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications

Answers

  • Caden_ArmstrongCaden_Armstrong Member Posts: 321 PRO
    Answer ✓

    You can get the source part id from the /partstudios/…./features endpoint.

    The parameter "partStudio" → partQuery → Queries → geometry IDs

    The caveat is that it also depends on what version of the api endpoint you use.

    for example:
    doing /api/v12/partstudios/…/features won't give it to you (Gives a compressed query)
    but /api/v1/partstudios/…/features will give it to you (gives a list of geometry ids).
    Some API versions are slightly different in what information they give you. Sometimes you need to try a couple different ones to find the one that works for your specific needs.

    image.png
    www.smartbenchsoftware.com --- fs.place --- Renaissance
    Custom FeatureScript and Onshape Integrated Applications
  • FladdieFladdie Member Posts: 8

    Follow-up / Additional question:

    In some cases, inside the partQuery → queries section, I can see a field called deterministicIds that gives me the short Part ID (e.g. JHD). But in other cases (other part studios), with the exact same API call, the field is missing. Instead, I only get the queryString.

    I’ve attached screenshots here showing the difference:

    • Screenshot 1: no deterministicIds field present
    • Screenshot 2: deterministicIds is present with the expected Part ID

    👉 My question: Why does deterministicIds appear sometimes, but not always?
    Is this related to how the derive selection was created (e.g., “All bodies” vs. explicit part selection), or whether the source Part Studio is referenced from a workspace vs. a version/microversion?

    Any guidance on how to consistently obtain the Part ID from the API would be much appreciated.

    image.png image.png
  • FladdieFladdie Member Posts: 8

    @Caden_Armstrong you just saved my day (and my weekend) — thank you! I totally didn’t think to try the v1 vs v12 endpoints. Switching to /api/v1/partstudios/.../features gives me the geometryIds exactly as you showed; /api/v12/... returns the compressed query.

    Quick follow-up: is there any way to make the Glassworks API Explorer issue v1 calls (or switch API versions), or do I need to hit the REST endpoints directly outside of Glassworks? Any hidden toggle or URL param I’m missing?

Sign In or Register to comment.