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.
WHERE USED
shawn_crocker
Member, OS Professional Posts: 861 PRO
I have tried using this feature on and off since it was release to professional accounts. I have never really felt I was actually getting accurate results from it. I very often get a report that the released item is not included anywhere even though I know it is included in a drawing. Is it possible the where used command is still in "beta" mode or something, or am I possible just an idiot and not understanding how to use it. I do a search, select the release from the results and then select where used from the side panel. Most of the time the results are empty or not used anywhere.
As a little extra question, can we access where used from the api? I'm thinking not as I am not seeing anything about it in glassworks. It would be really useful if we could. Having an app pull out a release and also show a list of all the drawings that have been made that include the release would be very powerful.
As a little extra question, can we access where used from the api? I'm thinking not as I am not seeing anything about it in glassworks. It would be really useful if we could. Having an app pull out a release and also show a list of all the drawings that have been made that include the release would be very powerful.
Tagged:
1
Best Answer
-
caden_armstrong2 Member, User Group Leader Posts: 127 ✭✭✭@dsteinegger
Where used can be done via the api with:
GET /api/productstructure/whereused?configuration=...&documentId=...&elementId=....&workspaceId=...
Theres some other parameters that can be included in the url such as:
partId
partNumber
useLatest
includeProperties
includeVersionInfo
and probably more that I havent figured out yet.3
Answers
I don't know, I could be way off, thought.
Have you found a way to get a "where used" functionality with the API?
I'm also looking for something :-)
Where used can be done via the api with:
GET /api/productstructure/whereused?configuration=...&documentId=...&elementId=....&workspaceId=...
Theres some other parameters that can be included in the url such as:
partId
partNumber
useLatest
includeProperties
includeVersionInfo
and probably more that I havent figured out yet.
If its not in the official documentation then technically it isn't supported. There is a chance that Onshape could change (or even remove) that endpoint, its also possible that it won't always work as expected. Use it with caution, and don't build any critical apps that rely on it.
Have you found a way to do a Where Used without specifying a specific configuration using the API? Almost like a Where Used for a workspace/version id instead of per part. I guess if that endpoint doesn't exist it wouldn't be hard to just loop through all documents in an Enterprise and check import statements but I wonder if there's a better way.
chadstoltzfus@premiercb.com
I am just now, starting to test out how I will use (or is I even can use) the end point noted by @caden_armstrong. Based on your question, I am unsure of your level of understanding of how the API system functions. Incase you are not aware, you use something to send a request in the form of a URL to a server. The server usually sends back information in the form of JSON. You then take that received data and usually reformat it to your liking using some type of scripting language (JavaScript) so that you can present the received data exactly how you want inside of the application you are building. For my use, I am planning on having a BOM that allows clicking a button that opens up a modal and displays a list of all drawings that have been made of that BOM item. Clicking on the item in the list will directly open up the drawing. In this way I feel it will be easier to have production stations more directly driven off of the onshape bom with out people having to do too much searching and printing onto paper.
I sent this out within the same scope and authorizations that are currently setup and working for all my other onshape API interactions which are working.
@caden_armstrong Are you able to offer any insights? Am I understanding your comment correctly in terms of structuring the end point?
In your experience, has this worked with the workspace id? I thought where used only worked at the version level? I'm sort of confused about the partNumber parameter and why I would supply it if the required parameters already fully define what the part number and revision would be.
I have used this. https://cad.onshape.com/api/v5/productstructure/whereused?documentId=5a36e3321c7fa3cc05839659&versionId=f4f5b67beb8ea75b38c948cd&elementId=438bd35730e2b15225e3d60a&partId=RxCD
and received.
I dug a little more,
and it looks like "includeProperties=true" is also required to get the information you need.
So you need:
version id
document id
element id
part id
includeProperties=true
The error you're seeing is because you aren't authenticated.
https://cad.onshape.com/api/v5/productstructure/whereused/d/5a36e3321c7fa3cc05839659/v/f4f5b67beb8ea75b38c948cd/e/438bd35730e2b15225e3d60a/p/RxCD?includeProperties=true
I'm getting the same error message coming back. ? You mentioned you did some digging. Can you share where are you digging for this info?
edit:
actually I'm wrong. I get a 404 response not found when I restructure like this.