Details Api Documentation

Bahadır ARSLAN's Avatar

Bahadır ARSLAN

26 Feb, 2011 08:07 PM via web

Hi,
I need help about Put.io Api and i am sorry but I think the documentation is insufficient.
For example,
i am trying to get dashboard messages but,
1) Only 30 messages come from api, how can i increase number or fetch more messages?
2) What is the meaning of enums? Like file_type.
3) File_Name allways come null (except my downloads)
4) What is channel?
5) What is description? Allways ... 2
6) What is hidden?
7) How can i fetch put.io notifications or friendship requests?

If you help me i will be happy...

  1. 2 Posted by tunix on 27 Feb, 2011 10:43 PM

    tunix's Avatar

    Hello Bahadır,

    You're right. Our API's documentation doesn't cover everything and has lots
    of missing features. The API is not structured very well and it exposes
    unnecessary modules, attributes through instances. Therefore, I'd like to
    tell you that we plan to rewrite the whole API with oauth2 support. As for
    your questions I write the answers below.

    ---
    Quis custodiet ipsos custodes?

    1) Only 30 messages come from api, how can i increase number or fetch more
    > messages?
    >

    Unless you modify put.io, you can't. You can do the following if you want
    more messages:

    at line 696 @ putio.py: add a new parameter to function get_messages: **args

    it will look like this:

    def get_messages(self, **args):

    Now when you pass limit=100, last 100 messages will be retrieved.

    > 2) What is the meaning of enums? Like file_type.
    >

    I assume you mean this:

    In [9]: item = api.get_items(id=u'12320605')[0]

    In [10]: item.filetypes
    Out[10]:
    {'audio': 2,
     'compressed': 5,
     'file': 1,
     'folder': 0,
     'image': 4,
     'movie': 3,
     'ms_doc': 7,
     'pdf': 6,
     'swf': 9,
     'text': 8}

    In fact it'd be better if we hadn't exposed this to the developers.

    > 3) File_Name allways come null (except my downloads)
    >

    I've checked the database and found out that some of the downloads have
    file_name field filled and other empty. I don't know how that happens due to
    our code logic but I've seen many downloads (in my own account) with filled
    file_name attribute. I can't promiss you a date but we'll take a look at
    this behaviour.

    > 4) What is channel?
    >

    Channel is where the personal log message is generated from. I'm sorry that
    the API lacks that information. Here's the enumeration:

    const CHANNEL_SYSTEM = 0;
    const CHANNEL_DLINFO = 2;
    const CHANNEL_DLPASSREQUEST = 4;
    const CHANNEL_DLERROR = 8;
    const CHANNEL_ITEMSSHARED = 16;
    const CHANNEL_FRIENDSHIP = 32;
    const CHANNEL_FRIENDSHIP_REPLY = 33;
    const CHANNEL_WELCOMEMESSAGE = 99;

    > 5) What is description? Allways ... 2
    >

    :) I guess this is a bug. It's just like that in the database too or just
    null. We'll take a look at this one too.

    > 6) What is hidden?
    >

    I guess this is an unused field.

    > 7) How can i fetch put.io notifications or friendship requests?
    >

    You can use channels to fetch those messages. To fetch messages according to
    channels, you have to change the line I mentioned above and write a query
    like this:

     api.get_messages(limit = 100, channel = 32)

    I've tested it and it works. However it not only shows the friendship
    requests but also the shares.

    Sorry for these issues you've had. Due to our limited resources, we didn't
    have time to look the API related issues but I can assure you that a new API
    (with oAuth2 support) is in our plans.

Reply to this discussion

Internal reply

Formatting help or Preview

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.