Test a subscription with the Notification API
Test a subscription with the Notification API
This is for:
System AdministratorThe 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:
-
Replace
<MyOAuth2Token>
with a Coveo access token that grants you the Subscriptions - Edit privilege in the target Coveo organization, if not already done (see Get the privileges of an access token).
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:
-
Replace
<MyOAuth2Token>
with a Coveo access token that grants you the Activities - View privilege in the target Coveo organization, if not already done (see Get the privileges of an access token).
Response
A successful response (204 No Content
) has no content, but indicates that the service has successfully received the request.
|
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: -
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 HTTPPOST
request against theserviceUrl
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
{}