Update Device ============= .. http:put:: /sk-api/v1/device Update the attributes of a specific device. :reqheader Authorization: The client's :ref:`Authorization header `. :json deviceId: Unique identification number of the device to be updated. Only one of **deviceId** or **serialNumber** can be supplied. :json serialNumber: Serial number of the device to be updated. Only one of **deviceId** or **serialNumber** can be supplied. :json hoursOfOperation: (optional) A configuration dictionary specifying the device's Hours of Operation policy for when Proof of Play logs are recorded. :json timezone: (optional) The device's timezone attribute. Example: ``"US/Central"``. :status 200 OK: Successfully updated the device. :Response Data: - **connectionType** -- The type of physical connection the device uses to connect to the internet. - **contentManagerDisplayName** -- The device's name in Skykit Content Manager. - **contentManagerLocation** -- The device's location in Skykit Content Manager. - **contentPending** -- The name of the pending media item set to play next, if any. - **controlVersionName** -- The device's custom admin app version (Android only). If absent, app is either not installed, or an older version is installed that does not report its version. - **created** -- The date when the device was created inside of Skykit. - **displayRatio** -- The device's display ratio when rendering content. - **heartbeatUpdated** -- The last time that the device made a successful heartbeat request. A "heartbeat" is a snapshot of a device's state, posted to Skykit every few minutes. - **homeVersionName** -- The device's custom home screen app version (Android only). If absent, app is either not installed, or an older version is installed that does not report its version. - **hoursOfOperation** -- The hours during the day when proof of play logs will captured. - **id** -- The device's unique identifier. - **lastPlayedContentName** -- The name of the last piece of content reported by this device. - **launcherVersionName** -- The device's legacy custom home screen app version (Android only). If absent, app is either not installed, or an older version is installed that does not report its version. - **macAddress** -- The active MAC address of this device. - **managingOrgCode** -- The unique identification code of the managing organization to which this device belongs. - **managingOrgName** -- The name of the managing organization to which this device belongs. - **model** -- The device's hardware model. - **notes** -- User-supplied notes pertaining to this device. - **online** -- A boolean indicating whether the device is currently online (``true``) or offline (``false``). - **orientation** -- The device's orientation: ``vertical`` or ``horizontal``. - **os** -- The device's operating system. - **osVersion** -- The operating system version. - **serialNumber** -- The device's serial number. - **skykitPlayerVersion** -- The version of the Skykit player running on this device (both Android and Chrome). - **streamSpeed** -- Content download speed in Mbps. - **tenantCode** -- The unique identification code of the tenant to which this device belongs. - **tenantName** -- The name of the tenant to which this device belongs. - **timezone** -- The device's timezone setting. - **usageType** -- Description field to indicate how the device is to be used inside of Skykit. :status 400 Bad Request: Request parameters invalid. :Response Data: - **message** -- A human-readable message explaining what went wrong. :status 401 Unauthorized: Authorization headers invalid. :Response Data: - **message** -- Unauthorized for URL. :status 403 Forbidden: Something was wrong in the authentication headers. :Response Data: - **message** -- Insufficient permission. **Example request**: .. sourcecode:: http PUT /sk-api/v1/device HTTP/1.1 **Example response**: .. sourcecode:: http HTTP/1.1 200 OK Content-Type: application/json .. sourcecode:: javascript { "connectionType": "WiFi", "contentManagerDisplayName": "Test Display", "contentManagerLocation": "Office", "contentPending": "", "controlVersionName": null, "created": "2019-04-20T15:20:24.023Z", "displayRatio": "16:9", "heartbeatUpdated": "2019-06-20T16:16:16.890Z", "homeVersionName": null, "hoursOfOperation": { "mon": {"startTime": "07:00", "endTime": "18:00"}, "tue": {"startTime": "07:00", "endTime": "18:00"}, "wed": {"startTime": "07:00", "endTime": "18:00"}, "thu": {"startTime": "07:00", "endTime": "18:00"}, "fri": {"startTime": "07:00", "endTime": "18:00"}, "sat": {"startTime": "10:00", "endTime": "19:00"}, "sun": {"startTime": "10:00", "endTime": "16:00"}, "excludeDates": [ "2019-01-08", "2019-11-28", "2019-12-25" ] }, "id": "a4e9e20dc0614df99a86bc3223c7c6c4", "lastPlayedContentName": "video 2", "launcherVersionName": "136.1.1", "macAddress": "3g3gh6wf5twg", "managingOrgCode": "skykit", "managingOrgName": "Skykit", "model" "ASUS Chromebox CN60", "notes": "", "online": true, "orientation": "horizontal", "os": "cros", "osVersion": "74.0.3729.159", "serialNumber": "SN0010287", "skykitPlayerVersion": "113.0.1", "streamSpeed": 3, "tenantCode": "skykit_example_tenant", "tenantName": "Skykit Example Tenant", "timezone": "US/Central", "usageType": "Installed" } **Example usage**: .. sourcecode:: python from sign_jwt import make_headers # see: Authentication import requests BASE_URI = 'https://skykit-provisioning.appspot.com' UPDATE_DEVICE_ENDPOINT = 'sk-api/v1/device' URI = '{}/{}'.format(BASE_URI, UPDATE_DEVICE_ENDPOINT) def update_device(device_id=None, serial_number=None, timezone=None, hours_of_operation=None): headers = make_headers() if device_id: json_params = {'deviceId': device_id} elif serial_number: json_params = {'serialNumber': serial_number} if timezone: json_params['timezone'] = timezone if hours_of_operation: json_params['hoursOfOperation'] = hours_of_operation response = requests.put(URI, json=json_params, headers=headers) response.raise_for_status() return response.json() example_device_id = '4b08680c1ec04f72bc20134b23249039 new_timezone = 'America/New_York new_hours_of_operation = { 'mon': {'startTime': '07:00', 'endTime': '18:00'}, 'tue': {'startTime': '07:00', 'endTime': '18:00'}, 'wed': {'startTime': '07:00', 'endTime': '18:00'}, 'thu': {'startTime': '07:00', 'endTime': '18:00'}, 'fri': {'startTime': '07:00', 'endTime': '18:00'}, 'sat': {'startTime': '10:00', 'endTime': '19:00'}, 'sun': {'startTime': '10:00', 'endTime': '16:00'}, 'excludeDates': [ '2020-11-28', '2020-12-25', '2021-01-08', ] } update_device( device_id=example_device_id, timezone=new_timezone, hours_of_operation=new_hours_of_operation ) **Hours of operation** The ``hoursOfOperation`` key explicitly defines Proof of Play logging windows. Such logging is disabled by default. Weekday keys enable logging between the ``"startTime"`` and ``"endTime"`` hours. ``"excludeDates"`` specifically disables logging for the entirety of the dates included, overriding the otherwise specified weekday policy. **Hours of operation rules**: * Passing ``hoursOfOperation`` will prompt a full overwrite of the existing configuration. Leaving weekday or ``excludeDates`` keys absent will not persist values from the previous configuration. * If a weekday key is passed, both ``startTime`` and ``endTime`` must be included, or the request will fail. * The ``startTime`` value must be less than the ``endTime`` value. * To enable Proof of Play logging for an entire day, pass the hours ``{"startTime": "00:00", "endTime": "23:59"}``. * To disable logging for an entire day, omit the weekday key from the ``"hoursOfOperation"`` body. Alternatively, pass the hours ``{"startTime": "00:00", "endTime": "00:00"}``. * The ``startTime`` and ``endTime`` values must follow the regex pattern ``^([0-1]?\d|2[0-3]):([0-5]\d)$``. * ``excludedDates`` values must follow the regex pattern ``^\d{4}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$``. **Accepted timezone values**: .. sourcecode:: python 'Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Bahia', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Costa_Rica', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Martinique', 'America/Mazatlan', 'America/Menominee', 'America/Merida', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/Syowa', 'Antarctica/Vostok', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Colombo', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Ulaanbaatar', 'Asia/Urumqi', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faroe', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/Perth', 'Australia/Sydney', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Athens', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Helsinki', 'Europe/Istanbul', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Oslo', 'Europe/Paris', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/Simferopol', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zaporozhye', 'Europe/Zurich', 'GMT', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'US/Alaska', 'US/Central', 'US/Eastern', 'US/Hawaii', 'US/Mountain', 'US/Pacific', 'UTC'