--- title: Test a subscription with the Notification API slug: '44' canonical_url: https://docs.coveo.com/en/44/ collection: manage-an-organization source_format: adoc --- # Test a subscription with the Notification API The Notification API allows you to _test_ a [subscription](https://docs.coveo.com/en/248/), meaning that it can send a mock [notification](https://docs.coveo.com/en/221/) to its specified service URL, or to its recipient email address. Use the [Test a subscription for organization](https://platform.cloud.coveo.com/docs?urls.primaryName=Notification#/Subscription/rest_organizations_paramId_subscriptions_paramId_test_post) operation to test an administration-level subscription, or use the [Test a subscription for current user](https://platform.cloud.coveo.com/docs?urls.primaryName=Notification#/Subscription/rest_organizations_paramId_subscriptions_me_paramId_test_post) operation to test a user-level subscription. ## Request templates > **Note** > > It's impossible to authenticate either of the following calls using an API key, because the service needs to be able to retrieve an email address from the access token to test the subscription. **Administrator subscription** Use the `+https://platform.cloud.coveo.com/rest/organizations//subscriptions+` request path: ```http POST https://platform.cloud.coveo.com/rest/organizations//subscriptions//test HTTP/1.1 ``` In the request path: * Replace `` with the [ID of the Coveo organization](https://docs.coveo.com/en/148/) hosting the subscription. * Replace `` with the actual ID of the subscription to test. In the `Authorization` HTTP header: * Replace `` with a [Coveo access token](https://docs.coveo.com/en/123/) that grants you the **Subscriptions - Edit** [privilege](https://docs.coveo.com/en/228/) in the target Coveo organization, if not already done (see [Get the privileges of an access token](https://docs.coveo.com/en/109/)). **User subscription** Use the `+https://platform.cloud.coveo.com/rest/organizations//subscriptions/me+` request path: ```http POST https://platform.cloud.coveo.com/rest/organizations//subscriptions/me//test HTTP/1.1 Content-Type: application/json Accept: application/json Authorization: Bearer ``` In the request path: * Replace `` with the [ID of the Coveo organization](https://docs.coveo.com/en/148/) hosting the subscription. * Replace `` with the actual ID of the subscription to test. In the `Authorization` HTTP header: * Replace `` with a [Coveo access token](https://docs.coveo.com/en/123/) that grants you the **Activities - View** privilege in the target Coveo organization, if not already done (see [Get the privileges of an access token](https://docs.coveo.com/en/109/)). ## Response A successful response (`204 No Content`) has no content, but indicates that the service has successfully received the request. > **Important** > > * A successful response doesn't imply that the mock notification was actually sent to, or received by the subscription recipient. > > * Subscription statistics data is logged as usual for mock notifications. > > * Each test you perform on an `"EMAIL"` or `"EMAIL_JSON"` subscription counts against the daily email notifications limit of the Coveo organization hosting the subscription. ## Notification Assuming that the service successfully processes and sends the mock notification: * If you're testing an `"EMAIL"` subscription, the subscription recipient should receive a user-friendly email notification like the following: ![Email subscription test](https://docs.coveo.com/en/assets/images/coveo-platform/attachments/38732017/38699285.png) * If you're testing an `"EMAIL_JSON"` subscription, the subscription recipient should receive an un-formatted email notification with mock JSON data like the following: ```json { "id" : "vr5h2iu3xp3sifbptrxovc2mkq", "operation" : "REBUILD", "state" : "EXECUTED", "result" : "ERROR", "content" : { }, "createDate" : 1511371291987, "startDate" : 1511371291987, "triggeredBy" : { "displayName" : "asmith@example.com-google" }, "organizationId" : "mycoveocloudv2organizationg8tp8wu3", "resourceName" : "Generated test activity", "resourceType" : "SOURCE" } ``` * If you're testing a `"WEB_HOOK"` subscription, the same mock JSON data will be used as the body of an HTTP POST request against the `serviceUrl` specified in the tested subscription configuration. ## Sample request **Testing an administrator subscription** ```http POST https://platform.cloud.coveo.com/rest/organizations/mycoveocloudv2organizationg8tp8wu3/subscriptions/vr5h2iu3xp3sifbptrxovc2mkq/test HTTP/1.1 Content-Type: application/json Accept: application/json Authorization: Bearer **********-****-****-****-************ ``` **Successful response - 204 No Content** ```json {} ```