<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dropbox Business API 'bad request' error in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76724#M2297</link>
    <description>&lt;P&gt;The issue have been resolved. Turns out the problem was caused by the string which was returned by the method call 'JsonConvert.SerializeObject()'.&lt;/P&gt;

&lt;P&gt;Thank you for your help  &lt;/P&gt;</description>
    <pubDate>Fri, 20 Mar 2015 19:26:32 GMT</pubDate>
    <dc:creator>Tamas B.</dc:creator>
    <dc:date>2015-03-20T19:26:32Z</dc:date>
    <item>
      <title>Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76717#M2290</link>
      <description>&lt;P&gt;Hi Team, &lt;/P&gt;

&lt;P&gt;we are using the Dropbox REST API with OAuth2.&lt;BR /&gt;
When attempting to get list of groups we are receiving an 'Error 400  bad request' error.&lt;BR /&gt;
Below is the sample code written in C#:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  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 &amp;lt;accesToken&amp;gt;"); 

  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();
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any suggestion on how to fix this error ?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:44:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76717#M2290</guid>
      <dc:creator>Tamas B.</dc:creator>
      <dc:date>2019-05-29T09:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76718#M2291</link>
      <description>&lt;P&gt;What's the content of the response from the server? There should be an error message explaining what the issue is.&lt;/P&gt;

&lt;P&gt;(Or perhaps you can share what's in &lt;CODE&gt;bodyContent&lt;/CODE&gt; so we can guess as to the issue.)&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 22:44:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76718#M2291</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-03-18T22:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76719#M2292</link>
      <description>&lt;P&gt;BTW, this code is untested, but I think you can simplify to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var webRequest = (HttpWebRequest)WebRequest.Create("https://api.dropbox.com/1/team/groups/list");
webRequest.Method = "POST";
webRequest.ContentType = "application/json";
webRequest.Headers.Add("Authorization: Bearer &amp;lt;accesToken&amp;gt;"); 

using (var streamWriter = new StreamWriter(webRequest.GetRequestStream()))
{
    streamWriter.Write(JsonConvert.SerializeObject(bodyContent));
}

var webResponse = (HttpWebResponse)webRequest.GetResponse();
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FYI, in the case of &lt;CODE&gt;/groups/list&lt;/CODE&gt;, the JSON body should just be &lt;CODE&gt;{}&lt;/CODE&gt;, since this method doesn't take any parameters.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 22:54:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76719#M2292</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-03-18T22:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76720#M2293</link>
      <description>&lt;P&gt;Thank you for your response,&lt;/P&gt;

&lt;P&gt;the 'bodyContent' variable contains an empty JSON dictionary ( {} ).&lt;BR /&gt;
The error details state the following:&lt;BR /&gt;
   Status: Protocol Error&lt;BR /&gt;
   Status Code: Bad Request&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 23:12:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76720#M2293</guid>
      <dc:creator>Tamas B.</dc:creator>
      <dc:date>2015-03-18T23:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76721#M2294</link>
      <description>&lt;P&gt;What's the actual body of the error response, though? The HTTP response should contain a body with details.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 23:13:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76721#M2294</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-03-18T23:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76722#M2295</link>
      <description>&lt;P&gt;FYI, I ran my version of the code (with &lt;CODE&gt;var bodyContent = new { };&lt;/CODE&gt;), and it succeeds. If yours is still failing, we'll really need to see the response body.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Mar 2015 01:08:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76722#M2295</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-03-19T01:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76723#M2296</link>
      <description>&lt;P&gt;The HTTP response contains an empty body (content length = -1 )&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 14:14:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76723#M2296</guid>
      <dc:creator>Tamas B.</dc:creator>
      <dc:date>2015-03-20T14:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76724#M2297</link>
      <description>&lt;P&gt;The issue have been resolved. Turns out the problem was caused by the string which was returned by the method call 'JsonConvert.SerializeObject()'.&lt;/P&gt;

&lt;P&gt;Thank you for your help  &lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 19:26:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76724#M2297</guid>
      <dc:creator>Tamas B.</dc:creator>
      <dc:date>2015-03-20T19:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76725#M2298</link>
      <description>&lt;P&gt;Out of curiosity, in case it happens to someone else in the future, what was the issue with the string that came back from &lt;CODE&gt;JsonConvert.SerializeObject&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Mar 2015 21:56:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76725#M2298</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-03-20T21:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox Business API 'bad request' error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76726#M2299</link>
      <description>&lt;P&gt;The function returned the following string:   "{ }"&lt;BR /&gt;&lt;BR /&gt;
the request  failed on the additional quote marks&lt;/P&gt;</description>
      <pubDate>Sat, 21 Mar 2015 00:02:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-Business-API-bad-request-error/m-p/76726#M2299</guid>
      <dc:creator>Tamas B.</dc:creator>
      <dc:date>2015-03-21T00:02:47Z</dc:date>
    </item>
  </channel>
</rss>

