POST/subscription
This method allows applications to create a subscription for a topic and supported schema version. Subscriptions allow applications to express interest in notifications and keep receiving the information relevant to their business.
Each application and topic-schema pairing to a subscription should have a 1:1 cardinality.
You can create the subscription in disabled mode, test it (see the test method), and when everything is ready, you can enable the subscription (see the enableSubscription method).
Note: If an application is not authorized to subscribe to a topic, for example, if your authorization does not include the list of scopes required for the topic, an error code of 195011 is returned.
Input
Resource URI
This method is supported in Sandbox environment. To access the endpoint, just replace the api.ebay.com
root URI with api.sandbox.ebay.com
URI parameters
This method has no URI parameters.
HTTP request headers
All requests made to eBay REST operations require you to provide the Authorization
HTTP header for authentication authorization.
The table below shows additional HTTP request headers that are either required, conditionally required, or strongly recommended for this method. Other standard HTTP request headers- opens rest request components page (not in this table) can also be used, but they are optional.
Header | Type | Description |
---|---|---|
Content-Type | string | This header indicates the format of the request body provided by the client. Its value should be set to application/json. For more information, refer to HTTP request headers. Occurrence: Required |
OAuth scope
This request requires an access token created with either authorization code grant flow or client credentials grant flow. Please refer to the note below for more details.
The access token must be created using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):
https://api.ebay.com/oauth/api_scope
https://api.ebay.com/oauth/api_scope/commerce.notification.subscription
See OAuth access tokens for more information.
Request payload
Copy complete valid JSON to clipboardRequest fields
Input container/field | Type | Description |
---|---|---|
destinationId | string | The unique identifier of the destination endpoint that will receive notifications associated with this subscription. Use the getDestinations method to retrieve destination IDs. Occurrence: Required |
payload | SubscriptionPayloadDetail | The payload associated with the notification topic. Use getTopics or getTopic to get the supported payload for the topic. Occurrence: Required |
payload.deliveryProtocol | ProtocolEnum | The supported delivery protocol of the notification topic. Occurrence: Required |
payload.format | FormatTypeEnum | The supported data format of the payload. Occurrence: Required |
payload.schemaVersion | string | The supported schema version for the notification topic. See the supportedPayloads.schemaVersion field for the topic in getTopics or getTopic response. Occurrence: Required |
status | SubscriptionStatusEnum | Set the status of the subscription to Occurrence: Required |
topicId | string | The unique identifier of the notification topic to subscribe to. Use getTopics to get topic IDs. Occurrence: Required |
Output
HTTP response headers
See HTTP response headers for details.
Header | Meaning |
---|---|
Location | The subscription resource created. |
Response payload
This call has no payload.
Response fields
This call has no field definitions.
HTTP status codes
This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.
Status | Meaning |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
409 | Conflict |
500 | Internal Server Error |
Error codes
For more on errors, plus the codes of other common errors, see Handling errors.
Code | Domain | Category | Meaning |
---|---|---|---|
195000 | API_NOTIFICATION | APPLICATION | There was a problem with an eBay internal system or process. Contact eBay developer support for assistance. |
195003 | API_NOTIFICATION | REQUEST | Please provide configurations required for notifications. Refer to /config |
195006 | API_NOTIFICATION | REQUEST | Invalid or missing subscription status. |
195007 | API_NOTIFICATION | REQUEST | Invalid or missing destination id. |
195008 | API_NOTIFICATION | REQUEST | Invalid or missing schema version. Please refer to /topic/{topic_id} for supported schema versions. |
195009 | API_NOTIFICATION | REQUEST | Specified format is not supported for the topic. |
195010 | API_NOTIFICATION | REQUEST | Invalid or missing protocol |
195011 | API_NOTIFICATION | REQUEST | Not authorized for this topic. |
195012 | API_NOTIFICATION | REQUEST | Subscription already exists |
195015 | API_NOTIFICATION | REQUEST | The subscription cannot be enabled since the destination is not enabled. |
195027 | API_NOTIFICATION | REQUEST | Invalid or missing topic id. |
Warnings
This call has no warnings.
Samples
New to making API calls? Please see Making a Call.
Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.
Sample 1: Create subscription
This call creates a subscription for an application.
Input
The required inputs are topicId, status, payload, payload (including format, schemaVersion and deliveryProtocol) and destinationId.
POSThttps://api.ebay.com/commerce/notification/v1/subscription
Output
A successful call returns the HTTP status code 201 Created. This method has no response payload.