Introduction
Welcome to the LeadPages Warehouse API documentation.
This API adheres to the LeadPages HTTP API Standards document.
The Warehouse API provides a place for you to store small bits of JSON data on a per-service and per-user basis. It's intended to be fast, flexible and easy to utilize.
Data is organized using Crates and Bottles. Crates are ostensibly service specific, and contain Bottles of arbitrary JSON. We enforce a very minimal schema, and require a very minimal amount of information, so keeping track of the data that's stored, what format it is, and so on is completely up to you.
Good luck, and don't screw it up.
Endpoints
/warehouse/v1
Ping
/warehouse/v1/ping
A no-op endpoint that simply reports the version of the the service.
http GET https://api-test.leadpages.io/warehouse/v1/ping
{
"_status": {
"code": 200
},
"_meta": {
"_version": "0.2.32"
}
}
Request
GET /warehouse/v1/ping
| Body | |
|---|---|
| Empty | |
Response
| Body | |
|---|---|
_meta._version |
StringThe current internal version number of the API. |
_meta |
Dictionary |
| Responses | |
|---|---|
200 OK |
|
| Errors | |
|---|---|
| Empty | |
Crates
/warehouse/v1/crates
A Crate is a place for a service to put small Bottles of useful information for use at a later time. Crates exist implicitly, and are created simply by requesting them. The ID of a Crate is the same as its label, and it's up to you what that is, as long as it makes sense to use in a URL. You can try putting a forward slash in it, but we can't promise it'll work.
http GET https://api-test.leadpages.io/warehouse/v1/crates
{
"_status": {
"code": 200
},
"_items": [
{
"manifest": null,
"bottles": null,
"_meta": {
"updated": "2016-11-17T14:58:35+00:00",
"created": "2016-11-17T14:58:35+00:00",
"id": "integrations",
"uri": "https://api-test.leadpages.io/warehouse/v1/crates/integrations"
},
"label": "integrations"
}
],
"_meta": {
"count": 1,
"cursor": "Mi0qXnZeKi1DZ0E9",
"total": null,
"limit": 20
}
}
Request
GET /warehouse/v1/crates
Enumerate Crates that already exist.
| Body | |
|---|---|
| Empty | |
| Query string | |
|---|---|
cursor |
String?A string representing where a previous request "left off" |
limit |
Regexp?(\d+)The maximum number of items to return in the response. |
Response
| Body | |
|---|---|
_items |
List[Crate]A list of the requested Crates. |
_meta |
ListingMetaMeta information about the response. |
| Responses | |
|---|---|
200 OK |
|
| Errors | |
|---|---|
| Empty | |
Crate
/warehouse/v1/crates/{label}
Any interaction with a Crate via this endpoint or
any of its children will create the Crate if it does not already
exist. Except for DELETE, because that would be idiotic.
http GET https://api-test.leadpages.io/warehouse/v1/crates/example?expand=true
{
"_status": {
"code": 200
},
"label": "example",
"bottles": [
{
"_meta": {
"id": "ZYoN8YH5JxFfn77fLoscAG",
"updated": "2016-11-17T15:12:10+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG",
"created": "2016-11-17T15:12:10+00:00"
},
"vintage": 1,
"crate": "example",
"label": "Éphémère",
"expiration": null,
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
}
],
"_meta": {
"id": "example",
"updated": "2016-11-17T15:02:41+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/crates/example",
"created": "2016-11-17T15:02:22+00:00"
},
"manifest": {
"exampleKey": "Example value"
}
}
Request
GET /warehouse/v1/crates/{label}
Get or create the specified Crate. You may also
request that the Crate be expanded, in which case the response
will include all of the Bottles in the Crate. This method may
return a status code of 201 to indicate that the Crate was
created automatically to service the request.
| Body | |
|---|---|
| Empty | |
| Query string | |
|---|---|
expand |
Enum('true', 'True', 'yes', 'false', 'False', 'no')A boolean indicating whether nested entities should be expanded. Defaults to false. |
Response
| Body | |
|---|---|
manifest |
Dictionary?An optional property that can be arbitrary JSON. A smart person would use this to store information about the Bottles the Crate contains. |
bottles |
List?[Bottle]The Bottles that are in the Crate, if expansion was requested and the endpoint/method called supports it. |
_meta |
MetaMeta information about the resource. |
label |
StringThe label/ID for the Crate. This should be something reasonable that at least identifies the service or product that owns the Crate. |
| Responses | |
|---|---|
200 OK |
|
201 Created |
|
| Errors | |
|---|---|
| Empty | |
Request
PATCH /warehouse/v1/crates/{label}
Force the Crate to rebuild its cache of Bottles. Do this if you are missing Bottles when fetching an expanded Crate.
| Body | |
|---|---|
| Empty | |
| Query string | |
|---|---|
expand |
Enum('true', 'True', 'yes', 'false', 'False', 'no')A boolean indicating whether nested entities should be expanded. Defaults to false. |
Response
| Body | |
|---|---|
manifest |
Dictionary?An optional property that can be arbitrary JSON. A smart person would use this to store information about the Bottles the Crate contains. |
bottles |
List?[Bottle]The Bottles that are in the Crate, if expansion was requested and the endpoint/method called supports it. |
_meta |
MetaMeta information about the resource. |
label |
StringThe label/ID for the Crate. This should be something reasonable that at least identifies the service or product that owns the Crate. |
| Responses | |
|---|---|
200 OK |
|
201 Created |
|
| Errors | |
|---|---|
| Empty | |
http PUT https://api-test.leadpages.io/warehouse/v1/crates/example?expand=true < example.json
{
"manifest": {
"exampleKey": "Example value"
}
}
{
"_status": {
"code": 200
},
"label": "example",
"bottles": [
{
"_meta": {
"id": "ZYoN8YH5JxFfn77fLoscAG",
"updated": "2016-11-17T15:12:10+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG",
"created": "2016-11-17T15:12:10+00:00"
},
"vintage": 1,
"crate": "example",
"label": "Éphémère",
"expiration": null,
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
}
],
"_meta": {
"id": "example",
"updated": "2016-11-17T15:31:57+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/crates/example",
"created": "2016-11-17T15:02:22+00:00"
},
"manifest": {
"exampleKey": "Example value"
}
}
Request
PUT /warehouse/v1/crates/{label}
Create or update the specified Crate. Use this
to populate or modify the Crate's manifest. This method can
also expand the response to the include the Crate's Bottles.
This method may return a status code of 201 to indicate that
the Crate did not previously exist.
| Body | |
|---|---|
manifest |
Dictionary?An optional property that can be arbitrary JSON. A smart person would use this to store information about the Bottles the Crate contains. |
| Query string | |
|---|---|
expand |
Enum('true', 'True', 'yes', 'false', 'False', 'no')A boolean indicating whether nested entities should be expanded. Defaults to false. |
Response
| Body | |
|---|---|
manifest |
Dictionary?An optional property that can be arbitrary JSON. A smart person would use this to store information about the Bottles the Crate contains. |
bottles |
List?[Bottle]The Bottles that are in the Crate, if expansion was requested and the endpoint/method called supports it. |
_meta |
MetaMeta information about the resource. |
label |
StringThe label/ID for the Crate. This should be something reasonable that at least identifies the service or product that owns the Crate. |
| Responses | |
|---|---|
200 OK |
|
201 Created |
|
| Errors | |
|---|---|
| Empty | |
Request
DELETE /warehouse/v1/crates/{label}
Remove the specific Crate and all of its
Bottles. Since Crates exist implicitly, this will always
succeed with a 204, but it's essentially a no-op if the Crate
didn't exist.
| Body | |
|---|---|
| Empty | |
Response
| Body | |
|---|---|
| Empty | |
| Responses | |
|---|---|
200 OK |
|
201 Created |
|
204 No Content |
|
| Errors | |
|---|---|
| Empty | |
Bottles
/warehouse/v1/crates/{label}/bottles
Bottles are the container for your arbitrary
JSON junk data. All Bottles belong to a Crate.
http GET https://api-test.leadpages.io/warehouse/v1/crates/example/bottles
{
"_status": {
"code": 200
},
"_items": [
{
"_meta": {
"updated": "2016-11-17T15:12:10+00:00",
"created": "2016-11-17T15:12:10+00:00",
"id": "ZYoN8YH5JxFfn77fLoscAG",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG"
},
"vintage": 1,
"crate": "example",
"label": "Éphémère",
"expiration": null,
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
}
],
"_meta": {
"count": 1,
"cursor": "Mi0qXnZeKi1DZ0E9",
"total": null,
"limit": 20
}
}
Request
GET /warehouse/v1/crates/{label}/bottles
Enumerate the Bottles in the specified
Crate. This method may return a status code of 201 to
indicate that the Crate was created automatically to service
the request. Of course, the response will just contain an
empty list. Unfortunately we burned our last spell slot
magically making the Crate for you, so we don't have any
left over to magically make Bottles, too.
| Body | |
|---|---|
| Empty | |
| Query string | |
|---|---|
cursor |
String?A string representing where a previous request "left off" |
limit |
Regexp?(\d+)The maximum number of items to return in the response. |
Response
| Body | |
|---|---|
_items |
List[Bottle]A list of the requested Bottles. |
_meta |
ListingMetaMeta information about the response. |
| Responses | |
|---|---|
200 OK |
|
201 Created |
|
| Errors | |
|---|---|
| Empty | |
http POST https://api-test.leadpages.io/warehouse/v1/crates/example/bottles < example.json
{
"label": "Éphémère",
"contents": {
"origin": "Chambly, Quebec",
"brewedSince": 2016,
"ABV": 5.5,
"style": "White ale brewed with fruit",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7,
"body": "Thin",
"aftertaste": "Medium"
}
}
{
"_meta": {
"id": "ZYoN8YH5JxFfn77fLoscAG",
"updated": "2016-11-17T15:12:10+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG",
"created": "2016-11-17T15:12:10+00:00"
},
"vintage": 1,
"crate": "example",
"label": "Éphémère",
"expiration": null,
"_status": {
"code": 201
},
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
}
Request
POST /warehouse/v1/crates/{label}/bottles
Creates a Bottle in the specified Crate. You should probaly also update the Crate's manifest so 6 months from now, you have a hope of figuring out why that Bottle full of gibberish exists.
| Body | |
|---|---|
expiration |
DateTime?When the Bottle expires, at which time it will be automatically removed. |
contents |
DictionaryAnything you want... as long as it's JSON. |
label |
StringAn arbitrary string to identify the Bottle. Yes, it's required, but you're smart. You'll think of something intelligent to call it. |
Response
| Body | |
|---|---|
_meta |
MetaMeta information about the resource. |
vintage |
IntegerThe number of times this Bottle has been updated. |
crate |
StringThe label of the Crate to which this Bottle belongs. |
label |
StringAn arbitrary string to identify the Bottle. Yes, it's required, but you're smart. You'll think of something intelligent to call it. |
expiration |
DateTime?When the Bottle expires, at which time it will be automatically removed. |
contents |
DictionaryAnything you want... as long as it's JSON. |
| Responses | |
|---|---|
201 Created |
|
| Errors | |
|---|---|
| Empty | |
Bottles
/warehouse/v1/bottles
http GET https://api-test.leadpages.io/warehouse/v1/bottles
{
"_status": {
"code": 200
},
"_items": [
{
"_meta": {
"updated": "2016-11-17T15:12:10+00:00",
"created": "2016-11-17T15:12:10+00:00",
"id": "ZYoN8YH5JxFfn77fLoscAG",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG"
},
"vintage": 1,
"crate": "example",
"label": "Éphémère",
"expiration": null,
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
},
{
"_meta": {
"updated": "2016-11-17T14:58:36+00:00",
"created": "2016-11-17T14:58:36+00:00",
"id": "JPHiYGE6zbE2hqYfVCXyXE",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/JPHiYGE6zbE2hqYfVCXyXE"
},
"vintage": 1,
"crate": "integrations",
"label": "archived",
"expiration": null,
"contents": {}
}
],
"_meta": {
"count": 2,
"cursor": "Mi0qXnZeKi1DZ0E9",
"total": null,
"limit": 20
}
}
Request
GET /warehouse/v1/bottles
Enumerate all Bottles regardless of the Crate they belong to.
| Body | |
|---|---|
| Empty | |
| Query string | |
|---|---|
cursor |
String?A string representing where a previous request "left off" |
limit |
Regexp?(\d+)The maximum number of items to return in the response. |
Response
| Body | |
|---|---|
_items |
List[Bottle]A list of the requested Bottles. |
_meta |
ListingMetaMeta information about the response. |
| Responses | |
|---|---|
200 OK |
|
| Errors | |
|---|---|
| Empty | |
Bottle
/warehouse/v1/bottles/{uuid}
You can interact with specific Bottles by their ID. No, you can't make the IDs arbitrary strings like Crates, that's why Bottles have labels. Don't be such a goon.
http GET https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG
{
"_meta": {
"id": "ZYoN8YH5JxFfn77fLoscAG",
"updated": "2016-11-17T15:12:10+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG",
"created": "2016-11-17T15:12:10+00:00"
},
"vintage": 1,
"crate": "example",
"label": "Éphémère",
"expiration": null,
"_status": {
"code": 200
},
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
}
Request
GET /warehouse/v1/bottles/{uuid}
Get a specific Bottle, probably because you want whatever's in it.
| Body | |
|---|---|
| Empty | |
Response
| Body | |
|---|---|
_meta |
MetaMeta information about the resource. |
vintage |
IntegerThe number of times this Bottle has been updated. |
crate |
StringThe label of the Crate to which this Bottle belongs. |
label |
StringAn arbitrary string to identify the Bottle. Yes, it's required, but you're smart. You'll think of something intelligent to call it. |
expiration |
DateTime?When the Bottle expires, at which time it will be automatically removed. |
contents |
DictionaryAnything you want... as long as it's JSON. |
| Responses | |
|---|---|
200 OK |
|
| Errors | |
|---|---|
404 Not Found |
bottle '{}' not found |
http PUT https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG < example.json
{
"label": "Éphémère",
"expiration": "2026-11-17T15:12:10+00:00",
"contents": {
"origin": "Chambly, Quebec",
"brewedSince": 2016,
"ABV": 5.5,
"style": "White ale brewed with fruit",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7,
"body": "Thin",
"aftertaste": "Medium",
"nose": ["Wild berry aromas", "citrus notes"]
}
}
{
"_meta": {
"id": "ZYoN8YH5JxFfn77fLoscAG",
"updated": "2016-11-17T16:56:29+00:00",
"uri": "https://api-test.leadpages.io/warehouse/v1/bottles/ZYoN8YH5JxFfn77fLoscAG",
"created": "2016-11-17T15:12:10+00:00"
},
"vintage": 3,
"crate": "example",
"label": "Éphémère",
"expiration": "2026-11-17T15:12:10+00:00",
"_status": {
"code": 200
},
"contents": {
"origin": "Chambly, Quebec",
"body": "Thin",
"style": "White ale brewed with fruit",
"brewedSince": 2016,
"nose": [
"Wild berry aromas",
"citrus notes"
],
"ABV": 5.5,
"aftertaste": "Medium",
"flavor": "Vivid blueberry flavor with a complementary acidity",
"IBU": 7
}
}
Request
PUT /warehouse/v1/bottles/{uuid}
Update or modify the specified Bottle. This
action will automatically increment the Bottle's vintage.
| Body | |
|---|---|
expiration |
DateTime?When the Bottle expires, at which time it will be automatically removed. |
contents |
DictionaryAnything you want... as long as it's JSON. |
label |
StringAn arbitrary string to identify the Bottle. Yes, it's required, but you're smart. You'll think of something intelligent to call it. |
Response
| Body | |
|---|---|
_meta |
MetaMeta information about the resource. |
vintage |
IntegerThe number of times this Bottle has been updated. |
crate |
StringThe label of the Crate to which this Bottle belongs. |
label |
StringAn arbitrary string to identify the Bottle. Yes, it's required, but you're smart. You'll think of something intelligent to call it. |
expiration |
DateTime?When the Bottle expires, at which time it will be automatically removed. |
contents |
DictionaryAnything you want... as long as it's JSON. |
| Responses | |
|---|---|
200 OK |
|
| Errors | |
|---|---|
404 Not Found |
bottle '{}' not found |
Request
DELETE /warehouse/v1/bottles/{uuid}
Gets rid of the specified Bottle, which is something you should do when you're done with it. This isn't college, and having Bottles laying everywhere isn't cool.
| Body | |
|---|---|
| Empty | |
Response
| Body | |
|---|---|
| Empty | |
| Responses | |
|---|---|
204 No Content |
|
| Errors | |
|---|---|
404 Not Found |
bottle '{}' not found |
Definitions
Bottle
| Bottle | |
|---|---|
_meta |
MetaMeta information about the resource. |
vintage |
IntegerThe number of times this Bottle has been updated. |
crate |
StringThe label of the Crate to which this Bottle belongs. |
label |
StringAn arbitrary string to identify the Bottle. Yes, it's required, but you're smart. You'll think of something intelligent to call it. |
expiration |
DateTime?When the Bottle expires, at which time it will be automatically removed. |
contents |
DictionaryAnything you want... as long as it's JSON. |
Meta
| Meta | |
|---|---|
updated |
DateTimeWhen the resource was last updated. |
created |
DateTimeWhen the resource was created. |
id |
StringThe resource's unique identifier. |
uri |
StringThe resource's absolute URI. |
ListingMeta
| ListingMeta | |
|---|---|
count |
IntegerThe total number of items in the response. |
cursor |
String?This is used in conjunction with limit to paginate through lists of items. |
total |
Integer?The number of items in the database. |
limit |
IntegerThe requested limit on the number of items. |
Crate
| Crate | |
|---|---|
label |
StringThe label/ID for the Crate. This should be something reasonable that at least identifies the service or product that owns the Crate. |
bottles |
List?[Bottle]The Bottles that are in the Crate, if expansion was requested and the endpoint/method called supports it. |
_meta |
MetaMeta information about the resource. |
manifest |
Dictionary?An optional property that can be arbitrary JSON. A smart person would use this to store information about the Bottles the Crate contains. |