Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

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.

Update feature using API and Python

anna_bengtsson419anna_bengtsson419 Member Posts: 3
edited October 11 in Data management


I’m new to use Onshape REST API, or API overall. I’m trying to modify a feature (a feature I’ve created with Feature Script) by calling the update feature API with python. But I don’t understand what my functions input/ouput should be, how do I understand that from the documentation? My feature have different parameters I want to change, see picture attached. This is my function in python so far:

def update_feature(self, did, wid ??):

return self.__api.request('post', '/api/partstudios/d/' + did + '/w/' + wid + '/e/' + eid + '/features' + fid ??)

I’ve downloaded Onshapepy so I’m just adding the function to the client module.

Thank you in advance!



  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,013

    @ethan_keller924 will be able to help! I've sent him a message for you.
    Jake Rosenfeld - Modeling Team
  • ethan_keller924ethan_keller924 Member Posts: 31 ✭✭
    Hi @anna_bengtsson419,

    The best way to do what you're asking for is to build the feature you want to add in the UI, and then use "get feature list" to see the structure of your built feature. Then, if you can call "add feature" using that structure in the API. This works for even custom features. Try that out, and let me know if you run into issues!

  • anna_bengtsson419anna_bengtsson419 Member Posts: 3

    Thank you for your answer, i appreciate it! I think I understand that from the developer portal and I've been able to get the feature list from my part studio with your Onshapepy.

    My problem is that I don't understand how to write my own function and how to define it when I call it. I can read about the structure in the developer portal, but I don't really understand it. As I said, new to API and this kind of programming. 

    This i what I have so far. 


    def update_feature(self, did, wid, eid):
            return self.__api.request('post', '/api/partstudios/d/' + did + '/w/' + wid + '/e/' + eid + '/features')

    And when i call it:

    from onshapepy.core.client import c
    update_feature = c.update_feature(did, wid, eid)

    I understand I've missed some, but I do not really understand what. Or where I can learn. 

    Thank you in advance!

Sign In or Register to comment.