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": "item",
    "desc": "item hhhh",
    "price": "1.0",
    "address": null,
    "latitude": 22.2859671,
    "longitude": 114.1905382,
    "photos": [

    ],
    "comments": [

    ]
  },
  {
    "id": 9,
    "title": "Little Cat",
    "desc": "LOLCAT",
    "price": "10000.0",
    "address": null,
    "latitude": 22.2860424,
    "longitude": 114.1904425,
    "photos": [
      {
        "small": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350064881/pqpylo6rthe2qtsuesda.jpg",
        "medium": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350064881/pqpylo6rthe2qtsuesda.jpg",
        "large": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350064881/pqpylo6rthe2qtsuesda.jpg"
      }
    ],
    "comments": [

      {
        "id": 1,
        "comment": "I want that!!"
      },
      {
        "id": 2,
        "comment": "Yes Yes"
      },
      {
        "id": 3,
        "comment": "My precious!!"
      },
      {
        "id": 4,
        "comment": "Lolol"
      },
      {
        "id": 5,
        "comment": "Lololol"
      }
    ]
  }
]

GET /items/nearby.json

Search nearby items.

Parameters

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

Sample

[
  {
    "id": 8,
    "title": "item",
    "desc": "item hhhh",
    "price": "1.0",
    "address": null,
    "latitude": 22.2859671,
    "longitude": 114.1905382,
    "photos": [

    ],
    "comments": [

    ]
  },
  {
    "id": 9,
    "title": "Little Cat",
    "desc": "LOLCAT",
    "price": "10000.0",
    "address": null,
    "latitude": 22.2860424,
    "longitude": 114.1904425,
    "photos": [
      {
        "small": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_300,w_300/v1350064881/pqpylo6rthe2qtsuesda.jpg",
        "medium": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_thumb,h_600,w_600/v1350064881/pqpylo6rthe2qtsuesda.jpg",
        "large": "http://a4.res.cloudinary.com/hvwz5zxen/image/upload/c_fit,h_1200,w_1200/v1350064881/pqpylo6rthe2qtsuesda.jpg"
      }
    ],
    "comments": [

      {
        "id": 1,
        "comment": "I want that!!"
      },
      {
        "id": 2,
        "comment": "Yes Yes"
      },
      {
        "id": 3,
        "comment": "My precious!!"
      },
      {
        "id": 4,
        "comment": "Lolol"
      },
      {
        "id": 5,
        "comment": "Lololol"
      }
    ]
  }
]

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