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
Vasili V.
9 years agoExplorer | Level 4
Extended Latin and 400 Bad Request
Hello,
I try to create a new member with name that contains chars of extended Latin alphabet (Ñ, Í, Õ etc.). I use powershell Invoke-RestMethod command and generate a body on the fly.
I receive "...
- 7 years ago
Thanks! That's the error from the API, and it does indicate that the issue is that the contents of the request body couldn't be successfully decoded as JSON.
It sounds like the issue is with encoding these characters. That's generally done automatically, but that doesn't seem to be the case with PowerShell/Invoke-RestMethod.
I'm not a PowerShell expert, and it also looks like copying it onto the forum didn't work right here, but I believe you need to additionally encode the body like this:
$enc = [System.Text.Encoding]::UTF8 $body = $enc.GetBytes($body)
Vasili V.
Explorer | Level 4
I captured a request and a response. I hide some sensitive info.
POST https://api.dropboxapi.com/2/team/members/add HTTP/1.1
{
"new_members": [
{
"member_email": "Baptiste.Bjaud@***",
"member_external_id": "ADSYNC ****",
"send_welcome_email": true,
"member_given_name": "Baptiste",
"member_surname": "B jaud"
}
]
}
HTTP/1.1 400 Bad Request
Error in call to API function "team/members/add": request body: could not decode input as JSON
The name is Béjaud.
Greg-DB
7 years agoDropbox Staff
Thanks! That's the error from the API, and it does indicate that the issue is that the contents of the request body couldn't be successfully decoded as JSON.
It sounds like the issue is with encoding these characters. That's generally done automatically, but that doesn't seem to be the case with PowerShell/Invoke-RestMethod.
I'm not a PowerShell expert, and it also looks like copying it onto the forum didn't work right here, but I believe you need to additionally encode the body like this:
$enc = [System.Text.Encoding]::UTF8 $body = $enc.GetBytes($body)
- Vasili V.7 years agoExplorer | Level 4
It helped.
Thank you!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days 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!