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.
Options
Performing a search query through the API

When I do this, I have been able to get this end point to work.
https://cad.onshape.com/api/v5/documents?nodeId=1&q=_all:P0803&resourceType=filter
This seems to search through all of onshape and not just in my company or "my onshape". Also, I cannot seem to get any other q parameters to work. I try using state, or when and I get no items returned. Is there a better endpoint to be using for this. I'm also finding that the returned items do not really contain useful information like id's to construct a url or a premade url. Anyone able to enlighten me on this. I am not seeing anything about this in the glassworks browser.
https://cad.onshape.com/api/v5/documents?nodeId=1&q=_all:P0803&resourceType=filter
This seems to search through all of onshape and not just in my company or "my onshape". Also, I cannot seem to get any other q parameters to work. I try using state, or when and I get no items returned. Is there a better endpoint to be using for this. I'm also finding that the returned items do not really contain useful information like id's to construct a url or a premade url. Anyone able to enlighten me on this. I am not seeing anything about this in the glassworks browser.
0
Best Answer
-
pmd Member, Developers Posts: 64 PRO
I looked at some python code I wrote a few years ago using the old (pre-v5) API and it did:dest = f"/api/documents?q={searchterm}&filter=7&owner={company_id}"
The old API Explorer explained that filter=7 meant restrict to company docs but the new glassworks browser does not seem to show this info.0
Answers
The old API Explorer explained that filter=7 meant restrict to company docs but the new glassworks browser does not seem to show this info.
I haven't had time yet to experiment but I am getting strong feelings "ownerId": "string", is where the companies ID is to go.
Hi Shawn,
let payload = { "documentFilter": 0, "foundIn": "ALL", "limit": 20, "offset": 0, "ownerId": {ownerId}, "parentId": "ALL", "rawQuery": {myRawQuery}, "sortColumn": "modifiedAt", "sortOrder": "desc", "type": "document", "when": "ALL"};
Do you happen to know how do I modify this payload so that the search is based only on a specific date range?
I did a bit of looking and I'm not certain this is possible. I do think it could be useful. Ask support if there might be some additional parameters that are not fully documented. I would probably just rely on my application logic to filter out what isn't needed. You can pull in 1000 items at a time which is a significant amount of results. The system does give a next code as well. You could run a little process that pulls a thousand results, then it filters for the items it needs and stores them to an array. Then it pulls and filters the next 1000 items and adds them into your storage variable. That's what I would do if I needed to process bulk amounts of search results between two modifiedOn dates. 😊
To filter by a specific date range, replace
"when": "ALL"
[URL=https://eldfall-chronicles.com/en-si/collections/wargame-miniatures]tabletop miniatures[/URL]@nick_brown567 So, what is being used as the value for the "when" key? My understanding was that "when" referred to version types. So you can use "all" and the search will look for results within all available document versions. If you use "latest" it will only look for result within the most recent document versions. I could be wrong.