Hi Team,
we are using the Dropbox REST API with OAuth2.
When attempting to get list of groups we are receiving an 'Error 400 bad request' error.
Below is the sample code written in C#:
var webRequest = (HttpWebRequest)WebRequest.Create("https://api.dropbox.com/1/team/groups/list");
webRequest.Method = "POST";
webRequest.Accept = "application/json";
webRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 OPR/26.0.1656.60";
webRequest.ContentType = "application/json";
webRequest.Headers.Add("Authorization: Bearer <accesToken>");
string postData = JsonConvert.SerializeObject(bodyContent);
byte[] bytes = new byte[postData.Length * sizeof(char)];
System.Buffer.BlockCopy(postData.ToCharArray(), 0, bytes, 0, bytes.Length);
webRequest.ContentLength = bytes.Length;
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(bytes, 0, bytes.Length);
dataStream.Close();
var webResponse = (HttpWebResponse)webRequest.GetResponse();
Any suggestion on how to fix this error ?
Thank you