# Subscribe to the Store events

`POST /store/subscribe`

Tags: `store`

OpenAPI specification: https://raw.githubusercontent.com/PaloAltoNetworks/docusaurus-openapi-docs/main/demo/examples/petstore.yaml

Add subscription for a store events

## Servers

- `https://petstore.swagger.io/v2`: Default server
- `https://petstore.swagger.io/sandbox`: Sandbox server
- `http://127.0.0.1:4010`: Prism Mock API (local)

## Request body

### Content type: `application/json`

Schema: `object`

- `callbackUrl` (string<uri>, required, example: `https://myserver.com/send/callback/here`)
  This URL will be called by the server when the desired event will occur
- `eventName` (string, required, possible values: `orderInProgress`, `orderShipped`, `orderDelivered`, example: `orderInProgress`)
  Event name for the subscription

## Responses

### 201

Subscription added

#### Content type: `application/json`

Schema: `object`

- `subscriptionId` (string, example: `AAA-123-BBB-456`)

## Callbacks

### Callback `orderInProgress`: `POST {$request.body#/callbackUrl}?event={$request.body#/eventName}`

Order in Progress (Summary)

A callback triggered every time an Order is updated status to "inProgress" (Description)

#### Request body

##### Content type: `application/json`

Schema: `object`

- `orderId` (string, example: `123`)
- `timestamp` (string<date-time>, example: `2018-10-19T16:46:45Z`)
- `status` (string, example: `inProgress`)

##### Content type: `application/xml`

Schema: `object`

- `orderId` (string, example: `123`)

Example:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <orderId>123</orderId>
  <status>inProgress</status>
  <timestamp>2018-10-19T16:46:45Z</timestamp>
</root>

```

#### Responses

##### 200

Callback successfully processed and no retries will be performed

###### Content type: `application/json`

Schema: `object`

- `someProp` (string, example: `123`)

##### 299

Response for cancelling subscription

##### 500

Callback processing failed and retries will be performed

### Callback `orderInProgress`: `PUT {$request.body#/callbackUrl}?event={$request.body#/eventName}`

Order in Progress (Only Description)

#### Request body

##### Content type: `application/json`

Schema: `object`

- `orderId` (string, example: `123`)
- `timestamp` (string<date-time>, example: `2018-10-19T16:46:45Z`)
- `status` (string, example: `inProgress`)

##### Content type: `application/xml`

Schema: `object`

- `orderId` (string, example: `123`)

Example:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
  <orderId>123</orderId>
  <status>inProgress</status>
  <timestamp>2018-10-19T16:46:45Z</timestamp>
</root>

```

#### Responses

##### 200

Callback successfully processed and no retries will be performed

###### Content type: `application/json`

Schema: `object`

- `someProp` (string, example: `123`)

### Callback `orderShipped`: `POST {$request.body#/callbackUrl}?event={$request.body#/eventName}`

A callback triggered every time an Order is shipped to the recipient

#### Request body

##### Content type: `application/json`

Schema: `object`

- `orderId` (string, example: `123`)
- `timestamp` (string<date-time>, example: `2018-10-19T16:46:45Z`)
- `estimatedDeliveryDate` (string<date-time>, example: `2018-11-11T16:00:00Z`)

#### Responses

##### 200

Callback successfully processed and no retries will be performed

### Callback `orderDelivered`: `POST http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}`

Order delivered

A callback triggered every time an Order is delivered to the recipient

#### Request body

##### Content type: `application/json`

Schema: `object`

- `orderId` (string, example: `123`)
- `timestamp` (string<date-time>, example: `2018-10-19T16:46:45Z`)

#### Responses

##### 200

Callback successfully processed and no retries will be performed
