Items

Items act as containers for your JSON data. They are stored in lists, and in each item is given a unique id that can be used to identify the item.

{
	"created": "2015-03-14T23:08:15+00:00",
	"data": {
		// Item data...
	},
	"id": "23928779684449152",
	"updated": "2015-03-14T23:08:15+00:00"
}

Item fields

created The time that this item was created.
data The data stored inside this item.
id The unique id for this item.
updated The time that this item was last updated. If the item has not been updated, this will be the same as the time that the item was created.

Sorting items

Default index
descending: false
index Sort items by their auto-incremental index. In most cases, this will represent the order in which items were added to the list.
created Sort items by their created time.
updated Sort items by their last updated time.
Index name Items can be sorted on any index defined in the list that contains the items. See Indexes for further information.

Item routes

GET lists/{name}/items

Return a list of items in the specified list.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items \
	-u username:token \
	-H "Accept: application/json"

Example response
{
	"descending": false,
	"items": [
		{
			"created": "2015-03-14T23:08:15+00:00",
			"data": {
				// Item data...
			},
			"id": "23928779684449152",
			"updated": "2015-03-14T23:08:15+00:00"
		},
		// Items continued...
	],
	"page": 1,
	"page_size": 50,
	"pages": 20,
	"sort": "index",
	"total": 1000
}

GET lists/{name}/items/data

Return a list of unwrapped items in the specified list. Only the data for each item will be returned.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/data \
	-u username:token \
	-H "Accept: application/json"

Example response
[
	{
		// Item data...
	},
	// Items continued...
]

GET lists/{name}/items/data/{path}

Return a list of values (or a subsection of item data) extracted from the items in the specified list. The last part of the route path (everything after /data) will be used as a JSON pointer into each item's data.

If the JSON pointer is invalid or not found for one or more items in the list, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/data/a/1 \
	-u username:token \
	-H "Accept: application/json"

Example response
[
	1,
	2,
	3,
	// Item values or subsections continued...
]

GET lists/{name}/items/{id}

Return the specified item.

If a If-None-Match header is included with the request and the content of the header matches the hash of the requested item's data, the API will respond with a 304 Not Modified status code and the response body will be empty. The request will not count towards the rate limit.

If no If-None-Match header is included or if the item has been modified, a ETag header will be included in the response containing a hash of the item's data so that it can be cached.

ETag: 0e988e0e8dec56e3bb331e110109cc24

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152 \
	-u username:token \
	-H "Accept: application/json"

Example response
{
	"item": {
		"created": "2015-03-14T23:08:15+00:00",
		"data": {
			// Item data...
		},
		"id": "23928779684449152",
		"updated": "2015-03-14T23:08:15+00:00"
	}
}

GET lists/{name}/items/{id}/data

Return the specified item's data.

If a If-None-Match header is included with the request and the content of the header matches the hash of the requested item's data, the API will respond with a 304 Not Modified status code and the response body will be empty. The request will not count towards the rate limit.

If no If-None-Match header is included or if the item has been modified, a ETag header will be included in the response containing a hash of the item's data so that it can be cached.

ETag: 0e988e0e8dec56e3bb331e110109cc24

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152/data \
	-u username:token \
	-H "Accept: application/json"

Example response
{
	// Item data...
}

GET lists/{name}/items/{id}/data/{path}

Return a value or subsection from the specified item's data. The last part of the route path (everything after /data) will be used as a JSON pointer into the item's data.

If the JSON pointer is invalid or not found, the API will respond with a 400 Bad Request status code.

If a If-None-Match header is included with the request and the content of the header matches the hash of the requested item's data, the API will respond with a 304 Not Modified status code and the response body will be empty. The request will not count towards the rate limit.

If no If-None-Match header is included or if the item has been modified, a ETag header will be included in the response containing a hash of the item's data so that it can be cached.

ETag: 0e988e0e8dec56e3bb331e110109cc24

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152/data/a/1 \
	-u username:token \
	-H "Accept: application/json"

Example response
{
	// Item data value or subsection...
}

GET lists/{name}/items/{id}/events

Return a list of events for the specified item.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152/events \
	-u username:token \
	-H "Accept: application/json"

Example response
{
	"descending": true,
	"events": [
		{
			"action": "Create",
			"data": {
				"details": "Item created.",
				"data": "Item data..."
			},
			"id": "23928779684449153",
			"object_id": "23928779684449152",
			"object_type": "Item",
			"time": "2015-03-14T23:08:15+00:00"
		},
		// Events continued...
	],
	"page": 1,
	"page_size": 50,
	"pages": 1,
	"sort": "time",
	"total": 2
}

POST lists/{name}/items

Create a new item in the specified list.

The POST data for this request must be stringified JSON data. If the data is not valid JSON, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items \
	-u username:token \
	-X POST \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-d '{"test_property":"test_value"}'

Example response
{
	"item": {
		"created": "2015-03-14T23:08:15+00:00",
		"data": {
			"test_property": "test_value"
		},
		"id": "23928779684449152",
		"updated": "2015-03-14T23:08:15+00:00"
	}
}

POST lists/{name}/items/{id}/data/{path}

Append a value to an array inside the specified item's data. The last part of the route path (everything after /data) will be used as a JSON pointer into the item's data.

If the JSON pointer is invalid or not found, or if the requested value is not an array, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152/data/a/1 \
	-u username:token \
	-X POST \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-d '{"new_property":"new_value"}'

Example response
{
	// Item data...
}

PUT lists/{name}/items/{id}

Replace the specified item's data.

The PUT data for this request must be stringified JSON data. If the data is not valid JSON, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152 \
	-u username:token \
	-X PUT \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-d '{"test_property":"test_value2"}'

Example response
{
	"item": {
		"created": "2015-03-14T23:08:15+00:00",
		"data": {
			"test_property": "test_value2"
		},
		"id": "23928779684449152",
		"updated": "2015-03-14T23:12:31+00:00"
	}
}

PUT lists/{name}/items/{id}/data/{path}

Update a value in the specified item's data. The last part of the route path (everything after /data) will be used as a JSON pointer into the item's data.

If the JSON pointer is invalid or not found, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152/data/a/1 \
	-u username:token \
	-X PUT \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-d "5"

Example response
{
	// Item data...
}

PATCH lists/{name}/items/{id}

Partially update the specified item's data using JSON patch format.

The PATCH data for this request must be stringified JSON data. If the data is not valid JSON, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152 \
	-u username:token \
	-X PATCH \
	-H "Content-Type: application/json" \
	-H "Accept: application/json" \
	-d '[{"op":"add","path":"/another_property","value":123}]'

Example response
{
	"item": {
		"created": "2015-03-14T23:08:15+00:00",
		"data": {
			"test_property": "test_value",
			"another_property": 123
		},
		"id": "23928779684449152",
		"updated": "2015-03-14T23:12:31+00:00"
	}
}

DELETE lists/{name}/items/{id}

Delete the specified item.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152 \
	-u username:token \
	-X DELETE \
	-H "Accept: application/json"

This endpoint will return a 204 No Content status code and the response body will be empty.

DELETE lists/{name}/items/{id}/data/{path}

Remove a value or subsection from the specified item's data. The last part of the route path (everything after /data) will be used as a JSON pointer into the item's data.

If the JSON pointer is invalid or not found, the API will respond with a 400 Bad Request status code.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items/23928779684449152/data/a/1 \
	-u username:token \
	-X DELETE \
	-H "Accept: application/json"

Example response
{
	// Item data...
}

DELETE lists/{name}/items

Delete all items in the specified list.

Example request
$ curl https://jsonpad.io/api/v1.0/lists/testlist/items \
	-u username:token \
	-X DELETE \
	-H "Accept: application/json"

This endpoint will return a 204 No Content status code and the response body will be empty.