Skip to content

Instantly share code, notes, and snippets.

@danielma156
Created July 17, 2018 21:51
Show Gist options
  • Select an option

  • Save danielma156/2412da494c689a16147c29cc90bd4a13 to your computer and use it in GitHub Desktop.

Select an option

Save danielma156/2412da494c689a16147c29cc90bd4a13 to your computer and use it in GitHub Desktop.
Last updated Timestamp for a Dropbox file (JS)
function call() {
$.ajax({
type: "POST",
beforeSend: function(request) {
request.setRequestHeader("Authorization", '<YOUR KEY HERE>');
request.setRequestHeader("Content-Type", "application/json");
},
url: "https://api.dropboxapi.com/2/files/get_metadata",
data: '{"path":"/path/to/file"}',
processData: false,
success: function(msg) {
var last_update = msg.client_modified;
console.log(last_update);
var last_update_formatted = moment(last_update).format('MMMM Do YYYY, HH:mm:ss');
console.log(last_update_formatted);
document.getElementById("myText").innerHTML = last_update_formatted;
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment