Product Stock Availability Changed
5 min
Products become available or unavailable at a location.
Set the webhook (sandbox)
Send this mutation with your urlPath. Expressoft then sends a message to urlPath each time products become available or unavailable in the location with locationKey.
Query
mutation ProductStockAvailabilityChanged($urlPath: String!, $locationKey: Guid!) {
miscellaneous {
webHooks {
post_ProductStockAvailabilityChanged (
payload: {
urlPath:$urlPath
locationKey: $locationKey
availableProducts: []
unavailableProducts: []
}
)
}
}
}Variables
{
"urlPath": "<your callback URL>",
"locationKey": "<locationKey>"
}cURL
curl --location 'https://sandbox.expressoft.eu/connect/api/interopgql' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"query": "mutation ProductStockAvailabilityChanged($urlPath: String!, $locationKey: Guid!) { miscellaneous { webHooks { post_ProductStockAvailabilityChanged ( payload: { urlPath:$urlPath locationKey: $locationKey availableProducts: [] unavailableProducts: [] } ) } } }", "variables": {"urlPath": "<your callback URL>", "locationKey": "<locationKey>"}}'Response
{
"data": {
"miscellaneous": {
"webHooks": {
"post_ProductStockAvailabilityChanged": "<string>"
}
}
}
}The mutation returns a String (the type is confirmed by the schema). Your callback URL is called later, when the event happens.
Payload sent to your URL
Expressoft sends a POST request with this JSON body:
{
"available_products": [
"00000000-0000-0000-0000-000000000081"
],
"unavailable_products": [
"00000000-0000-0000-0000-000000000071",
"00000000-0000-0000-0000-000000000072"
],
"location_key": "00000000-0000-0000-0000-000000000051"
}Field | Type | Description |
|---|---|---|
available_products | array of GUID or null | The keys of the products that became available. null when nothing changed. |
unavailable_products | array of GUID or null | The keys of the products that became unavailable. null when nothing changed. |
location_key | GUID | The publicKey of the location. |
ℹ️ INFO
The mutation requires both availableProducts and unavailableProducts. Send an empty list when no product changed in that direction.