Hi, I’m having trouble deciphering the parameters to create a webhook via the API.
I’m finding that the parameter fields and naming used in the webbrowser don’t correlate with the parameters expected by the SDK.
For example, in the browser I get asked to add triggers but in the SDK I think this is equivelant to the below parameters, but i’m not 100% sure.
Additionally, there is no guidence on what you can pass into the filter:{} parameters.
events: [
{
entity_type: 'item',
event_types: [
'publish'
],
filter: {
entity_type: 'item_type',
entity_ids: [
'app_events_config'
]
}
}
],
But i’m getting the error
triggerUncaughtException(err, true /* fromPromise */);
^
ApiError: POST https://site-api.datocms.com/webhooks: 422 Unprocessable Entity
[
{
"id": "05b4ed",
"type": "api_error",
"attributes": {
"code": "INVALID_FIELD",
"details": {
"field": "name",
"code": "VALIDATION_UNIQUENESS",
"record_type": "Webhook"
}
}
},
{
"id": "36416a",
"type": "api_error",
"attributes": {
"code": "INVALID_FIELD",
"details": {
"field": "events",
"code": "VALIDATION_INVALID",
"record_type": "Webhook"
}
}
}
]
Additionally, there doesn’t appear to be any documentation explaining the Events Object and what parameters you should provide, fill, or how they correlate to the webhook properties you create manually.
For example
- what can you pass into entity_type ?
I found this document (seperate from the webhook example)
Whats the difference between item and item_type when to use each?
- What can you pass into filters : {} ?
I have as yet been unable to properly pass in a filter definition that doesn’t fail as per above errors.
Any help greatly appreciated.