Skip to content

Get stream info

Rafael Chacon edited this page Feb 22, 2012 · 1 revision

Return the info for specified stream, including latest photos in a paginated way. The photos can be sorted by likes or by friends. By default the photos are sorted descending by seq (~= creation date)

###URL: http://api.piictu.com/v1/streams/<stream id>

###HTTP method(s): GET

###Requires authentication (OAuth 2.0 Authorization): true

###Parameters (photos pagination):

  • page (optional:integer): Specifies the page of results of to retrieve, default = 1.
  • rpp (optional:integer): results per page, default = 10, max = 50.
  • since_seq (optional:integer): Returns results with an SEQ greater than (that is, more recent than) the specified SEQ.
  • max_seq (optional:integer): Returns results with an SEQ less than (that is, older than) or equal to the specified SEQ.
  • sort_by (optional:string): the values can be likes or friends. If the value is likes the method will return the stream with photos sorted descending by likes. If the value is friends the method will return the stream with photos only from current user friends.

###Response:

On success

  • HTTP response code is 200 (ok)
  • HTTP response body is a JSON string like this:
{
  "stream":{
    "created_at":"2011-04-11T07:00:52-07:00",
    "seq":23,
    "updated_at":"2011-04-11T07:00:52-07:00",
    "id":"4da309947b3a3e58c800000a",
    "locked":false,
    "original_photo":{
      "photo":{
        "caption":"My Car",
        "created_at":"2011-04-11T07:00:52-07:00",
        "seq":83,
        "stream_id":"4da309947b3a3e58c800000a",
        "from":{
          "id":"4d99eb672696e71604000001",
          "username":"sulin",
          "fullname": null,
          "avatar_url":"http://gravatar.com/avatar/4357d23895df5f18f6cb6f804c95ccdd.png?r=PG&s=90"
        },
        "id":"4da309947b3a3e58c800000b",
        "thumbnail":"http://piictu-test.s3.amazonaws.com/photos/thumb_4da309947b3a3e58c800000b.jpg",
        "url":"http://piictu-test.s3.amazonaws.com/photos/4da309947b3a3e58c800000b.jpg"
      }
    },
    "from":{
      "id":"4d99eb672696e71604000001",
      "username":"sulin",
      "fullname": null,
      "avatar_url":"http://gravatar.com/avatar/4357d23895df5f18f6cb6f804c95ccdd.png?r=PG&s=90"
    },
    "photos":[
      {
        "photo":{
          "caption":"My Car",
          "created_at":"2011-04-11T07:00:52-07:00",
          "seq":83,
          "stream_id":"4da309947b3a3e58c800000a",
          "from":{
            "id":"4d99eb672696e71604000001",
            "username":"sulin",
            "fullname": null,
            "avatar_url":"http://gravatar.com/avatar/4357d23895df5f18f6cb6f804c95ccdd.png?r=PG&s=90"
          },
          "id":"4da309947b3a3e58c800000b",
          "thumbnail":"http://piictu-test.s3.amazonaws.com/photos/thumb_4da309947b3a3e58c800000b.jpg",
          "url":"http://piictu-test.s3.amazonaws.com/photos/4da309947b3a3e58c800000b.jpg"
        }
      }
    ],
    "current_page":1,
    "results_per_page":10,
    "total_entries":1,
    "total_pages":1
  }
}

On error If the stream is locked and user neither is mentioned in the stream or is the stream's creator

  • HTTP response code of 403 (Forbidden)
  • HTTP response body is a JSON string like this:
{
  "error" : "user not authorized"
}

###Usage example:

Example using cUrl:

curl -i http://api.piictu.com/v1/streams/4d70f5e75a0d0312b6000005 \
 -F page=2
 -H "Authorization: OAuth 2540af0de12cb2367691516b8477b0b7bd66dbd8ab6840b147340c6898c4eebd"

Clone this wiki locally