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.


Using Webhooks for Part Translation

morteza_karimimorteza_karimi Member Posts: 13
edited March 2019 in FeatureScript
I see once you submit a translation job through the API, there are two options;
1-If the requestState is ACTIVE, the translation can be polled until the state becomes either DONE or FAILED.
2-Alternatively, a webhook callback can be registered for notification of translation completion.
Now, I've successfully attempted the first method, but the second one would be preferred for obvious reasons.
I can't find much information about webhook callbacks though. For example I don't see in the translation request and entry for webhook ID, nor I know what events are there for creating a webhook.

Request Body (for Create Part Studio translation)

configuration String A configuration string indicating the particular configuration that should be translated N/A
formatName String Name of format into which this element should be translated. ONSHAPE indicates that the model file should be translated into a Part Studio or Assembly. N/A
includeExportIds Boolean Whether to include topology id strings in parasolid output format. N/A
linkDocumentWorkspaceId String If storeInDocument is true and linkDocumentId is specified, this specifies a workspace to be used for result storage within the linkDocument. N/A
partIds String A comma-separated list of part ids that should be translated. If not specified, all parts are translated. N/A
storeInDocument Boolean controls whether the translation is stored as a new element or whether the data is stored as external data (storeInDocument=false).

Request Body (for Create Webhook)

data (Optional) String Data to encapsulate in webhook null
events String[] Array of event names for which to register webhook N/A
filter String Context for webhook, in one of two forms: "{$DocumentId} = '[did]' && {$WorkspaceId} = '[wid]' && {$ElementId} = '[eid]'" or "{$UserId} = '[uid]' && {$ClientId} = 'cid'" [did] is a document ID, etc., but the components in brackets and the quotes must remain exactly as written, in the same order N/A
options Object Options object, with one optional field: collapseEvents, which is set to true/false and says whether similar events should be collapsed into one notification N/A
url String URL to which to send notifications N/A


Sign In or Register to comment.