Skip to content

Commit

Permalink
docs(open-api): add json sample for MyParcel webhooks
Browse files Browse the repository at this point in the history
INT-407
  • Loading branch information
FreekVR committed Apr 5, 2024
1 parent 8fce179 commit 14c8bd1
Showing 1 changed file with 265 additions and 0 deletions.
265 changes: 265 additions & 0 deletions src/api-reference/9999.test.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,271 @@
title: 9999. Test
---

<OpenApi :document="{
openapi: '3.1.0',
info: {
title: 'MyParcel Core-API',
contact: {
name: 'IT Support',
url: ':support@myparcel.nl'
},
version: '4.0.0'
},
servers: [
{
url: 'https://api.myparcel.nl',
description: 'MyParcel Production Server'
}
],
paths: {
'/webhook_subscriptions': {
get: {
tags: ['Webhook Subscriptions'],
description: 'Show list of webhook subscriptions',
operationId: 'getSubscriptions',
parameters: [
{ $ref: '#/components/parameters/user_agent_header' },
{ $ref: '#/components/parameters/account_id' },
{ $ref: '#/components/parameters/shop_id' },
{
name: 'hook',
in: 'query',
description: 'The event from which you want to receive notifications',
required: false,
schema: {
description: 'The event from which you want to receive notifications',
type: 'string',
example: 'shipment_status_change'
}
}
],
responses: {
'200': {
description: 'OK',
content: {
'application/json; charset: utf-8': {
schema: {
$ref: '#/components/schemas/webhook_subscriptions_response'
}
}
}
},
'400': { description: 'Validation error' },
'401': { description: 'Unauthorized' },
'403': { description: 'Forbidden' },
'500': { description: 'Internal Server Error' }
},
security: []
},
post: {
tags: ['Webhook Subscriptions'],
description: 'Add new webhook subscription.',
operationId: 'postSubscriptions',
parameters: [{ $ref: '#/components/parameters/user_agent_header' }],
requestBody: {
description: '|\n | **Hook** | **Description** |\n |---- |------------|\n | ```shipment_status_change``` | Whenever the shipment_status of a shipment changes, this webhook will send you an update with the new value. We will not send an update with a status.|\n | ```shipment_label_created``` | When a label is created asynchronously (for example when creating shipments using accept header ```application/vnd.shipment_label+json;charset=utf-8```), this webhook will send you a message with the URL of the label. |\n | ```order_status_change``` | Whenever the order_status of an order changes, this webhook will send you an update with the new value. |',
required: true,
content: {
'application/json; charset: utf-8': {
schema: {
$ref: '#/components/schemas/webhook_subscription_request'
}
}
}
},
responses: {
'201': {
description: 'Response with array of webhook ids',
content: {
'application/json; charset: utf-8': {
example: {
data: {
webhook_subscriptions: [{ id: 1 }]
}
}
}
}
},
'400': { description: 'Validation error' },
'401': { description: 'Unauthorized' },
'403': { description: 'Forbidden' },
'500': { description: 'Internal Server Error' }
},
security: []
}
},
'/webhook_subscriptions/{webhook_subscriptions_id}': {
delete: {
tags: ['Webhook Subscriptions'],
summary: 'Delete webhook subscriptions.',
description: 'Delete a webhook subscription',
operationId: 'deleteSubscriptions',
parameters: [
{ $ref: '#/components/parameters/user_agent_header' },
{ $ref: '#/components/parameters/webhook_subscriptions_id_in_path' }
],
responses: {
'204': { description: 'No content' },
'401': { description: 'Unauthorized' },
'403': { description: 'Forbidden' },
'500': { description: 'Internal Server Error' }
},
security: []
}
}
},
components: {
schemas: {
webhook_subscriptions_response: {
required: ['data'],
properties: {
data: {
required: ['webhook_subscriptions'],
properties: {
webhook_subscriptions: {
type: 'array',
items: { $ref: '#/components/schemas/webhook_subscription' }
}
},
type: 'object'
}
},
type: 'object'
},
webhook_subscription: {
description: 'Webhook subscription',
required: ['id', 'account_id', 'shop_id', 'hook', 'url'],
properties: {
id: {
description: 'ID of webhook subscriptions',
type: 'integer',
format: 'int32',
example: 56123456
},
account_id: {
description: 'Account ID',
type: 'integer',
format: 'int32',
example: 125678
},
shop_id: {
description: 'Shop ID',
type: 'integer',
format: 'int32',
example: 1234
},
hook: {
description: 'The event from which you want to receive notifications',
type: 'string',
example: 'shipment_status_changed'
},
url: {
description: 'The callback URL on which to receive notifications',
type: 'string',
format: 'uri',
example: 'https://example.com/webhook'
}
},
type: 'object'
},
webhook_subscription_request: {
description: 'Webhook subscription request',
required: ['data'],
properties: {
data: {
required: ['webhook_subscription'],
properties: {
webhook_subscription: {
required: ['hook', 'url'],
properties: {
hook: {
description: 'The event from which you want to receive notifications',
type: 'string',
example: 'shipment_status_changed'
},
url: {
description: 'The callback URL on which to receive notifications',
type: 'string',
format: 'uri',
example: 'https://example.com/webhook'
}
},
type: 'object'
}
},
type: 'object'
}
},
type: 'object'
}
},
parameters: {
account_id: {
name: 'account_id',
in: 'query',
description: 'The ID of the account.',
required: false,
schema: {
type: 'integer',
format: 'int32'
},
example: '123456'
},
shop_id: {
name: 'shop_id',
in: 'query',
description: 'The ID of the shop.',
required: false,
schema: {
type: 'integer',
format: 'int32'
},
example: '5678'
},
user_agent_header: {
name: 'User-Agent',
in: 'header',
description: 'The User-Agent header',
required: true,
schema: {
type: 'string'
},
example: 'NameOfMyApp/1.0.0 PHP/8.1.0'
},
webhook_subscriptions_id_in_path: {
name: 'webhook_subscriptions_id',
in: 'path',
description: 'The ID of the webhook subscription',
required: true,
schema: {
type: 'integer',
format: 'int32'
},
example: '123456789'
}
},
securitySchemes: {
bearerAuth: {
type: 'http',
description: 'BASE64 encoded ',
name: 'Authorization',
in: 'header',
scheme: 'bearer'
}
}
},
tags: [
{
name: 'Pickup Locations',
description: 'All about Pickup Locations'
},
{
name: 'Webhook Subscriptions',
description: 'All about Webhooks'
}
]
}" />

<OpenApi :document="{
'openapi': '3.0.0',
'info': {
Expand Down

0 comments on commit 14c8bd1

Please sign in to comment.