Items

List

GET /items.(json|xml)
Returns a collection of items associated with the authenticated user’s account. The results will be paginated. You can use the following optional parameters to traverse the results.

  • per_page – Number of results per page (default: 20)
  • page – Page in result-set

Sample JSON Response

Status: 200 OK
 
[
  {
    "item": {
      "price": "$150.00",
      "name": "My Item",
      "created_at": "2010-08-24T01:47:50Z",
      "updated_at": "2010-08-24T01:47:50Z",
      "units": "hourly",
      "id": 25,
      "description": "This is a sample item"
    }
  },
  {
    "item": {
      "price": "$25.00",
      "name": "Another Item",
      "created_at": "2010-08-26T01:47:50Z",
      "updated_at": "2010-08-26T01:47:50Z",
      "units": "Km",
      "id": 30,
      "description": "This is another sample item"
    }
  }
]

Sample XML Response

Status: 200 OK
 
<?xml version="1.0" encoding="UTF-8"?>
<items>
  <item>
    <item>
      <price>$150.00</price>
      <name>My Item</name>
      <created-at>2010-08-24T01:47:50Z</created-at>
      <updated-at>2010-08-24T01:47:50Z</updated-at>
      <units>hourly</units>
      <id type="integer">25</id>
      <description>This is a sample item</description>
    </item>
  </item>
  <item>
    <item>
      <price>$25.00</price>
      <name>Another Item</name>
      <created-at>2010-08-26T01:47:50Z</created-at>
      <updated-at>2010-08-26T01:47:50Z</updated-at>
      <units>Km</units>
      <id type="integer">30</id>
      <description>This is another sample item</description>
    </item>
  </item>
</items>

Show Top

GET /items/#{id}.(json|xml)
Returns a single item that belongs to the authenticated user’s account.

Sample JSON Response

Status: 200 OK
 
{
    "item": {
      "price": "$150.00",
      "name": "My Item",
      "created_at": "2010-08-24T01:47:50Z",
      "updated_at": "2010-08-24T01:47:50Z",
      "units": "hourly",
      "id": 25,
      "description": "This is a sample item"
    }
}

Sample XML Response

Status: 200 OK
 
<?xml version="1.0" encoding="UTF-8"?>
<item>
  <price>$150.00</price>
  <name>My Item</name>
  <created-at>2010-08-24T01:47:50Z</created-at>
  <updated-at>2010-08-24T01:47:50Z</updated-at>
  <units>hourly</units>
  <id type="integer">25</id>
  <description>This is a sample item</description>
</item>

Create Top

POST /items.(json|xml)
Creates a new item under the authenticated user’s account. Only the Name of the item is required, all other parameters are optional. Returns the created item as the response.

Sample JSON Request

{
  "item": {
    "name": "My Item",
    "price": "25",
    "units": "hourly",
    "description": "This is a sample item"
  }
}

Sample JSON Response

Status: 201 Created
Location: http://example.curdbee.com/items/#{id}
 
{
  "item": {
    "id":  #{id},
    ...
  }
}

Sample XML Request

<?xml version="1.0" encoding="UTF-8"?>
<item>
  <price>25</price>
  <name>My Item</name>
  <units>hourly</units>
  <description>This is a sample item</description>
</item>

Sample XML Response

Status: 201 Created
Location: http://example.curdbee.com/items/#{id}
 
<item>
  ...
</item>

Update Top

PUT /items/#{id}.(json|xml)
Updates an existing item that belongs to the authenticated user’s account. Returns the updated item.

Sample JSON Request

{
  "item": {
    "price": "45",
  }
}

Sample JSON Response

Status: 200 OK
Location: http://example.curdbee.com/items/#{id}
 
{
  "item": {
    "id":  #{id},
    ...
  }
}

Sample XML Request

<item>
  <price>45</price>
</item>

Sample XML Response

Status: 200 OK
Location: http://example.curdbee.com/items/#{id}
 
<item>
  <id>#{id}</id>
  ...
</item>

Delete Top

DELETE /items/#{id}.(json|xml)
Deletes an existing item that belongs to the authenticated user’s account.

Sample JSON/XML Response

Status: 200 OK

Vesess Web design & web application development - Sri Lanka

All text and design is copyright © 2008 - 2012 Vesess. All rights reserved.