<?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: Response headers in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296352#M17995</link>
    <description>&lt;P&gt;thanks for replying.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the " . " it actualy not at the end of the string , i accidentally added it in the api-arg.&lt;/P&gt;
&lt;P&gt;i tryed to solve it by other ways.&lt;/P&gt;
&lt;P&gt;in addition , what formats for path in dropbox-api header? utf-8? or unicode ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Sep 2018 10:02:24 GMT</pubDate>
    <dc:creator>wheel</dc:creator>
    <dc:date>2018-09-10T10:02:24Z</dc:date>
    <item>
      <title>Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/295841#M17972</link>
      <description>&lt;P&gt;when i use dropbox api for uploading file.&amp;nbsp; the http header contain chinese, for example:&lt;/P&gt;
&lt;P&gt;"Dropbox-API-Arg:{\"path\": \"/Test/&lt;STRONG&gt;中文&lt;/STRONG&gt;.doc\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}".&lt;/P&gt;
&lt;P&gt;it will response error message:&lt;/P&gt;
&lt;P&gt;Error in call to API function "files/upload": HTTP header "Dropbox-API-Arg": could not decode input as JSON&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;how should i do?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;thanks.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:10:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/295841#M17972</guid>
      <dc:creator>wheel</dc:creator>
      <dc:date>2019-05-29T09:10:36Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/295855#M17976</link>
      <description>&lt;P&gt;For these calls with the parameters in the header, you need to escape these characters. That is, when you use the “Dropbox-API-Arg” header, you need to make it “HTTP header safe”. This means using JSON-style “\uXXXX” escape codes for the character 0x7F and all non-ASCII characters.&lt;/P&gt;
&lt;P&gt;Some, but not all, languages/libraries do this for you. For example, for JavaScript, to&amp;nbsp;do this yourself you could do something like this:&lt;/P&gt;
&lt;PRE&gt;var charsToEncode = /[\u007f-\uffff]/g;&lt;BR /&gt;function http_header_safe_json(v) {&lt;BR /&gt; return JSON.stringify(v).replace(charsToEncode,&lt;BR /&gt; function(c) { &lt;BR /&gt; return '\\u'+('000'+c.charCodeAt(0).toString(16)).slice(-4);&lt;BR /&gt; }&lt;BR /&gt; );&lt;BR /&gt;}&lt;/PRE&gt;
&lt;P&gt;and then:&lt;/P&gt;
&lt;PRE&gt;"Dropbox-API-Arg": http_header_safe_json(arg)&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Sep 2018 11:35:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/295855#M17976</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-09-06T11:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296013#M17990</link>
      <description>&lt;P&gt;Thanks for replying.&lt;/P&gt;
&lt;P&gt;I use dropbox api with winhttp and c.&lt;/P&gt;
&lt;P&gt;Now, i'm trying to encode chinese to unicode. For example:&lt;/P&gt;
&lt;P&gt;"工作.doc" --&amp;gt;&amp;nbsp; "\u5de5\u4f5c.doc" ,&lt;/P&gt;
&lt;P&gt;and the header is ：&lt;/P&gt;
&lt;PRE&gt;Dropbox-API-Arg:{\"path\": \"/Test/\u5de5\u4f5c.doc\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}.&lt;/PRE&gt;
&lt;P&gt;But it also response error message:&lt;/P&gt;
&lt;PRE&gt;Error in call to API function "files/upload": HTTP header "Dropbox-API-Arg": could not decode input as JSON.&lt;/PRE&gt;
&lt;P&gt;So, if i want to create the filename with chinese,&amp;nbsp; what format should i input to header?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 07:59:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296013#M17990</guid>
      <dc:creator>wheel</dc:creator>
      <dc:date>2018-09-07T07:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296057#M17993</link>
      <description>&lt;P&gt;It looks like you're properly escaping the Unicode characters, but you have an extra period at the end of the string, making it invalid JSON. Remove that extra "." and try again.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 13:36:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296057#M17993</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-09-07T13:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296352#M17995</link>
      <description>&lt;P&gt;thanks for replying.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the " . " it actualy not at the end of the string , i accidentally added it in the api-arg.&lt;/P&gt;
&lt;P&gt;i tryed to solve it by other ways.&lt;/P&gt;
&lt;P&gt;in addition , what formats for path in dropbox-api header? utf-8? or unicode ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 10:02:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296352#M17995</guid>
      <dc:creator>wheel</dc:creator>
      <dc:date>2018-09-10T10:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296404#M17997</link>
      <description>&lt;P&gt;The value sent in the header should be all ASCII, with JSON-style “\uXXXX” escape codes for the character 0x7F and all non-ASCII characters. The last sample you shared is correct, except for that period.&lt;/P&gt;
&lt;P&gt;The path format itself is the same as elsewhere in the API. That is, non-root paths should start with "/" and also use "/" as the path component delimiter.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If something still isn't working as expected, please share some code that reproduces the issue so we can investigate.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 13:29:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296404#M17997</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-09-10T13:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296538#M18004</link>
      <description>&lt;P&gt;i add the header by the winapi&amp;nbsp;WinHttpAddRequestHeaders.&lt;/P&gt;
&lt;P&gt;and then,if the header as follows:&lt;/P&gt;
&lt;PRE&gt;Dropbox-API-Arg:{\"path\": \"/Test/&lt;FONT color="#FF0000"&gt;中文&lt;/FONT&gt;\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}
Content-Type: application/octet-stream
Authorization: Bearer &amp;lt; token &amp;gt; &lt;/PRE&gt;
&lt;P&gt;my ide is vs2017, i put these string in the array . and i use the function MultiByteToWideChar() encode the header to&amp;nbsp; LPCWSTR. it will response error message.&lt;/P&gt;
&lt;P&gt;in other words, if&amp;nbsp; the path contain Chinese characters, it will response errror message.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 02:44:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296538#M18004</guid>
      <dc:creator>wheel</dc:creator>
      <dc:date>2018-09-11T02:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296755#M18007</link>
      <description>&lt;P&gt;Can you share the actual complete code that reproduces this issue? It's hard to say what the problem might be from this description.&lt;/P&gt;
&lt;P&gt;I do see that you're also escaping each&amp;nbsp;" with a \. That may or may not be necessary, depending on the context in which you're doing this. I can't say without more information, but you may want to try removing those.&lt;/P&gt;
&lt;P&gt;Also, in practice in&amp;nbsp;recommend having a library build the JSON for you anyway, instead of manually constructing it.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 16:33:51 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/296755#M18007</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2018-09-11T16:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/430974#M22832</link>
      <description>&lt;P&gt;when I create a okhttp request in andorid , I create json from gson。I request&amp;nbsp;&lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt;&lt;/P&gt;&lt;P&gt;and submit param json&amp;nbsp; like&amp;nbsp;{"autorename":true,"mode":"add","mute":false,"path":"/\\u6d4b\\u8bd5.pdf","strict_conflict":false} . the Chinese char&amp;nbsp; is encode Unicode . But I got&amp;nbsp; a response below&lt;/P&gt;&lt;P&gt;upload result : {"error_summary": "path/malformed_path/", "error": {".tag": "path", "reason": {".tag": "malformed_path"}, "upload_session_id": "AAAAAAAAALgh7xt-gXMBJQ"}}&lt;/P&gt;&lt;P&gt;and I don't know what reason , please help me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 03:45:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/430974#M22832</guid>
      <dc:creator>Sekali</dc:creator>
      <dc:date>2020-06-19T03:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/430976#M22834</link>
      <description>&lt;P&gt;here is request code:&lt;/P&gt;&lt;PRE&gt;OkHttpClient client = &lt;SPAN&gt;new &lt;/SPAN&gt;OkHttpClient().newBuilder()&lt;BR /&gt;        .build()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;MediaType mediaType = MediaType.&lt;SPAN&gt;parse&lt;/SPAN&gt;(&lt;SPAN&gt;"application/octet-stream"&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;RequestBody body = RequestBody.&lt;SPAN&gt;create&lt;/SPAN&gt;(mediaType&lt;SPAN&gt;, &lt;/SPAN&gt;uploadfile)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;Request request = &lt;SPAN&gt;new &lt;/SPAN&gt;Request.Builder()&lt;BR /&gt;        .url(&lt;SPAN&gt;"https://content.dropboxapi.com/2/files/upload"&lt;/SPAN&gt;)&lt;BR /&gt;        .method(&lt;SPAN&gt;"POST"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;body)&lt;BR /&gt;        .addHeader(&lt;SPAN&gt;"Authorization"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"Bearer "&lt;/SPAN&gt;+token)&lt;BR /&gt;        &lt;SPAN&gt;//"{\"path\": \"/w.pdf\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}"&lt;BR /&gt;&lt;/SPAN&gt;        .addHeader(&lt;SPAN&gt;"Dropbox-API-Arg"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;requestJson)&lt;BR /&gt;        .addHeader(&lt;SPAN&gt;"Content-Type"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"application/octet-stream"&lt;/SPAN&gt;)&lt;BR /&gt;        .build()&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;request json&lt;/P&gt;&lt;P&gt;{"autorename":true,"mode":"add","mute":false,"path":"/\\u6d4b\\u8bd5.pdf","strict_conflict":false}&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when I request to upload file which named only contains English char ,it success.&amp;nbsp; when it contains Chinese char ,it failed&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 04:00:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/430976#M22834</guid>
      <dc:creator>Sekali</dc:creator>
      <dc:date>2020-06-19T04:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/431122#M22837</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1304202"&gt;@Sekali&lt;/a&gt;&amp;nbsp;You didn't include how you're building your&amp;nbsp;requestJson string, but the result doesn't look correct. You have "\\u" instead of "\u". Update your implementation to produce the correct JSON string. You can find more information in &lt;A href="https://www.dropbox.com/developers/reference/json-encoding" target="_self"&gt;the documentation here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 18:01:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/431122#M22837</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-06-19T18:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Response headers</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/431571#M22844</link>
      <description>&lt;P&gt;Thanks , I sloved it. it's works , it's my fault. When I use Gson to convert object to JSON STRING ,it has a problem&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 11:36:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Response-headers/m-p/431571#M22844</guid>
      <dc:creator>Sekali</dc:creator>
      <dc:date>2020-06-22T11:36:50Z</dc:date>
    </item>
  </channel>
</rss>

