Channel Subscription

Get current user’s subscribed channels

Retrieve an “inbox” of the channels the user is currently subscribed to. This stream is ordered like an inbox with the stream containing the most recent post first.

The meta response will contain unread counts for common channel types.

This endpoint responds to general Channel parameters.

Responses from this endpoint are paginated.

Endpoint

Method URL Token Scope
GET https://api.app.net/channels User public_messages or messages

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/channels"
{
  "data": [
    {
      "counts": {
        "messages": 42,
        "subscribers": 43
      },
      "has_unread": false,
      "id": "1",
      "owner": "...user object...",
      "is_inactive": false,
      "readers": {
        "any_user": false,
        "immutable": false,
        "public": true,
        "user_ids": [

        ],
        "you": true
      },
      "editors": {
        "any_user": false,
        "immutable": false,
        "public": false,
        "user_ids": [

        ],
        "you": true
      },
      "recent_message_id": "231",
      "recent_message": "...message object...",
      "type": "com.example.channel",
      "writers": {
        "any_user": false,
        "immutable": false,
        "public": false,
        "user_ids": [

        ],
        "you": true
      },
      "you_can_edit": true,
      "you_subscribed": true,
      "you_muted": false,
      "pagination_id": "146"
    }
  ],
  "meta": {
    "code": 200,
    "more": true,
    "unread_counts": {
      "net.app.core.pm": 5,
      "net.app.core.broadcast": 3
    },
    "min_id": "146",
    "max_id": "146"
  }
}

Subscribe to a Channel

Subscribe to a Channel. This adds it to your Channel stream. If a user has muted this Channel, this call will automatically unmute the Channel.

This endpoint responds to general Channel parameters.

Endpoint

Method URL Token Scope
POST https://api.app.net/channels/{channel_id}/subscribe User public_messages or messages

URL Parameters

Name Description
channel_id The id of the Channel to subscribe to.

Example

to see more complete examples.

curl -X POST -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/channels/1/subscribe"
{
  "data": {
    "counts": {
      "messages": 42,
      "subscribers": 43
    },
    "has_unread": false,
    "id": "1",
    "owner": "...user object...",
    "is_inactive": false,
    "readers": {
      "any_user": false,
      "immutable": false,
      "public": true,
      "user_ids": [

      ],
      "you": true
    },
    "editors": {
      "any_user": false,
      "immutable": false,
      "public": false,
      "user_ids": [

      ],
      "you": true
    },
    "recent_message_id": "231",
    "recent_message": "...message object...",
    "type": "com.example.channel",
    "writers": {
      "any_user": false,
      "immutable": false,
      "public": false,
      "user_ids": [

      ],
      "you": true
    },
    "you_can_edit": true,
    "you_subscribed": true,
    "you_muted": false
  },
  "meta": {
    "code": 200
  }
}

Unsubscribe from a Channel

Unsubscribe from a Channel. This removes it from your Channel stream.

This endpoint responds to general Channel parameters.

Endpoint

Method URL Token Scope
DELETE https://api.app.net/channels/{channel_id}/subscribe User public_messages or messages

URL Parameters

Name Description
channel_id The id of the Channel to unsubscribe from.

Example

to see more complete examples.

curl -X DELETE -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/channels/1/subscribe"
{
  "data": {
    "counts": {
      "messages": 42,
      "subscribers": 42
    },
    "has_unread": false,
    "id": "1",
    "owner": "...user object...",
    "is_inactive": false,
    "readers": {
      "any_user": false,
      "immutable": false,
      "public": true,
      "user_ids": [

      ],
      "you": true
    },
    "editors": {
      "any_user": false,
      "immutable": false,
      "public": false,
      "user_ids": [

      ],
      "you": true
    },
    "recent_message_id": "231",
    "recent_message": "...message object...",
    "type": "com.example.channel",
    "writers": {
      "any_user": false,
      "immutable": false,
      "public": false,
      "user_ids": [

      ],
      "you": true
    },
    "you_can_edit": true,
    "you_subscribed": false,
    "you_muted": false
  },
  "meta": {
    "code": 200
  }
}

Retrieve users subscribed to a Channel

Retrieve the users who are subscribed to a Channel.

This endpoint responds to general Channel parameters.

Responses from this endpoint are paginated.

Endpoint

Method URL Token Scope
GET https://api.app.net/channels/{channel_id}/subscribers Any public_messages or messages

URL Parameters

Name Description
channel_id The id of the Channel to retrieve subscribers for.

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/channels/1/subscribers"
{
  "data": [
    {
      "counts": {
        "messages": 42,
        "subscribers": 43
      },
      "has_unread": false,
      "id": "1",
      "owner": "...user object...",
      "is_inactive": false,
      "readers": {
        "any_user": false,
        "immutable": false,
        "public": true,
        "user_ids": [

        ],
        "you": true
      },
      "editors": {
        "any_user": false,
        "immutable": false,
        "public": false,
        "user_ids": [

        ],
        "you": true
      },
      "recent_message_id": "231",
      "recent_message": "...message object...",
      "type": "com.example.channel",
      "writers": {
        "any_user": false,
        "immutable": false,
        "public": false,
        "user_ids": [

        ],
        "you": true
      },
      "you_can_edit": true,
      "you_subscribed": true,
      "you_muted": false,
      "pagination_id": "82"
    }
  ],
  "meta": {
    "code": 200,
    "more": true,
    "min_id": "82",
    "max_id": "82"
  }
}

Retrieve user ids subscribed to a Channel

Retrieve all the user ids who are subscribed to a Channel.

Endpoint

Method URL Token Scope
GET https://api.app.net/channels/{channel_id}/subscribers/ids Any public_messages or messages

URL Parameters

Name Description
channel_id The id of the Channel to retrieve subscriber ids for.

Example

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/channels/1/subscribers/ids"
{
  "data": [
    "1"
  ],
  "meta": {
    "code": 200
  }
}

Retrieve user ids subscribed to multiple Channels

For each requested Channel, retrieve the ids of all Users who are subscribed to that Channel. Up to 200 Channels may be requested at one time. Channels which do not exist or which the requesting user does not have authorization to view will not be returned.

Endpoint

Method URL Token Scope
GET https://api.app.net/channels/subscribers/ids Any public_messages or messages

Query String Parameters

Name Description
ids A comma separated list of Channel ids to retrieve subscriber ids for.

Example

Channels 3 and 5 are omitted as if they are not visible or do not exist

to see more complete examples.

curl -H "Authorization: Bearer <YOUR ACCESS TOKEN>" -H "X-ADN-Pretty-JSON: 1" \
    "https://api.app.net/channels/1/subscribers/ids?ids=1,2,3,5"
{
  "data": {
    "1": [
      "5",
      "10"
    ],
    "2": [
      "5",
      "20"
    ]
  },
  "meta": {
    "code": 200
  }
}