Dynamic Service Worker API Endpoint

Update the registered service worker path for a container using the Dynamic Service Worker API endpoint.

Update a container’s registered service worker path with the Dynamic Service Worker API endpoint.

Authenticate

Before you update a service worker path, obtain a valid bearer token (an access token used to authorize requests) from the authentication endpoint. Taboola issues your client_id and client_secret in advance.

Send a POST request with your credentials:

POST https://authentication.taboola.com/authentication/oauth/token?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials

A successful request returns a bearer token. Include the returned access token in the Authorization header of every subsequent request to the epsilon service:

Authorization: Bearer {access_token}

Update the service worker path

  1. Obtain the publisher’s container ID from your account manager. This is the same value used as the app ID and tag ID elsewhere in this documentation.

  2. Send a PATCH request to:

    https://pushcms.taboola.com/epsilon/container/sw-path
  3. Include the container ID, domain-relative service worker path, and the person performing the update in the JSON request body:

    {
      "containerId": "11111",
      "serviceWorkerPath": "/sw.js",
      "performer": "test.performer"
    }

Request body

FieldTypeRequiredDescription
containerIdstringYesThe container ID for the publisher. Obtain it from your account manager.
serviceWorkerPathstringYesThe path to the service worker file relative to your domain, such as /sw.js or /custom-sw-path.js.
performerstringYesIdentifies the person who made the update, typically an email address or user name.

Responses

StatusMeaning
204 No ContentThe service worker path was updated successfully.
400 Bad RequestThe request is invalid because validation or authorization failed.
404 Not FoundThe supplied container ID is not valid.
500 Internal Server ErrorAn internal server error occurred.

Optional: Verify authorized containers

If you are unsure which containers (AKA apps/tags) you can target, send a GET request to:

https://pushcms.taboola.com/epsilon/push/auth-apps

The response provides the tagId values for websites and apps that you are authorized to target with push notifications.