<?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: HTTP API Path contain Chinese response 409 path not found? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240118#M13355</link>
    <description>If you're sending the same value as the SDK, please double check that you're connected to the same account/app. It's possible you're using an access token for a different account/app that in fact doesn't have anything at that path.&lt;BR /&gt;&lt;BR /&gt;Otherwise, please share the full code we can use to reproduce the issue.</description>
    <pubDate>Tue, 05 Sep 2017 15:24:39 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2017-09-05T15:24:39Z</dc:date>
    <item>
      <title>HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240031#M13346</link>
      <description>&lt;P&gt;I reply my question here:&lt;A href="https://www.dropboxforum.com/t5/API-support/International-characters-in-filenames/m-p/175750#M6947" target="_blank"&gt;https://www.dropboxforum.com/t5/API-support/International-characters-in-filenames/m-p/175750#M6947&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;but not resolved,so i open a new post to illustate my issue:&lt;/P&gt;
&lt;P&gt;There is Chinese in path like："/blackdog/中文prd.docx“，i see the api explore send Dropbox-API-Arg as follow:&lt;/P&gt;
&lt;PRE&gt;Dropbox-API-Arg:{"path":"/blackdog/\u4e2d\u6587prd.docx"}&lt;/PRE&gt;
&lt;P&gt;I am using java to send request to dropbox api,my Dropbox-API-Arg as follow:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;"Dropbox-API-Arg:  {"path":"/blackdog/\\u4E2D\\u6587prd.docx"}"&lt;/PRE&gt;
&lt;P&gt;In java \\ standard for one \,and dropbox response as follow:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;path/not_found/.&lt;/PRE&gt;
&lt;P&gt;I debuged Dropbox java sdk,and the header Dropbox-API-Arg value is the same as mine&lt;/P&gt;
&lt;PRE&gt; "Dropbox-API-Arg:  {"path":"/blackdog/\\u4E2D\\u6587prd.docx"}[\r][\n]"
&lt;/PRE&gt;
&lt;P&gt;but i got 409 path/not_found/..,dropbox sdk get right response,i don not why.By the way,if there is no Chinese in path,response is success.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a4900c43ly1fj5n2pr0u3j20zv0emwgj" style="width: 999px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/1027iF92EEA8E6F2D6A0A/image-size/large?v=v2&amp;amp;px=999" role="button" title="a4900c43ly1fj5n2pr0u3j20zv0emwgj" alt="a4900c43ly1fj5n2pr0u3j20zv0emwgj" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:19:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240031#M13346</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2019-05-29T09:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240118#M13355</link>
      <description>If you're sending the same value as the SDK, please double check that you're connected to the same account/app. It's possible you're using an access token for a different account/app that in fact doesn't have anything at that path.&lt;BR /&gt;&lt;BR /&gt;Otherwise, please share the full code we can use to reproduce the issue.</description>
      <pubDate>Tue, 05 Sep 2017 15:24:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240118#M13355</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-05T15:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240234#M13369</link>
      <description>&lt;P&gt;Account/app is correct, In the same folder for my test,i create two folders one path contains Chinese,one just pure English letters,the later folder test success,so the Account/APP is not the problem.&lt;/P&gt;
&lt;P&gt;Here is the code&amp;nbsp;&lt;A href="https://gist.github.com/user20161119/84681489c04ef912d3646ab6ef05c357" target="_blank"&gt;https://gist.github.com/user20161119/84681489c04ef912d3646ab6ef05c357&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Actually,just try to use httpclient to send the http request to dropbox api,will get the same result as mine.thanks&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 00:03:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240234#M13369</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-09-06T00:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240309#M13376</link>
      <description>&lt;P&gt;Here is my code snippet,&lt;A href="https://gist.github.com/user20161119/84681489c04ef912d3646ab6ef05c357" target="_blank"&gt;https://gist.github.com/user20161119/84681489c04ef912d3646ab6ef05c357&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Actually,just try to use java httpclient to send to&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-get_preview" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#files-get_preview&lt;/A&gt; endpoint,will reproduce my issue,thanks&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2017 14:01:23 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240309#M13376</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-09-06T14:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240331#M13384</link>
      <description>&lt;P&gt;Your code sample uses some custom classes so I can't run it, but this runs fine for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class Main {

    public static void main(String[] args) throws IOException {

        String ACCESS_TOKEN = "&amp;lt;ACCESS_TOKEN&amp;gt;";
        String filePath = "/blackdog/中文prd.docx";

        JsonFactory jsonFactory = new JsonFactory();
        OutputStream outputStream = new ByteArrayOutputStream();
        JsonGenerator jsonGenerator = jsonFactory.createGenerator(outputStream);
        jsonGenerator.setHighestNonEscapedChar(0x7E);
        jsonGenerator.writeStartObject();
        jsonGenerator.writeStringField("path", filePath);
        jsonGenerator.writeEndObject();
        jsonGenerator.close();

        String arg = outputStream.toString();
        System.out.println(arg);

        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            HttpPost httpost = new HttpPost("https://content.dropboxapi.com/2/files/get_preview");
            httpost.setHeader("Authorization", "Bearer " + ACCESS_TOKEN);
            httpost.setHeader("Dropbox-API-Arg", arg);

            ResponseHandler&amp;lt;String&amp;gt; responseHandler = new ResponseHandler&amp;lt;String&amp;gt;() {

                @Override
                public String handleResponse(final HttpResponse response) throws IOException {
                    int status = response.getStatusLine().getStatusCode();
                    System.out.println(status);
                    HttpEntity entity = response.getEntity();
                    return entity != null ? EntityUtils.toString(entity) : null;
                }
            };

            String responseBody = httpclient.execute(httpost, responseHandler);
            System.out.println(responseBody);

        } finally {
            httpclient.close();
        }

    }
}
&lt;/PRE&gt;
&lt;P&gt;That outputs:&lt;/P&gt;
&lt;PRE&gt;{"path":"/blackdog/\u4E2D\u6587prd.docx"}
200
%PDF-1.4
%Çì&amp;#143;¢
&amp;lt;more PDF content truncated for brevity&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 15:03:23 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240331#M13384</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-09-06T15:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240342#M13385</link>
      <description>&lt;P&gt;thanks,&lt;/P&gt;
&lt;P&gt;from your code, the difference is the following snippet i use Jackson ObjectMapper in my app,i will try your code later.&lt;/P&gt;
&lt;PRE&gt;JsonFactory jsonFactory = new JsonFactory();
        OutputStream outputStream = new ByteArrayOutputStream();
        JsonGenerator jsonGenerator = jsonFactory.createGenerator(outputStream);
        jsonGenerator.setHighestNonEscapedChar(0x7E);
        jsonGenerator.writeStartObject();
        jsonGenerator.writeStringField("path", filePath);
        jsonGenerator.writeEndObject();
        jsonGenerator.close();&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Sep 2017 15:54:57 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240342#M13385</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-09-06T15:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: HTTP API Path contain Chinese response 409 path not found?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240509#M13395</link>
      <description>&lt;P&gt;I tried use the following code to generate the&amp;nbsp;Dropbox-API-Arg header value,and work correctly&lt;/P&gt;
&lt;PRE&gt; DropboxContentReq req = new DropboxContentReq(DropboxAPI.PREVIEW);&lt;BR /&gt; req.setHttp_method(HttpMethod.POST);&lt;BR /&gt; String filePath = "/blackdog/中文prd.docx";&lt;BR /&gt; &lt;BR /&gt; JsonFactory jsonFactory = new JsonFactory();&lt;BR /&gt; OutputStream outputStream = new ByteArrayOutputStream();&lt;BR /&gt; JsonGenerator jsonGenerator = jsonFactory.createGenerator(outputStream);&lt;BR /&gt; jsonGenerator.setHighestNonEscapedChar(0x7E);&lt;BR /&gt; jsonGenerator.writeStartObject();&lt;BR /&gt; jsonGenerator.writeStringField("path", filePath);&lt;BR /&gt; jsonGenerator.writeEndObject();&lt;BR /&gt; jsonGenerator.close();&lt;BR /&gt;&lt;BR /&gt; String arg = outputStream.toString();&lt;BR /&gt; System.out.println(arg);&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt; DropboxPathReq _req = new DropboxPathReq();&lt;BR /&gt; //convert Chinese to Unicode /blackdog/\\u4E2D\\u6587prd.docx&lt;BR /&gt; filePath = StringEscapeUtils.escapeJava(filePath);&lt;BR /&gt; _req.setPath(filePath);&lt;BR /&gt; //concat the json work &lt;BR /&gt; String json_header = "{\"path\":\"" + filePath + "\"}";&lt;BR /&gt; &lt;BR /&gt; //use arg as header value work correct&lt;BR /&gt; //req.getHeaders().add("Dropbox-API-Arg",json_header);&lt;BR /&gt;&lt;BR /&gt; req.getHeaders().add("Dropbox-API-Arg",json_header);&lt;BR /&gt;&lt;BR /&gt; String json = dropbox_api_service.callDropbox(req);&lt;BR /&gt; LoggerUtils.logInfo(this.getClass(), json);&lt;BR /&gt; &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;and i concat the Dropbox-API-Arg header json value,work correctly too,&lt;/P&gt;
&lt;PRE&gt; String json_header = "{\"path\":\"" + filePath + "\"}";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I use Jackson ObjectMapper generate the header value before,the difference is&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;{"path":"/blackdog/\\u4E2D\\u6587prd.docx"}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;there are two \ in the json string,maybe is violate the HTTP HEADER spec,i will check http header value spec later,any way thanks for your time.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Sep 2017 13:14:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/HTTP-API-Path-contain-Chinese-response-409-path-not-found/m-p/240509#M13395</guid>
      <dc:creator>jianwen</dc:creator>
      <dc:date>2017-09-07T13:14:02Z</dc:date>
    </item>
  </channel>
</rss>

