Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:

  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Copy and Rename workspace using API

paul_hermanspaul_hermans Member Posts: 2 EDU
I am wondering how easy (or if it is even possible) to copy a workspace and rename it using the API.
I know this is available via interface, but want to automate making several copies of the workspace (1 for each of my students)

Any guidance / example would be great.

Answers

  • Ethan_KEthan_K Member, Onshape Employees Posts: 39
    Hi Paul,

    Thanks for reaching out! This is indeed supported. Do you want to make new document from the workspace? Then use this API:

    {post} /documents/:did/workspaces/:wid/copy Copy Workspace

    The body could have  the following fields: newName, ownerId, ownerTypeIndex, isPublic. isPublic should be a boolean and ownerTypeIndex is an int with the value: 

    0: user 1: company 2: Team

    All of this is laid out in the API Explorer.

    Hope that helps and let me know if you need any more guidance  :)

    -Ethan

Sign In or Register to comment.