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
Jon P.4
8 years agoNew member | Level 2
testing API in Powershell: "expected null, got value"
After looking through posts as well as the .ps1 files being used in the AD sync tool, I was trying to run some simple data gathering api calls to get a feel for things however when I try to run a 'ge...
- 8 years ago
When making an API call like this that takes no parameters, you can do it one of two ways:
- Don't supply any request body, and accordingly omit the Content-Type request header.
- Supply just "null" as the request body, and submit the Content-Type request header as "application/json".
As you have it, you're submitting a non-null JSON body, which is unexpected for this call, as it doesn't expect any parameters.
Also, apologies, this is confusing in this case, as you're only supplying an empty dictionary, but as it's built right now, the API won't accept that. The simplest solution in this case is probably just to change your "{}" to "null".
Greg-DB
Dropbox Staff
When making an API call like this that takes no parameters, you can do it one of two ways:
- Don't supply any request body, and accordingly omit the Content-Type request header.
- Supply just "null" as the request body, and submit the Content-Type request header as "application/json".
As you have it, you're submitting a non-null JSON body, which is unexpected for this call, as it doesn't expect any parameters.
Also, apologies, this is confusing in this case, as you're only supplying an empty dictionary, but as it's built right now, the API won't accept that. The simplest solution in this case is probably just to change your "{}" to "null".
axew3
8 years agoCollaborator | Level 8
"The simplest solution in this case is probably just to change your "{}" to "null"."
yes it is:
$data = "null";
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,880 PostsLatest Activity: 35 minutes agoIf 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!