Add an APNs device token

POST https://zulip.fairsharing.org/api/v1/users/me/apns_device_token

This endpoint adds an APNs device token to register for iOS push notifications.

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

request = {"token": "apple-tokenbb", "appid": "org.zulip.Zulip"}
result = client.call_endpoint(url="/users/me/apns_device_token", method="POST", request=request)
print(result)

curl -sSX POST https://zulip.fairsharing.org/api/v1/users/me/apns_device_token \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode token=apple-tokenbb \
    --data-urlencode appid=org.zulip.Zulip

Parameters

token string required

Example: "apple-tokenbb"

The token provided by the device.


appid string required

Example: "org.zulip.Zulip"

The ID of the Zulip app that is making the request.

Changes: In Zulip 8.0 (feature level 223), this parameter was made required. Previously, if it was unspecified, the server would use a default value (based on the ZULIP_IOS_APP_ID server setting, which defaulted to "org.zulip.Zulip").


Response

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success"
}

A typical failed JSON response for when the token's length is invalid or it is empty:

{
    "code": "BAD_REQUEST",
    "msg": "Empty or invalid length token",
    "result": "error"
}

A typical failed JSON response for when the APNs token is invalid:

{
    "code": "BAD_REQUEST",
    "msg": "Invalid APNS token",
    "result": "error"
}