<?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 Can't use the content.dropboxapi in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363140#M20639</link>
    <description>&lt;P&gt;I want to know what i did wrong in this code. Because it is giving error. I am new to this so plz help.&lt;/P&gt;
&lt;P&gt;Error:&amp;nbsp;{"error_summary": "path/not_found/..", "error": {".tag": "path", "path": {".tag": "not_found"}}}&lt;/P&gt;
&lt;P&gt;public class DropboxController&lt;BR /&gt;{&lt;BR /&gt;//Fetched from URL&lt;BR /&gt;String code;&lt;BR /&gt;String accesstoken;&lt;BR /&gt;public DropboxController()&lt;BR /&gt;{&lt;BR /&gt;code = ApexPages.currentPage().getParameters().get('code');&lt;BR /&gt;//Get the access token once we have code&lt;BR /&gt;if(code != '' &amp;amp;&amp;amp; code != null)&lt;BR /&gt;{&lt;BR /&gt;AccessToken();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public PageReference DropAuth()&lt;BR /&gt;{&lt;BR /&gt;//Authenticating&lt;BR /&gt;PageReference pg = new PageReference('&lt;A href="https://www.dropbox.com/1/oauth2/authorize?response_type=code&amp;amp;client_id=khvnmek12dw0wv9&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage&amp;amp;state=Mytesting" target="_blank" rel="noopener"&gt;https://www.dropbox.com/1/oauth2/authorize?response_type=code&amp;amp;client_id=khvnmek12dw0wv9&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage&amp;amp;state=Mytesting&lt;/A&gt;');&lt;BR /&gt;return pg;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public void AccessToken()&lt;BR /&gt;{&lt;BR /&gt;//Getting access token from dropbox&lt;BR /&gt;String tokenuri = '&lt;A href="https://api.dropbox.com/1/oauth2/token?grant_type=authorization_code&amp;amp;code='+code+'&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage" target="_blank" rel="noopener"&gt;https://api.dropbox.com/1/oauth2/token?grant_type=authorization_code&amp;amp;code='+code+'&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage&lt;/A&gt;';&lt;BR /&gt;HttpRequest req = new HttpRequest();&lt;BR /&gt;req.setEndpoint(tokenuri);&lt;BR /&gt;req.setMethod('POST');&lt;BR /&gt;req.setTimeout(60*1000);&lt;BR /&gt;&lt;BR /&gt;Blob headerValue = Blob.valueOf('khvnmek12dw0wv9' + ':' + '&amp;lt;REDACTED&amp;gt;');&lt;BR /&gt;String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);&lt;BR /&gt;req.setHeader('Authorization', authorizationHeader);&lt;BR /&gt;Http h = new Http();&lt;BR /&gt;String resp;&lt;BR /&gt;HttpResponse res = h.send(req);&lt;BR /&gt;resp = res.getBody();&lt;BR /&gt;&lt;BR /&gt;JSONParser parser = JSON.createParser(resp);&lt;BR /&gt;while (parser.nextToken() != null) {&lt;BR /&gt;if ((parser.getCurrentToken() == JSONToken.FIELD_NAME)){&lt;BR /&gt;String fieldName = parser.getText();&lt;BR /&gt;parser.nextToken();&lt;BR /&gt;if(fieldName == 'access_token') {&lt;BR /&gt;accesstoken = parser.getText();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;system.debug('accessToken = '+accessToken );&lt;BR /&gt;System.debug(' You can parse the response to get the access token :: ' + resp);&lt;BR /&gt;&lt;BR /&gt;string token = '&lt;A href="https://content.dropboxapi.com/2/files/download" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;';&lt;BR /&gt;HttpRequest r = new HttpRequest();&lt;BR /&gt;r.setEndpoint(token);&lt;BR /&gt;r.setHeader('Authorization' , 'Bearer ' +accesstoken);&lt;BR /&gt;r.setHeader('Dropbox-API-Arg','{\"path\": \"/filepath\"}');&lt;BR /&gt;r.setMethod('GET');&lt;BR /&gt;r.setTimeout(60000);&lt;BR /&gt;Http h1 = new Http();&lt;BR /&gt;HttpResponse res1 = h1.send(r);&lt;BR /&gt;string resp1 = res1.getBody();&lt;BR /&gt;System.debug(' Information :- ' + resp1);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
    <pubDate>Wed, 04 Sep 2019 08:10:08 GMT</pubDate>
    <dc:creator>lonehero</dc:creator>
    <dc:date>2019-09-04T08:10:08Z</dc:date>
    <item>
      <title>Can't use the content.dropboxapi</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363140#M20639</link>
      <description>&lt;P&gt;I want to know what i did wrong in this code. Because it is giving error. I am new to this so plz help.&lt;/P&gt;
&lt;P&gt;Error:&amp;nbsp;{"error_summary": "path/not_found/..", "error": {".tag": "path", "path": {".tag": "not_found"}}}&lt;/P&gt;
&lt;P&gt;public class DropboxController&lt;BR /&gt;{&lt;BR /&gt;//Fetched from URL&lt;BR /&gt;String code;&lt;BR /&gt;String accesstoken;&lt;BR /&gt;public DropboxController()&lt;BR /&gt;{&lt;BR /&gt;code = ApexPages.currentPage().getParameters().get('code');&lt;BR /&gt;//Get the access token once we have code&lt;BR /&gt;if(code != '' &amp;amp;&amp;amp; code != null)&lt;BR /&gt;{&lt;BR /&gt;AccessToken();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public PageReference DropAuth()&lt;BR /&gt;{&lt;BR /&gt;//Authenticating&lt;BR /&gt;PageReference pg = new PageReference('&lt;A href="https://www.dropbox.com/1/oauth2/authorize?response_type=code&amp;amp;client_id=khvnmek12dw0wv9&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage&amp;amp;state=Mytesting" target="_blank" rel="noopener"&gt;https://www.dropbox.com/1/oauth2/authorize?response_type=code&amp;amp;client_id=khvnmek12dw0wv9&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage&amp;amp;state=Mytesting&lt;/A&gt;');&lt;BR /&gt;return pg;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;public void AccessToken()&lt;BR /&gt;{&lt;BR /&gt;//Getting access token from dropbox&lt;BR /&gt;String tokenuri = '&lt;A href="https://api.dropbox.com/1/oauth2/token?grant_type=authorization_code&amp;amp;code='+code+'&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage" target="_blank" rel="noopener"&gt;https://api.dropbox.com/1/oauth2/token?grant_type=authorization_code&amp;amp;code='+code+'&amp;amp;redirect_uri=https://c.ap1.visual.force.com/apex/DropboxPage&lt;/A&gt;';&lt;BR /&gt;HttpRequest req = new HttpRequest();&lt;BR /&gt;req.setEndpoint(tokenuri);&lt;BR /&gt;req.setMethod('POST');&lt;BR /&gt;req.setTimeout(60*1000);&lt;BR /&gt;&lt;BR /&gt;Blob headerValue = Blob.valueOf('khvnmek12dw0wv9' + ':' + '&amp;lt;REDACTED&amp;gt;');&lt;BR /&gt;String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);&lt;BR /&gt;req.setHeader('Authorization', authorizationHeader);&lt;BR /&gt;Http h = new Http();&lt;BR /&gt;String resp;&lt;BR /&gt;HttpResponse res = h.send(req);&lt;BR /&gt;resp = res.getBody();&lt;BR /&gt;&lt;BR /&gt;JSONParser parser = JSON.createParser(resp);&lt;BR /&gt;while (parser.nextToken() != null) {&lt;BR /&gt;if ((parser.getCurrentToken() == JSONToken.FIELD_NAME)){&lt;BR /&gt;String fieldName = parser.getText();&lt;BR /&gt;parser.nextToken();&lt;BR /&gt;if(fieldName == 'access_token') {&lt;BR /&gt;accesstoken = parser.getText();&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;system.debug('accessToken = '+accessToken );&lt;BR /&gt;System.debug(' You can parse the response to get the access token :: ' + resp);&lt;BR /&gt;&lt;BR /&gt;string token = '&lt;A href="https://content.dropboxapi.com/2/files/download" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/download&lt;/A&gt;';&lt;BR /&gt;HttpRequest r = new HttpRequest();&lt;BR /&gt;r.setEndpoint(token);&lt;BR /&gt;r.setHeader('Authorization' , 'Bearer ' +accesstoken);&lt;BR /&gt;r.setHeader('Dropbox-API-Arg','{\"path\": \"/filepath\"}');&lt;BR /&gt;r.setMethod('GET');&lt;BR /&gt;r.setTimeout(60000);&lt;BR /&gt;Http h1 = new Http();&lt;BR /&gt;HttpResponse res1 = h1.send(r);&lt;BR /&gt;string resp1 = res1.getBody();&lt;BR /&gt;System.debug(' Information :- ' + resp1);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 08:10:08 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363140#M20639</guid>
      <dc:creator>lonehero</dc:creator>
      <dc:date>2019-09-04T08:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use the content.dropboxapi</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363160#M20642</link>
      <description>&lt;P&gt;I see that you're trying to call &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_self"&gt;the&amp;nbsp;/2/files/download endpoint&lt;/A&gt;, and are getting a "path/not_found" error.&lt;/P&gt;
&lt;P&gt;You can look up what each error for any particular endpoint means in the documentation for that endpoint.&amp;nbsp;For example, for &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download" target="_self"&gt;/2/files/download&lt;/A&gt;, the "path/not_found" error means: "There is nothing at the given path.". That is to say, there no file or folder at that particular path in the connected account.&lt;/P&gt;
&lt;P&gt;In the code you shared, that's referring to the "/filepath" value you're supplying. I don't know if that's just an example or if that's the actual value you're sending, but you'll need to make sure you're supplying the right value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can build these values manually, or you can get the paths for files by listing the contents of a folder using&amp;nbsp;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder" target="_self"&gt;/2/files/list_folder&lt;/A&gt;[&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue" target="_self"&gt;/continue&lt;/A&gt;].&lt;/P&gt;
&lt;P&gt;The &lt;A href="https://www.dropbox.com/developers/reference/content-access-guide" target="_self"&gt;Content Access Guide&lt;/A&gt; and &lt;A href="https://www.dropbox.com/developers/reference/namespace-guide" target="_self"&gt;Namespace Guide&lt;/A&gt; may also serve as a useful reference here.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 17:04:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363160#M20642</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-09-03T17:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Can't use the content.dropboxapi</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363251#M20645</link>
      <description>&lt;P&gt;Thanks my issue got solved.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 14:10:17 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Can-t-use-the-content-dropboxapi/m-p/363251#M20645</guid>
      <dc:creator>lonehero</dc:creator>
      <dc:date>2019-09-04T14:10:17Z</dc:date>
    </item>
  </channel>
</rss>

