Create device subscriptions
POST
/merchants/{merchantCode}/devices/{deviceCode}/subscriptions
const url = 'https://customer.shopgate.io/v1/merchants/example/devices/example/subscriptions?localeCode=example';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"subscriptions":[{"code":"default","subscriptionType":"productInventoryRestocked","entityType":"product","entityId":"p1","status":"active","params":{}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://customer.shopgate.io/v1/merchants/example/devices/example/subscriptions?localeCode=example' \ --header 'Content-Type: application/json' \ --data '{ "subscriptions": [ { "code": "default", "subscriptionType": "productInventoryRestocked", "entityType": "product", "entityId": "p1", "status": "active", "params": {} } ] }'Create new device subscriptions
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”merchantCode
required
string
deviceCode
required
string
Query Parameters
Section titled “Query Parameters”localeCode
required
string
Request Body
Section titled “Request Body”Media typeapplication/json
object
subscriptions
required
Array<object>
object
code
Subscription code. This needs to be unique within every user
string
Example
1-weddingsubscriptionType
required
Type of subscription
string
entityType
required
The entity for which the subscription should be created
string
entityId
required
Id of the referenced entity, depending on entity type
string
status
string
params
Additional subscription properties
object
key
additional properties
any
Example
{ "code": "default", "subscriptionType": "productInventoryRestocked", "entityType": "product", "entityId": "p1", "status": "active", "params": {}}Responses
Section titled “Responses”Subscriptions were created
Media typeapplication/json
object
codes
Array<string>
errors
Array<object>
object
code
number
message
string
validationError
(optional) The original validation error that occured.
object
code
string
message
string
paramName
string
paramValue
string
entity
string
entityIndex
The index of the element the error refers to in the list of elements passed, starting from 0.
number
entityId
string
subentityPath
Array<string>
Example
{ "codes": [ "5dfc8839-8866-43ed-9238-a09d92cd2353" ], "errors": [ { "code": 409, "entity": "subscription", "entityId": "sub_1", "entityIndex": 0, "reason": "Subscription code found more than once", "subentityPath": [] } ]}Access denied
Media typeapplication/json
object
code
Machine readable error code
string
message
required
Human readable error code
string
Examplegenerated
{ "code": "example", "message": "example"}Merchant or Device not found
Media typeapplication/json
object
code
Machine readable error code
string
message
required
Human readable error code
string
Examplegenerated
{ "code": "example", "message": "example"}default
Section titled “default”Unexpected error
Media typeapplication/json
object
code
Machine readable error code
string
message
required
Human readable error code
string
Examplegenerated
{ "code": "example", "message": "example"}
