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.

Options

How to use webhooks for translations

Michał_WójcikMichał_Wójcik Member Posts: 13
edited September 2020 in Community Support
I'm using webhooks to check if a model has changed and then create a translation of the model each time it changes. I registered a webhook with 2 events: "onshape.model.lifecycle.changed" and "onshape.model.translation.complete". I get a notification on change, but when I create a translation, I never get the "complete" notification. When I check the translation by its ID manually, it's done and I can download it. I also tried registering a seperate webhook for translations, with the same document, workspace and element IDs, it still won't work. What should I do to get a notification? Or is it just broken and should be removed from documentation?

Answers

  • Options
    alan_baljeualan_baljeu Member, User Group Leader Posts: 111 ✭✭
    I'm new to webhooks in onshape.  Where did you see these documented?  
    Creating knowledge-driven design automation software, for molds, etc.
    www.virtualmold.com

  • Options
    Michał_WójcikMichał_Wójcik Member Posts: 13
    Right here.
  • Options
    Ethan_KEthan_K Member, Onshape Employees Posts: 57
    @Michał_Wójcik
    You should be getting a notification upon completion - I think your understanding is correct. Can you include the exact request body you sent upon registering for the webhook?
  • Options
    Michał_WójcikMichał_Wójcik Member Posts: 13
    edited October 2020
    {
      "events": ["onshape.model.lifecycle.changed","onshape.model.translation.complete"],
      "filter": "{$DocumentId} = '52c526d69a766eb4364973d3' && {$WorkspaceId} = '38cbdf8c8ebe22f18f17fc6a' && {$ElementId} = 'a3237df3ce503e27df514451'",
      "options": { "collapsibleEvents": "true" },
      "url": <my publicly visible dev server domain name>,
      "documentId": "52c526d69a766eb4364973d3"
    }

     Again, it works fine for the "onshape.model.lifecycle.changed" event.
  • Options
    grzegorz_kiernozekgrzegorz_kiernozek Member Posts: 1
    @Ethan_K we will be gratefull for any help we can get with this,
    We do not have any info on model translation completion for now
  • Options
    mbattistellombattistello Member, Developers Posts: 51 ✭✭
    Ive used this in the past and it worked as expected. I did have some general issues with webhooks and I believe it tied to how you need to handle multiple responses on them. Are you checking each of the responses or maybe just the first or last one in a series?

    Its been a while since Ive looked at the code I had so I dont remember the specifics. Let me try to find it and see if had commented it around some of the issues I saw in it. 


  • Options
    Michał_WójcikMichał_Wójcik Member Posts: 13
    If every webhook notfication is its own request to my API, then I'm checking all of them. I log every request and I never got the translation.complete one.
  • Options
    Michał_WójcikMichał_Wójcik Member Posts: 13
    Bump
  • Options
    mbattistellombattistello Member, Developers Posts: 51 ✭✭
    Did you put a ticket in with API support? Ive used them in the past and they are very helpful. Just email your issue to api-support@onshape.com and it will create a ticket and they will work with you on it. 
  • Options
    Michał_WójcikMichał_Wójcik Member Posts: 13
    Thanks for the info, I'll contact them
Sign In or Register to comment.