Join BoxWorks in San Francisco Nov 12-13! Keynotes, product demos, and Box Master Classes. Reserve your spot!

File object in Python SDK

Answered
New post

Comments

2 comments

  • jmoldow_box

    Hi,

     

    Many of the Client methods do not make API calls directly. Client.file(), Client.folder(), etc. are examples of this. Instead, they give you an empty object which is configured to make API calls that are rooted at that object. If I wanted to delete a folder, I could call client.file(my_id).delete(). If I wanted to rename it, I'd call client.file(my_id).rename(). In your case, you just want to GET information, so you should do file = client.file(my_id).get(). After that, you should be able to do file.content_created_at.

     

    Whereas Client.search() actually makes the search API call directly, which is why the object you get from there already has the data you want.

    0
    Comment actions Permalink
  • larsenp_lsc

    Thanks. That did the trick. It would be great if the documentation made it a little clearer. Maybe I'm a little thick, but a note or a code sample in the documentation for the file method could make this a lot clearer.

    0
    Comment actions Permalink

Please sign in to leave a comment.