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.
Document Labels via API
łukasz_klapiszewski
Member Posts: 12 ✭
Hi!
I'm trying to assign label to document using API. I've been searching for it on Glassworx documentation with no result.
I found only a way to fetch existing labels from this: https://ftconshape.com/using-the-onshape-client-api-with-go/
Is it possible to create label if not exists and assign it to document?
Łukasz
0
Comments
POST /api/labels
with a body like:
{
name: your label name,
ownerId: userId
}
this request returns and object containing a bunch of stuff including an id (labelId)
You can add a document to a label via:
POST /api/labels/{labelId}/uses/documents?documentIds={did}
which i think takes in a body like:
{
documentIds: [did],
labelId: labelId
}
And to search for documents under a label you can use the /api/documents/search with the label id set as the owner id
Edit: API endpoint is not public
Axel Kollmenter
You could put in an improvement request to make it public.