Kay Jun
Kay Jun

Reputation: 21

How can I get SendBird server API working?

I am trying to get a list of channels in SendBird chat api.

curl -d "auth=API_TOKEN" https://api.sendbird.com/channel/list

It keeps returning Invalid Params.

Upvotes: 2

Views: 1283

Answers (2)

Naveen Tiwari
Naveen Tiwari

Reputation: 361

Try To pass Api-Token with Header 

HttpClient client = new HttpClient();

var request = new HttpRequestMessage();            
                request.Headers.Add("Api-Token", SendBirdApiToken);
                request.Method = new HttpMethod("GET");
                request.RequestUri = new Uri(SendBirdUserUrl, UriKind.RelativeOrAbsolute);

                var result = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, CancellationToken.None);

SendBirdApiToken is your App Api-Token on SendBird Portal

Upvotes: 0

Jin Ku
Jin Ku

Reputation: 196

You should use json/application content type and body should be json.

For example:

curl -d '{"auth":"API_TOKEN"}' -H "Content-type: application/json" -X POST https://api.sendbird.com/channel/list

Upvotes: 3

Related Questions