<?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 Request body could not decode input as JSON in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372110#M20963</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;The follow code (qt c++)&lt;/P&gt;&lt;PRE&gt;QUrl url;
    url.setScheme("https");
    url.setHost("api.dropboxapi.com");
    url.setPath("/2/file_requests/list_v2");

    QUrlQuery params;
    params.addQueryItem("limit", "1000");
    QByteArray qb_params;
    qb_params.append(params.toString(QUrl::FullyEncoded));

    if(checkUrl(url)){
        QNetworkRequest request;    // 
        request.setUrl(url);

        QByteArray auth;
        auth.append(OAuth_);
        auth.prepend("Bearer ");
        request.setRawHeader("Authorization", auth);
        request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

        manager-&amp;gt;post(request, qb_params);      // 
    }&lt;/PRE&gt;&lt;P&gt;got an error:&lt;/P&gt;&lt;PRE&gt;"Error transferring https://api.dropboxapi.com/2/file_requests/list_v2 - server replied: Bad Request"
"Error in call to API function \"file_requests/list:2\": request body: could not decode input as JSON"&lt;/PRE&gt;&lt;P&gt;What's wrong?&lt;/P&gt;</description>
    <pubDate>Thu, 17 Oct 2019 03:25:19 GMT</pubDate>
    <dc:creator>AndreyStrukov</dc:creator>
    <dc:date>2019-10-17T03:25:19Z</dc:date>
    <item>
      <title>Request body could not decode input as JSON</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372110#M20963</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;The follow code (qt c++)&lt;/P&gt;&lt;PRE&gt;QUrl url;
    url.setScheme("https");
    url.setHost("api.dropboxapi.com");
    url.setPath("/2/file_requests/list_v2");

    QUrlQuery params;
    params.addQueryItem("limit", "1000");
    QByteArray qb_params;
    qb_params.append(params.toString(QUrl::FullyEncoded));

    if(checkUrl(url)){
        QNetworkRequest request;    // 
        request.setUrl(url);

        QByteArray auth;
        auth.append(OAuth_);
        auth.prepend("Bearer ");
        request.setRawHeader("Authorization", auth);
        request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

        manager-&amp;gt;post(request, qb_params);      // 
    }&lt;/PRE&gt;&lt;P&gt;got an error:&lt;/P&gt;&lt;PRE&gt;"Error transferring https://api.dropboxapi.com/2/file_requests/list_v2 - server replied: Bad Request"
"Error in call to API function \"file_requests/list:2\": request body: could not decode input as JSON"&lt;/PRE&gt;&lt;P&gt;What's wrong?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 03:25:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372110#M20963</guid>
      <dc:creator>AndreyStrukov</dc:creator>
      <dc:date>2019-10-17T03:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Request body could not decode input as JSON</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372186#M20964</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1220105"&gt;@AndreyStrukov&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Can you clarify, what you really ask? &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@86FF27E33EE6AE58E01795BD66324A7F/images/emoticons/1f914.png" alt=":thinking:" title=":thinking:" /&gt; In the error message is clearly stated: "could not decode input as JSON"!&lt;/P&gt;&lt;P&gt;If you take a look on &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#file_requests-list" target="_self"&gt;list_v2 documentation&lt;/A&gt;, can be seen that parameters have to be in JSON format. Where you encode your parameter ("limit") in JSON? Instead, you use '&lt;A href="https://doc.qt.io/qt-5/qurlquery.html#details" target="_blank" rel="noopener"&gt;QUrlQuery&lt;/A&gt;' class, which functionality mimics classic HTML form encoding (not JSON)! &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@F55D1311E4D274BF094217A54A6087D3/images/emoticons/1f609.png" alt=":wink:" title=":wink:" /&gt;&lt;/P&gt;&lt;P&gt;Hope this gives some direction.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 12:32:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372186#M20964</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2019-10-17T12:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: Request body could not decode input as JSON</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372200#M20965</link>
      <description>&lt;P&gt;Thank you, got it!&lt;/P&gt;&lt;P&gt;I've fixed it and now it works.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 13:10:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Request-body-could-not-decode-input-as-JSON/m-p/372200#M20965</guid>
      <dc:creator>AndreyStrukov</dc:creator>
      <dc:date>2019-10-17T13:10:36Z</dc:date>
    </item>
  </channel>
</rss>

