cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

api.dropbox.com/1/team/log/get_events help with parameters

api.dropbox.com/1/team/log/get_events help with parameters

Rethinkit A.
New member | Level 1

I can't figure out what's wrong with my request  to get_events.
It works fine without the date parameters.

The documentation is here.

I've tried it:
"start_ts:" 1441374492
"start_ts:" "1441374492"
"start_ts:" 1441374492000 (in case they really want milliseconds - see other post)

 

$token = 'IvRWv7I_TOKEN_REMOVED_FOR_OBVIOUS_REASONSzzzzqaC'
$uri='https://api.dropbox.com/1/team/log/get_events'

$body_req= '{"category": "logins"}'  ### Works fine.
$body_req= '{"category": "logins", "start_ts:" 1441374492, "end_ts:" 1443966661}'  ### Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
$res = Invoke-RestMethod -Uri $uri -Body $body_req -ContentType 'application/json' -Headers @{ Authorization = ("Bearer " + $token) } -Method Post
$res

 

 

4 Replies 4

Re: api.dropbox.com/1/team/log/get_events help with parameters

Steve M.
Dropboxer

What's the body of the 400 response? The API is usually pretty good at telling you what's wrong.

Re: api.dropbox.com/1/team/log/get_events help with parameters

Steve M.
Dropboxer

(You may want to look at http://stackoverflow.com/questions/18771424/how-to-get-powershell-invoke-restmethod-to-return-body-o... to learn how to get the response body.)

Re: api.dropbox.com/1/team/log/get_events help with parameters

Rethinkit A.
New member | Level 1

Thanks- you were right. Once I figured out how to read the response I found the typo:

 

$body_req= '{"category": "logins", "start_ts:" 1441374492, "end_ts:" 1443966661}'  ### Invoke-RestMethod : The remote server returned an error: (400) Bad Request.

should be: (the colon marks go outside the quote marks)

$body_req= '{"category": "logins", "start_ts": 1441374492, "end_ts": 1443966661}'  ### OK

Re: api.dropbox.com/1/team/log/get_events help with parameters

Rethinkit A.
New member | Level 1

And by the way the dates ARE in milliseconds so actually make the dates x1000

$body_req= '{"category": "logins", "start_ts": 1441374492000, "end_ts": 1443966661000}'  ### OK

Who's talking

Top contributors to this post

  • User avatar
    Rethinkit A. New member | Level 1
  • User avatar
    Steve M. Dropboxer
What do Dropbox user levels mean?
Need more support?