Skip to main content

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

POST https://api.ebay.com/commerce/notification/v1/subscription/{subscription_id}/filter

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

ParameterTypeDescription
subscription_idstringThe 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.

HeaderTypeDescription
Content-TypestringThis 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.

Request payload

Copy complete valid JSON to clipboard

Request fields

Input container/fieldTypeDescription
filterSchemaobject

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.

Note: Not all topics can have filters applied to them. Use getTopic and getTopics requests to determine if a specific topic is filterable. Filterable topics have the boolean filterable returned as true in the response.
Note: If the JSON supplied as a subscription filter specifies a field that does not exist in the notifications for a topic, or if the topic is not filterable, the filter will be rejected and become DISABLED. If it is valid, however, the filter will move from PENDING status to ENABLED status.
Initially, when the createSubscriptionFilter request has been made, if the request has a valid JSON body a 201 Created is returned. After that, the validation of the filterSchema happens. See Creating a subscription filter for a topic for additional information.

Occurrence: Required

Output

HTTP response headers

See HTTP response headers for details.

HeaderMeaning
LocationThe 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.

StatusMeaning
201Created
400Bad Request
403Forbidden
404Not Found
500Internal Server Error

Error codes

For more on errors, plus the codes of other common errors, see Handling errors.

CodeDomainCategoryMeaning
195000API_NOTIFICATIONAPPLICATIONThere was a problem with an eBay internal system or process. Contact eBay developer support for assistance.
195013API_NOTIFICATIONREQUESTThe subscription id does not exist.
195028API_NOTIFICATIONREQUESTThe application is not authorized to access the specified subscription.
195032API_NOTIFICATIONREQUESTThe specified subscription topic is not filterable.
195033API_NOTIFICATIONREQUESTThe 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.