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
-
Hi!
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.
0 -
Hi!
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?
0
Categories
- All Categories
- 10.2K Community Support
- 4.6K General
- 194 Account and subscriptions
- 353 Data management
- 1.6K Product Feedback
- 215 New in Onshape
- 15 Onshape Labs
- 76 CAM Studio
- 35 PCB Studio
- 107 Simulation
- 209 Onshape Mobile
- 315 App Store & Partners Apps
- 8.2K Using Onshape
- 1.8K Drawings
- 2.3K FeatureScript
- 324 Learning Center
- 254 Education Community

