Test a subscription with the Notification API

This is for:

System Administrator

The Notification API allows you to test a subscription, meaning that it can send a mock notification to its specified service URL, or to its recipient email address. Testing a subscription can be useful if you need to know what its actual notifications may look like.

Use the Test a subscription for organization operation to test an administration-level subscription, or use the Test a subscription for current user 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/<MyOrganizationId>/subscriptions request path:

POST https://platform.cloud.coveo.com/rest/organizations/<MyOrganizationId>/subscriptions/<MySubscriptionId>/test HTTP/1.1

In the request path:

  • Replace <MyOrganizationId> with the ID of the Coveo organization hosting the subscription.

  • Replace <MySubscriptionId> with the actual ID of the subscription to test.

In the Authorization HTTP header:

User subscription

Use the https://platform.cloud.coveo.com/rest/organizations/<MyOrganizationId>/subscriptions/me request path:

POST https://platform.cloud.coveo.com/rest/organizations/<MyOrganizationId>/subscriptions/me/<MySubscriptionId>/test HTTP/1.1

Content-Type: application/json
Accept: application/json
Authorization: Bearer <MyOAuth2Token>

In the request path:

  • Replace <MyOrganizationId> with the ID of the Coveo organization hosting the subscription.

  • Replace <MySubscriptionId> with the actual ID of the subscription to test.

In the Authorization HTTP header:

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
  • 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:

    {
      "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

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

{}