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.
python 401 error
When I log in to the URL https://cad.onshape.com/glassworks/explorer/#/PartStudio and authorize through the API, I find that GET operations work, but POST operations result in an error. Using Python, I can access features through GET, but when I try to access FeatureScript with POST, I encounter a 401 Client Error: Unauthorized for the URL https://cad.onshape.com/api/v6/partstudios/d/03e46cf3083711bca0f5bf60/w/b5fbff3a6045ce47fe72985b/e/6b42da54504ca039e842ce02/featurescript.
This is my file link: https://cad.onshape.com/documents/03e46cf3083711bca0f5bf60/w/b5fbff3a6045ce47fe72985b/e/6b42da54504ca039e842ce02. I have opened file sharing.
I copied the code for my entire project from this place: https://github.com/ChrisWu1997/onshape-cad-parser
but when I run process.py --test, I always encounter a 401 error. I checked and found that I can run the get_features file, but an error occurs when running featurelistparser. Can you help me solve this problem?
Answers
When you say " authorize through the API" do you mean use the API keys? If so you may want to ensure you created the keys with the "Application can write to your documents" enabled. POST requests which modify the document, need write permission on the document.
When I created the API, I chose this option, oauth2write.All the above operations were performed while connected to a remote server. Is this related? Can API access only be achieved when working locally?