How to
Track product availability
Get notified when out-of-stock products are back in stock using Geins Merchant API
Prerequisites
- Merchant API key
- SKU ID of the product to monitor
- Valid email address for notifications
Goal
- Subscribe to availability notifications for a specific product SKU
Architecture at a glance
- Use
monitorProductAvailabilitymutation → Provide email and SKU ID → Get notified when product is back in stock
Example
To monitor product availability, use the monitorProductAvailability mutation in the Merchant API. You need to provide an email address and the SKU ID of the product you want to track.
Try it out in the GraphQL Playground using the query, headers and variables below.
Request example
mutation monitorProductAvailability(
$email: String!
$skuId: Int!
$channelId: String
$languageId: String
$marketId: String
) {
monitorProductAvailability(
email: $email
skuId: $skuId
channelId: $channelId
languageId: $languageId
marketId: $marketId
)
}
{
"Accept": "application/json",
"X-ApiKey": "{MERCHANT_API_KEY}"
}
{
"email": "{USER_EMAIL}",
"skuId": {SKU_ID},
"channelId": "{CHANNEL_ID}",
"languageId": "{LANGUAGE_ID}",
"marketId": "{MARKET_ID}"
}
curl -X POST https://merchantapi.geins.io/graphql \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-ApiKey: {MERCHANT_API_KEY}" \
-d '{"query":"mutation monitorProductAvailability($email: String!, $skuId: Int!, $channelId: String, $languageId: String, $marketId: String) { monitorProductAvailability(email: $email, skuId: $skuId, channelId: $channelId, languageId: $languageId, marketId: $marketId) }","variables":{"email":"{USER_EMAIL}","skuId":{SKU_ID},"channelId":"{CHANNEL_ID}","languageId":"{LANGUAGE_ID}","marketId":"{MARKET_ID}"}}'
The
channelId, languageId, and marketId arguments are optional and can be left out to use default values.Response example
200 OKresponse.json
{
"data": {
"monitorProductAvailability": true
}
}
Options
Channel, Language, and Market
The mutation also supports optional parameters for multi-market support:
Read more about
channelId, languageId, and marketId in the "how to"-article about using multi-market support.Related