Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Protocol Device

Rick Mak edited this page Apr 7, 2017 · 1 revision

device:register

Overview

Registers a device to receive remote push notifications from Ourd Server.

Parameters

  • id (string, optional)

    The unique device id associated with the registering device.

    This field is optional. It is the server's responsiblity to generate this field if omitted.

    If device id is supplied, server looks up existing devices with the supplied id and update its information accordingly. It is an error if no devices can be found with the supplied id.

    App developer should omit this field the first time registering a user device, but include this field in subsequent calls.

  • access_token (string, required)

    Access token of the user who is requesting. The user will own the registering device upon success.

  • type (string, required)

    The platform of the device to receive remote push notification. Permitted values are:

    • ios: for iOS device
    • android: for Android device
  • device_token (string, required)

    The unique token of the device for the purpose of receiving remote push notification. Its meanings is platform-specific.

    • iOS: It is the deviceToken from the delegate method -application:application didRegisterForRemoteNotificationsWithDeviceToken: after calling -registerForRemoteNotifications.

    • Android: It is the registration_id return from GoogleCloudMessaging.register.

    App developer is responsible to check and update device token by calling this endpoint with device id if device token changed ( the check is typically done on app start up).

Returns

  • id (string)

    The id of this device. App developer is responsible to persistent this value for later uses to update device_token.

    • Android device_token changes on app version change. You will want to change the device token rather than re-subscription.

Errors

  • device_not_found (string)

    device_not_found is returned when device id is supplied in the request but no entries is found with the supplied id.

Clone this wiki locally