Skip to main content

Device Init

OPTIONS /deviceInit

Purpose

Provides CORS support information for the endpoint.

Responses

Always 200 OK with CORS response headers.

POST /deviceInit

Purpose

Retrieve contextual parameters for content normalization and user context based on a device. This endpoint should be use during the initialization process of API consumers to get information that will required for other API queries. The following actions are performed:

  1. A device is selected or created based on the provided deviceId,
  2. country location of device is determined based on IP address,
  3. livestream access is determined based on IP address and PBS station localization, and
  4. Passport status is determined based on PBS Account associated with the device's viewer.

Geolocation (country) and localization (station livestream access) is determined using the PBS Localization API.

Payload

Type

JSON in body.

Parameters

ParameterRequiredTypeDescription
deviceIdYesStringUnique identifier of a device.
deviceModelNoStringDevice model.
deviceNameNoStringDevice name.
deviceTypeYesDeviceTypeType of device.
stationIdYesUUIDID of the station associated with the device.
ipAddress parameter
Test parameter only

There is an additional parameter ipAddress avialable in non-production environments only. If set, it will be used instead of the detected IP address. It can be used in local development environmments where it is not possible to retrieve an external IP address for a request.

In the production environment, the client IP address is retrived from the X-Forwarded-For header.

Responses

JSON body with the following properties:

  • country: ISO 3661-1 alpha-2 of geolocated IP address.
  • device
    • deviceId: Unique device ID (matches deviceId from payload).
    • type: Device type (matches deviceType from payload -- does not update).
    • model: Device model.
    • name: Device name.
  • ipAddress: IP addressed used for geolocation and localization.
  • stationId: Unique station ID (matches stationId from payload).
  • viewer
    • id: Unique viewer ID.
    • pbsAccount: PBS Account and membership properties (if available).
      • accountId: PBS Account ID.
      • emailAddress: PBS Account email address (not membership email address).
      • hasLivestreamAccess: Whether the device can access PBS livestreams.
      • hasPassport: Whether the viewer has an active PBS Passport benefit.
      • showVppaScreen: Whether the viewer needs to agree to PBS's VPPA agreement.
    • membershipId: Membership ID from PBS Membership Vault.