You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

James_T's avatar
James_T
Helpful | Level 6
4 years ago

Error: options: expected array, got string - but it is an array?

I'm having trouble with an API call. It claims I send a string, but it seems to me to be an array.

This is the full error:

 

Error in call to API function "https://content.dropboxapi.com/2/files/search_v2": options: expected array, got string

 


This is what was sent to cURL:

 

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

 

 

 Anyone know what's wrong?

  • Found the problem... the option file_categories needs to be an array as well.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi James_T,

    Have you took a look on where parameters have to be put on? 🤔 Into header part of the HTTP query or into data part? 🧐 What are you doing actually? 🙂

    Hope this tip gives right direction.

    • James_T's avatar
      James_T
      Helpful | Level 6

      Hi,

      I'm trying to do a search.  I use a PHP library to handle the cURL calls. It works fine for creating a folder for instance.

      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?

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        James_T wrote:
        .., 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?

        Better, don't assume anything! 👆 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.

        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. 😉

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!