Skip to content
siuying edited this page Oct 13, 2012 · 11 revisions

Items

GET /user/:id.json

Get user data

Example

{
  "id": 1,
  "name": "",
  "followers_count": 0,
  "created_at": "2012-10-11T17:32:14Z",
  "updated_at": "2012-10-11T17:32:14Z",
  "avatar_url": "http://placekitten.com/200/200"
}

GET /items.json

List all items.

Sample

{
    "id": 8,
    "title": "MacBook Pro ",
    "desc": "Not mine but free to buy it",
    "price": "1.0",
    "address": null,
    "latitude": 22.2859724778506,
    "longitude": 114.190312663862,
    "photos": [
      {
        "small": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350063285/krmcesena8c4vp76jhue.jpg",
        "medium": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350063285/krmcesena8c4vp76jhue.jpg",
        "large": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350063285/krmcesena8c4vp76jhue.jpg"
      }
    ]
  },
  {
    "id": 9,
    "title": "123",
    "desc": "Totally interesting stuff , must buy",
    "price": "12.0",
    "address": null,
    "latitude": 22.2860473924616,
    "longitude": 114.190386476955,
    "photos": [
      {
        "small": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350095273/rzfh5oirulushoc2axag.jpg",
        "medium": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350095273/rzfh5oirulushoc2axag.jpg",
        "large": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350095273/rzfh5oirulushoc2axag.jpg"
      }
    ]
  }
]

GET /items/nearby.json

Search nearby items.

Parameters

  • lat - latitue
  • lon - longtitude
  • distance - the radius of items

Sample

[
  {
    "id": 8,
    "title": "MacBook Pro ",
    "desc": "Not mine but free to buy it",
    "price": "1.0",
    "address": null,
    "latitude": 22.2859724778506,
    "longitude": 114.190312663862,
    "distance": 23.21098819004347,
    "photos": [
      {
        "thumb": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_80,w_80/v1350063285/krmcesena8c4vp76jhue.jpg",
        "small": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350063285/krmcesena8c4vp76jhue.jpg",
        "medium": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350063285/krmcesena8c4vp76jhue.jpg",
        "large": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350063285/krmcesena8c4vp76jhue.jpg"
      }
    ]
  },
  {
    "id": 9,
    "title": "123",
    "desc": "Totally interesting stuff , must buy",
    "price": "12.0",
    "address": null,
    "latitude": 22.2860473924616,
    "longitude": 114.190386476955,
    "distance": 23.217871512225916,
    "photos": [
      {
        "thumb": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_80,w_80/v1350095273/rzfh5oirulushoc2axag.jpg",
        "small": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350095273/rzfh5oirulushoc2axag.jpg",
        "medium": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350095273/rzfh5oirulushoc2axag.jpg",
        "large": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350095273/rzfh5oirulushoc2axag.jpg"
      }
    ]
  },
  {
    "id": 7,
    "title": "110001",
    "desc": "110000",
    "price": "100.0",
    "address": null,
    "latitude": 22.2860048,
    "longitude": 114.1904923,
    "distance": 23.218922558453805,
    "photos": [
      {
        "thumb": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_80,w_80/v1350061950/gosyyrk73argdn8r5cn9.png",
        "small": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350061950/gosyyrk73argdn8r5cn9.png",
        "medium": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350061950/gosyyrk73argdn8r5cn9.png",
        "large": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350061950/gosyyrk73argdn8r5cn9.png"
      }
    ]
  }
]

GET /items/:id.json

Get details of an item, including people interested, comments, etc.

Sample

{
  "id": 7,
  "title": "110001",
  "desc": "110000",
  "price": "100.0",
  "address": null,
  "latitude": 22.2860048,
  "longitude": 114.1904923,
  "photos": [
    {
      "thumb": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_80,w_80/v1350061950/gosyyrk73argdn8r5cn9.png",
      "small": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350061950/gosyyrk73argdn8r5cn9.png",
      "medium": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350061950/gosyyrk73argdn8r5cn9.png",
      "large": "http://a2.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350061950/gosyyrk73argdn8r5cn9.png"
    }
  ],
  "comments": [
    {
      "id": 11,
      "comment": "that's great",
      "name": "",
      "avatar_url": "http://placekitten.com/200/200"
    },
    {
      "id": 10,
      "comment": "LOLOL\r\n",
      "name": "",
      "avatar_url": "http://placekitten.com/200/200"
    }
  ],
  "interests": [

  ]
}

POST /items/create

Create a new item. (required user login)

Parameters

  • item - object of item, to be inserted

Returns

Returns created item, or 422 unprocessable entity.

Clone this wiki locally