An object representing an callback that should be made for certain events for a specific auth token, and thereby webshop. This is to push notifications of changes to external systems to avoid the need of polling our API about updates. EventListeners
can only be accessed by administrators or through valid auth tokens. Each AuthToken can only specify one listener per unique eventName
.
Property | Type | Description |
---|---|---|
uid | integer | The unique identifier for the object. |
created | string | Date and time of object creation. |
changed | string | Date and time of last update to the object. |
status | Status | Information about if the object is active and, if not, when it was inactivated. |
eventName | string | The event that will trigger calling the specified URL. |
url | string | The URL called on specified event trigger. |
authToken | string | The AuthToken associated with the eventName and URL combination. |
Property | Type | Description |
---|---|---|
inactiveSince | string | The date and time when the event was last inactivated. |
active | boolean | If the EventListener is active. |
Creates a new EventListener
.
Parameters | Description |
---|---|
patch | An object containing the properties and values to set. |
query | A query specifying what to return after object creation has been successful (optional). See Query language. |
EventListener.create({
"authToken": "XYV0aDpRS4F7bdFom444RO9ygHObnnb/zIOds3iuXFhtoDGbWiUt",
"eventName": "Order/discarded",
"url": "https://www.example.com"
}, [
"uid",
"status"
])
Removes an existing EventListener
.
Parameters | Description |
---|---|
uid | UID of object to delete. |
EventListener.delete(1234)
Fetches information about a specific EventListener
.
Parameters | Description |
---|---|
uid | The unique identifier of an eventlistener. |
query | Which info to return. See Query language. |
EventListener.get(1234, [
"url",
"eventName"
])
Fetch the running log of the EventListener
.
Parameters | Description |
---|---|
uid | UID of object. |
EventListener.getLog(1234)
Fetches the JSON Schema which can be used for client-side validation.
The unique identifier of an event listener or null
for a new instance.
Fetches all accessible EventListeners
for given webshop or AuthToken.
Parameter | Description |
---|---|
query | Which info to return. See Query language. |
selection | Which integrations to list. See List selection. |
The request below returns the settings URL, type and unique identifier of all the integrations created since 1 January 2015, sorted by type.
EventListener.list([
"status",
"uid"
], {
"filters": {
"/created": {
"min": "2015-01-01"
}
},
"sort": "uid"
})
Updates an existing EventListener
.
Parameters | Description |
---|---|
uid | UID of object to change. |
patch | An object containing the properties and values to set. |
query | A query specifying what to return after object creation has been successful (optional). See Query language. |
EventListener.set(1234, {
"status": {
"active": false
}
}, [
"uid",
"status"
])