picBox Documentation

API :: Listing Data

< Back


To list data from a picBox user's account, there are three pieces of information required:

There are two optional pieces of information you can supply:

The data types supported are:

The URL to list data from an account is:

https://picbox.us/api/bind?token=user_token&last=last_data_id&type=data_type

An example response from a probe request (last=-1) looks like this:

{
    user: {
        image_count: 4736,
        first_image_id: 6034,
        last_image_id: 52081
    },
    images: [
        ......
    ]
}
When last=-1, the value of last is internally set to the value of last_image_id. This allows an application to list a specified number of most recent images (when in descending order), or to receive events of new user uploads (when in ascending order).

When an ID is provided for last, the response will look like this:

{
    user: {
        image_count: 4736,
        first_image_id: 6034,
        last_image_id: 52081
    },
    images: [
        {
            id: 6034,
            filename: "abc.jpeg",
            url: "https://pcbx.us/picBox/abc.jpeg",
            thumb_url: "https://pcbx.us/picBox/abc.jpeg.thumb.jpg",
            date_uploaded: 1341480637,
            delete_token: "JX_MNyl0DdogOJ9ChIxOmoDxn"
        },
        ......
    ]
}
As is evident, the items in images of this example are listed in ascending order according to their ID.

The bind endpoint was designed to allow long-polling for new data. If the last GET variable is set to the user's last_image_id (or last_text_id), when a new image is uploaded its ID will be greater than the last ID; the request will end, and the new image will be returned. The timeout for these types of requests is 30 seconds, after which the same URL can be simply re-requested. In the event of a timeout, the 'images' or 'texts' array will be empty.