Get channel subscription list

Prev Next

Available in Classic and VPC

Get channel subscription information of a user.

Request

This section describes the request format. The method and URI are as follows:

Method URI
GET /v1/api/subscriptions

Request headers

For information about the headers common to all Ncloud Chat APIs, see Ncloud Chat request headers.

Request query parameters

You can use the following query parameters with your request:

Field Type Required Description
filter String Required Filtering criteria
  • Filters by some fields in the response body.
  • Filters only full matches.
  • Enter an empty value {} if there is no criteria.
  • Example: {"channel_id":"{Channel ID}"}, {"user_id":"{User ID}"}, {"online":true}
sort String Optional Sort by
  • Enter in the form of {Criteria:Method}.
    • Criteria: String type fields in the response body
    • Method: -1 | 1
      • -1: Descending
      • 1: Ascending
  • e.g., {"created_at":"-1"}: Descending by creation date and time
option String Optional Additional options: Option
  • e.g., {"offset":0,"per_page":20}: Display the first 20 items.

Option

The following describes Option.

Field Type Required Description
offset Number Optional Query start offset
  • 0-N
per_page Number Optional Number of items per page
  • 1-100
count Boolean Optional Whether to display the number of response results instead of a list
  • true | false
    • true: Display the response result count.
    • false: Display the list.

Request example

The request example is as follows:

curl --location --request GET 'https://dashboard-api.ncloudchat.naverncp.com/v1/api/subscriptions
?filter=%7B%22user_id%22%3A%22NCP001%22%7D
&sort=%7B%22created_at%22%3A%22-1%22%7D
&option=%7B%22offset%22%3A0%2C%22per_page%22%3A20%7D' \
--header 'x-api-key: {API Key}' \
--header 'x-project-id: {Project ID}'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
id String - Subscription unique ID
project_id String - Project ID
channel_id String - Channel ID
user_id String - User ID
online Boolean - Online status
  • true | false
    • true: Online
    • false: Offline
language String - Language
push Boolean - Whether to allow push notifications
  • true | false
    • true: Allow
    • false: Block
mute Boolean - Whether to mute channel
  • true | false
    • true: Mute
    • false: Not mute
user Object - User information
user.name String - User name
user.profile String - User profile image
mark Object - Last message information
mark.user_id String - Sender ID
mark.message_id String - Message ID
mark.sort_id String - Delivery date and time
  • Unix timestamp format
mark.unread String - Number of unread messages since

Response status codes

For information about the HTTP status codes common to all Ncloud Chat APIs, see Common Ncloud Chat response status codes.

Response example

The response example is as follows:

[
    {
        "id": "78e6d8ca-****-****-****-6ebe51af5906",
        "project_id": "8be54b8b-****-****-****-84c0d5df2e9c",
        "channel_id": "17563b23-****-****-****-de11ce1ff34a",
        "user_id": "NCP001",
        "online": false,
        "language": "",
        "push": true,
        "mute": false,
        "user": {
            "name": "Baby tree",
            "profile": ""
        },
        "mark": {
            "user_id": "NCP001",
            "message_id": "66a04**********b5b4d9e10",
            "sort_id": "1721780063170",
            "unread": 117
        }
    },
    {
        "id": "4fed04e9-****-****-****-dcd4c180079c",
        "project_id": "8be54b8b-****-****-****-84c0d5df2e9c",
        "channel_id": "a7adab41-****-****-****-961f661dcefd",
        "user_id": "NCP001",
        "online": false,
        "language": "",
        "push": true,
        "mute": false,
        "user": {
            "name": "Baby tree",
            "profile": ""
        },
        "mark": {
            "user_id": "NCP001",
            "message_id": "",
            "sort_id": "",
            "unread": 24
        }
    }
]