Subscribe to the Store events
1 min
POST
//petstore.swagger.io/v2/store/subscribe
Body Parameters
- bodyobject
- callbackUrlstring<uri>requiredExampleDescription
- eventNamestring<orderInProgress | orderShipped | orderDelivered>requiredExampleDescription
Responses
200
- array[]
201
- object
- subscriptionIdstringExample
curl
curl --request POST \
--url //petstore.swagger.io/v2/store/subscribe \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"callbackUrl": "https://myserver.com/send/callback/here",
"eventName": "orderInProgress"
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"callbackUrl": "https://myserver.com/send/callback/here",
"eventName": "orderInProgress"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("//petstore.swagger.io/v2/store/subscribe", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("//petstore.swagger.io/v2/store/subscribe")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"callbackUrl": "https://myserver.com/send/callback/here",
"eventName": "orderInProgress"
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "//petstore.swagger.io/v2/store/subscribe"
payload = json.dumps({
"callbackUrl": "https://myserver.com/send/callback/here",
"eventName": "orderInProgress"
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful operation
[
[
""
]
]201
// Subscription added
{
"subscriptionId": "AAA-123-BBB-456"
}Add subscription for a store events