Get Channel Data by CID (All the data)
curl --location --request POST 'https://chat.stream-io-api.com/channels?api_key={api_key}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"filter_conditions" :
{
"cid" : "messaging:testing123"
}
}'
With a minor tweak, you only get the Channel Data
curl --location --request POST 'https://chat.stream-io-api.com/channels/messaging/testing123?api_key={API_KEY}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"data" : { }
}'
Note - This did not clear the channel data.
QueryUser by ID
curl --location -g --request GET 'https://chat.stream-io-api.com/users?payload={%22filter_conditions%22%20:%20{%20%20%22id%22:%20%22Seetha%22%20}%20}%20%20&api_key={api_key}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--data-raw ''
UpdateUser
curl --location --request POST 'https://chat.stream-io-api.com/users?api_key={api_key}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"users": { "Lakshmi": { "id" : "Lakshmi", "name": "Seethalakshmi" }}
}'
Add Members
curl --location --request POST 'https://chat.stream-io-api.com/channels/{channel_type}/{channel-id}?api_key={api_key}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"add_members" : ["Seetha", "Viswa"]
}'
Remove Members
curl --location --request POST 'https://chat.stream-io-api.com/channels/{channel_type}/{channel-id}?api_key={api_key}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"remove_members" : ["Seetha", "Viswa"]
}'
Update Role (Server Side Auth)
curl --location --request POST 'https://chat.stream-io-api.com/users?api_key={api_key}' \
--header 'Accept: application/json' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"users": { "Lakshmi": { "id" : "Lakshmi", "role": "channel_moderator" }}
}'
Add Moderators (Server Side Auth)
curl --location --request POST 'https://chat.stream-io-api.com/channels/{channel_type}/{channel-id}?api_key={api_key}' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"add_moderators" : ["Bree"]
}'
Remove Moderators (Server Side Auth)
curl --location --request POST 'https://chat.stream-io-api.com/channels/{channel_type}/{channel-id}?api_key={api_key}' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"demote_moderators" : ["Bree"]
}'
Send Message
curl --location --request POST 'https://chat.stream-io-api.com/channels/{channel_type}/{channel-id}/message?api_key={api_key}' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"message" :
{
"text" : "Hello World",
"user" : { "id" : "Lakshmi" }
}
}'
Send Custom Event
curl --location --request POST 'https://chat.stream-io-api.com/channels/{channel_type}/{channel-id}/event?api_key={api_key}' \
--header 'Stream-Auth-Type: jwt' \
--header 'Authorization: {{ YOUR TOKEN HERE }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"event":{
"type":"friendship_request",
"text":"Hey there, long time no see! "
"user_id":"Zachery",
}
}'
Find more REST requests here.
Comments
0 comments
Please sign in to leave a comment.