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:
- A device is selected or created based on the provided deviceId,
- country location of device is determined based on IP address,
- livestream access is determined based on IP address and PBS station localization, and
- 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
Parameter | Required | Type | Description |
---|---|---|---|
deviceId | Yes | String | Unique identifier of a device. |
deviceModel | No | String | Device model. |
deviceName | No | String | Device name. |
deviceType | Yes | DeviceType | Type of device. |
stationId | Yes | UUID | ID of the station associated with the device. |
ipAddress
parameter
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
- 200 OK
- 400 Bad Request
- 403 Forbidden
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.
JSON body with one property:
reason
: Code string indicating the reason for the error:BAD_PAYLOAD
: Invalid or malformed payload.IP_ADDRESS_NOT_FOUND
: IP address could not be obtained from request.LOCALIZATION_ERROR
: Upstream localization provider error.MVAULT_ERROR
: Upstream PBS Membership Vault API error.PBS_ACCOUNT_API_ERROR
: Upstream PBS Account API error.PBS_ACCOUNT_CONFIG_NOT_FOUND
: PBS Account configuration not found for station.STATION_NOT_FOUND
: Provided stationId not found.UNKNOWN_DEVICE_TYPE
: Provided deviceType not valid.
Indicates an invalid Origin
header was passed in a CORS request.