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.
Why do I get 401 as API response when adding query string to request url?
lebenito
Member Posts: 15 ✭
I am using the client.api_client.request(method, url=url, query_params=params, headers=headers, body=payload) from the python client.
Other API get and post calls work just fine.
When I try to export an stl or get the mass properties of a part studio it works just fine until I put a query string in the request url for example the configuration,
but other query parameters also do not work. It says "message":"Unauthenticated API request", "status":401
Here is an example of a not working request url: https://cad.onshape.com/api/partstudios/d/c3c64dc4cc39570a7e58f079/w/cc1d338579f170714f7a792d/e/9266a7733c2327e4f1ab87c6/massproperties?massAsGroup=true&configuration=rad1=2inch
This works though when I put the link manually in my browser where I am logged into my Onshape account.
But my shadedView api call works with a query string. The query strings are formatted and encoded the exact same way, so I do not understand why this call works with query parameters but stl and mass properties do not.
For the stl I already got told a work around with translations, but I cant find such work around for the massproperties.
Why is that happening or is there maybe also a work around for the mass properties?
0
Answers
Try
?configuration=rad1=1inch
It works just without the query string.