Channel Subscribing

Subscribed channels act like an "inbox" of channels ordered by their most recent messages.

Endpoints:

GET /users/me/channels/subscribed

Token: user

Scope: messages

Retrieve a list of channels the authenticated user is subscribed to.

Example
curl "https://api.pnut.io/v0/users/me/channels/subscribed" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of subscribed channels.

{
    "meta": {
        "more": false,
        "max_id": "0",
        "min_id": "0",
        "unread_counts": {
            "io.pnut.core.pm": 0
        },
        "code": 200
    },
    "data": [
        {"...Channel Object..."}
    ]
}

GET /channels/{channel_id}/subscribers

Scope: messages

Retrieve a list of users subscribed to a channel.

URL Parameters

Name Description
channel_id ID of the channel retrieve subscribers for.
Example
curl "https://api.pnut.io/v0/channels/18/subscribers" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -H "X-Pretty-Json: 1"

Returns a list of users.

{
    "meta": {
        "code": 200
    },
    "data": [
        {"...User Object..."}
    ]
}

PUT /channels/{channel_id}/subscribe

Token: user

Scope: messages

Subscribe to updates from a channel. Subscribing unmutes it, if you were muting it.

URL Parameters

Name Description
channel_id ID of the channel to subscribe to.
Example
curl "https://api.pnut.io/v0/channels/18/subscribe" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -X PUT \
    -H "X-Pretty-Json: 1"

Returns the subscribed channel.

{
    "meta": {
        "code": 200
    },
    "data": {"...Channel Object..."}
}

DELETE /channels/{channel_id}/subscribe

Token: user

Scope: messages

Delete a subscription for a channel. Unsubscribing also deletes any existing stream marker for the channel.

URL Parameters

Name Description
channel_id ID of the channel to unsubscribe from.
Example
curl "https://api.pnut.io/v0/channels/18/subscribe" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" \
    -X DELETE \
    -H "X-Pretty-Json: 1"

Returns the unsubscribed channel.

{
    "meta": {
        "code": 200
    },
    "data": {"....Channel Object..."}
}