POST/subscription/{subscription_id}/filter
This method allows applications to create a filter for a subscription. Filters allow applications to only be sent notifications that match a provided criteria. Notifications that do not match this criteria will not be sent to the destination.
The filterSchema value must be a valid JSON Schema Core document (version 2020-12 or later). The filterSchema provided must describe the subscription's notification payload such that it supplies valid criteria to filter the subscription's notifications. The user does not need to provide $schema
and $id
definitions.
When a filter is first created, it is not immediately active on the subscription. If the request has a valid JSON body, the successful call returns the HTTP status code 201 Created. Newly created filters are in PENDING
status until they are reviewed. If a filter is valid, it will move from PENDING
status to ENABLED
status. You can find the status of a filter using the getSubscriptionFilter method. See Creating a subscription filter for a topic for additional information.
Note: Only one filter can be in ENABLED (which means active) status on a subscription at a time. If an ENABLED filter is overwritten by a new call to CREATE a filter for the subscription, it stays in ENABLED status until the new PENDING filter becomes the ENABLED filter, and the existing filter then becomes DISABLED.
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
Parameter | Type | Description |
---|---|---|
subscription_id | string | The unique identifier of the subscription for which a filter will be created. Occurrence: Required |
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 the client credentials grant flow, 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.
Note: An OAuth token created with the client credentials grant flow and the https://api.ebay.com/oauth/api_scope scope is required in order to create, update, or retrieve application-based subscriptions to notification topics. An OAuth token created with the authorization code grant flow and the https://api.ebay.com/oauth/api_scope/commerce.notification.subscription scope is required in order to create, update, or retrieve user-based subscriptions to notification topics.
Request payload
Copy complete valid JSON to clipboardRequest fields
Input container/field | Type | Description |
---|---|---|
filterSchema | object | The content of a subscription filter as a valid JSON Schema Core document (version 2020-12 or later). The filterSchema provided must describe the subscription's notification payload such that it supplies valid criteria to filter the subscription's notifications. Occurrence: Required |
Output
HTTP response headers
See HTTP response headers for details.
Header | Meaning |
---|---|
Location | The location where the subscription filter resource was 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 |
404 | Not Found |
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. |
195013 | API_NOTIFICATION | REQUEST | The subscription id does not exist. |
195028 | API_NOTIFICATION | REQUEST | The application is not authorized to access the specified subscription. |
195032 | API_NOTIFICATION | REQUEST | The specified subscription topic is not filterable. |
195033 | API_NOTIFICATION | REQUEST | The specified 'filterSchema' value is invalid. |
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: Receive Notifications from a Specific Marketplace
This call creates a filter for a specified subscription that only sends notifications from a specific marketplace.
Input
The input specifies the subscriptionId as a path parameter. It also requires the filterSchema in the request payload. In this example, the request is to only receive notifications from the eBay France marketplace.
POSThttps://api.ebay.com/commerce/notification/v1/subscription/{subscription_id}/filter
Output
A successful call returns the HTTP status code 201 Created. This method has no response payload.
Sample 2: Receive Notifications from a Specific Marketplace and Exclude Specific Meta Categories
This call creates a filter for a specified subscription that only sends notifications from a specific marketplace, excluding specific meta categories.
Input
The input specifies the subscriptionId as a path parameter. It also requires the filterSchema in the request payload. In this example, the request is to only receive notifications from the eBay France marketplace and to exclude the listed meta categories.
POSThttps://api.ebay.com/commerce/notification/v1/subscription/{subscription_id}/filter
Output
A successful call returns the HTTP status code 201 Created. This method has no response payload.
Sample 3: Receive Notifications from Multiple Marketplaces and Exclude Specific Meta Categories
This call creates a filter for a specified subscription that only sends notifications from specified marketplaces, excluding specific meta categories.
Input
The input specifies the subscriptionId as a path parameter. It also requires the filterSchema in the request payload. In this example, the request is to only receive notifications from the eBay Great Britain, Germany, and Italy marketplaces and to exclude the listed meta categories for each.
POSThttps://api.ebay.com/commerce/notification/v1/subscription/{subscription_id}/filter
Output
A successful call returns the HTTP status code 201 Created. This method has no response payload.