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.
How to copy an onshape public document using the api and then get the new url of the document?
md_ferdous_alam
Member Posts: 5 EDU
Hi, I am new to Onshape and need to the following. If I have a public document (such as https://cad.onshape.com/documents/b33a147f86da49879455d286/w/bfdeeceb44a140cfae14fdd1/e/c26b2860c5d143a6a1414663), how can I use the api to make a copy of this and get the new url so I can modify it? I can do this using the UI but I need to do this in a python script using the api. I tried the glasswork explorer but it is giving me bad-request. Any help would be much appreciated.
0
Answers
-
It would help if you could post details of the API call that you are trying to make (ie the URL and body of the request).
The sample request in glassworks has some extra fields that aren't required.
To copy that public document you should only need to do:
https://cad.onshape.com/api/documents/b33a147f86da49879455d286/w/bfdeeceb44a140cfae14fdd1/copy
with a body:
{"newName":"my new document name","isPublic":false}
0 -
Thanks for the response. This is what I am doing right now,response = requests.post(did, wid),auth=(API_ACCESS, API_SECRET),headers={"Accept": "application/json;charset=UTF-8; qs=0.09","Content-Type": "application/json"},)0
-
Your request URL is for /api/partstudios instead of /api/documents
0
