<?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 Error: options: expected array, got string - but it is an array? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502285#M24857</link>
    <description>&lt;P&gt;I'm having trouble with an API call. It claims I send a string, but it seems to me to be an array.&lt;/P&gt;
&lt;P&gt;This is the full error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Error in call to API function "https://content.dropboxapi.com/2/files/search_v2": options: expected array, got string&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This is what was sent to cURL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;method:"POST"
header:"Authorization: Bearer MYTOKEN
Content-Type: application/json
Content-Length: 86"
content:"{"query":"test","options":{"path":"","max_results":100,"file_categories":"folder"}}"
ignore_errors:true&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Anyone know what's wrong?&lt;/P&gt;</description>
    <pubDate>Mon, 08 Mar 2021 20:52:18 GMT</pubDate>
    <dc:creator>James_T</dc:creator>
    <dc:date>2021-03-08T20:52:18Z</dc:date>
    <item>
      <title>Error: options: expected array, got string - but it is an array?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502285#M24857</link>
      <description>&lt;P&gt;I'm having trouble with an API call. It claims I send a string, but it seems to me to be an array.&lt;/P&gt;
&lt;P&gt;This is the full error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Error in call to API function "https://content.dropboxapi.com/2/files/search_v2": options: expected array, got string&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;This is what was sent to cURL:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;method:"POST"
header:"Authorization: Bearer MYTOKEN
Content-Type: application/json
Content-Length: 86"
content:"{"query":"test","options":{"path":"","max_results":100,"file_categories":"folder"}}"
ignore_errors:true&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Anyone know what's wrong?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 20:52:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502285#M24857</guid>
      <dc:creator>James_T</dc:creator>
      <dc:date>2021-03-08T20:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error: options: expected array, got string - but it is an array?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502299#M24860</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1419446"&gt;@James_T&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Have you took a look on where parameters have to be put on? &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@9AD39CA637682E9616FBE31CDAF1B6C4/emoticons/1f914.png" alt=":thinking_face:" title=":thinking_face:" /&gt; Into header part of the HTTP query or into data part? 🧐 What are you doing actually? &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt;&lt;/P&gt;&lt;P&gt;Hope this tip gives right direction.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 01:31:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502299#M24860</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2021-03-06T01:31:16Z</dc:date>
    </item>
    <item>
      <title>Re: Error: options: expected array, got string - but it is an array?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502340#M24861</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to do a search.&amp;nbsp; I use a PHP library to handle the cURL calls. It works fine for creating a folder for instance.&lt;BR /&gt;&lt;BR /&gt;Since the error is specifically about "options" parameter, I assume the call is done correctly, if it wasn't I assume I would get an error about something else, or even a missing "query" parameter?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 09:50:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502340#M24861</guid>
      <dc:creator>James_T</dc:creator>
      <dc:date>2021-03-06T09:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error: options: expected array, got string - but it is an array?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502362#M24863</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1419446"&gt;@James_T&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;.., I &lt;STRONG&gt;assume&lt;/STRONG&gt; the call is done correctly, if it wasn't I assume I would get an error about something else, or even a missing "query" parameter?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Better, don't assume anything! &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@A16056C119D4591E1188DE34BB2BEF73/emoticons/1f446.png" alt=":backhand_index_pointing_up:" title=":backhand_index_pointing_up:" /&gt; I can't be certain, what actually you have done. Seems you have posted in OP your HTTP query. 🧐 Is this correct? If so, there are multiple errors! I'm guessing most of them are copy/paste errors when you prepared the post.&lt;/P&gt;&lt;P&gt;To be sure, what we're talking about, post exact structure of your HTTP request/response and/or the code you are using (not something like, as is posted now). Better catch your HTTP request/response, so we would be sure exactly what's going on and what's the error. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 13:22:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502362#M24863</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2021-03-06T13:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error: options: expected array, got string - but it is an array?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502724#M24870</link>
      <description>&lt;P&gt;Below is my complete code. And here is the result:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error in call to API function "files/search_v2": options: expected array, got string&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$token = "....";
$options = array("path" =&amp;gt; "/", "max_results" =&amp;gt; 10);
$options["file_categories"] = "folder";
$parameters = array("query" =&amp;gt; "searchPhrase", "options" =&amp;gt; $options);

$headers = array(
    "Authorization: Bearer $token",
    'Content-Type: application/json'
);

$curlOptions = array(
    CURLOPT_HTTPHEADER =&amp;gt; $headers,
    CURLOPT_POST =&amp;gt; true,
    CURLOPT_POSTFIELDS =&amp;gt; json_encode($parameters),
    CURLOPT_RETURNTRANSFER =&amp;gt; true,
    CURLOPT_VERBOSE =&amp;gt; true,
    CURLOPT_SSL_VERIFYHOST =&amp;gt; false,
    CURLOPT_SSL_VERIFYPEER =&amp;gt; false
);

try {

    $ch = curl_init('https://api.dropboxapi.com/2/files/search_v2');
    curl_setopt_array($ch, $curlOptions);

    $response = curl_exec($ch);
    //var_dump($response);
    curl_close($ch);

} catch (Exception $e) {

    trigger_error(
        sprintf(
            'Curl failed with error #%d: %s',
            $e-&amp;gt;getCode(),
            $e-&amp;gt;getMessage()
        ),
        E_USER_ERROR
    );
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some more debugging:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;echo json_encode($parameters, JSON_PRETTY_PRINT);

{
    "query": "cat",
    "options": {
        "path": "\/folder",
        "max_results": 10,
        "file_categories": "folder"
    }
}
Error in call to API function "files/search_v2": options: expected array, got string&lt;/LI-CODE&gt;&lt;P&gt;That sure looks like an array to me, so I don't understand why it says it's a string...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 12:25:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502724#M24870</guid>
      <dc:creator>James_T</dc:creator>
      <dc:date>2021-03-08T12:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error: options: expected array, got string - but it is an array?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502729#M24871</link>
      <description>&lt;P&gt;Found the problem... the option file_categories needs to be an array as well.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 12:35:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Error-options-expected-array-got-string-but-it-is-an-array/m-p/502729#M24871</guid>
      <dc:creator>James_T</dc:creator>
      <dc:date>2021-03-08T12:35:40Z</dc:date>
    </item>
  </channel>
</rss>

