Browse Source

docs

pull/20/head
Peter Johnson 10 years ago
parent
commit
ebf6e6eecd
  1. 22
      docs/404.md
  2. 4
      docs/cors.md
  3. 26
      docs/index.md
  4. 4
      docs/jsonp.md
  5. 41
      docs/reverse/success.md
  6. 277
      docs/search/success.md
  7. 216
      docs/suggest/success.md

22
docs/404.md

@ -1,6 +1,6 @@
# invalid path # invalid path
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -27,7 +27,7 @@ Status: 404
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "35", "content-length": "35",
"etag": "W/\"23-dfdfa185\"", "etag": "W/\"23-dfdfa185\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -39,19 +39,14 @@ Status: 404
## Tests ## Tests
### ✓ cache-control header correctly set ### ✓ not found
```javascript
response.should.have.header 'Cache-Control','public,max-age=300'
```
### ✓ content-type header correctly set
```javascript ```javascript
response.should.have.header 'Content-Type','application/json; charset=utf-8' response.statusCode.should.equal 404
``` ```
### ✓ not found ### ✓ cache-control header correctly set
```javascript ```javascript
response.statusCode.should.equal 404 response.should.have.header 'Cache-Control','public,max-age=300'
``` ```
### ✓ should respond in json with server info ### ✓ should respond in json with server info
@ -61,3 +56,8 @@ should.exist json.error
json.error.should.equal 'not found: invalid path' json.error.should.equal 'not found: invalid path'
``` ```
### ✓ content-type header correctly set
```javascript
response.should.have.header 'Content-Type','application/json; charset=utf-8'
```

4
docs/cors.md

@ -1,6 +1,6 @@
# cross-origin resource sharing # cross-origin resource sharing
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -27,7 +27,7 @@ Status: 200
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "50", "content-length": "50",
"etag": "W/\"32-85536434\"", "etag": "W/\"32-85536434\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```

26
docs/index.md

@ -1,6 +1,6 @@
# api root # api root
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -27,7 +27,7 @@ Status: 200
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "50", "content-length": "50",
"etag": "W/\"32-85536434\"", "etag": "W/\"32-85536434\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -42,14 +42,15 @@ Status: 200
## Tests ## Tests
### ✓ endpoint available ### ✓ vanity header correctly set
```javascript ```javascript
response.statusCode.should.equal 200 response.should.have.header 'X-Powered-By','mapzen'
``` ```
### ✓ cache-control header correctly set ### ✓ server header correctly set
```javascript ```javascript
response.should.have.header 'Cache-Control','public,max-age=60' response.should.have.header 'Server'
response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/
``` ```
### ✓ content-type header correctly set ### ✓ content-type header correctly set
@ -57,9 +58,9 @@ response.should.have.header 'Cache-Control','public,max-age=60'
response.should.have.header 'Content-Type','application/json; charset=utf-8' response.should.have.header 'Content-Type','application/json; charset=utf-8'
``` ```
### ✓ charset header correctly set ### ✓ cache-control header correctly set
```javascript ```javascript
response.should.have.header 'Charset','utf8' response.should.have.header 'Cache-Control','public,max-age=60'
``` ```
### ✓ should respond in json with server info ### ✓ should respond in json with server info
@ -69,14 +70,13 @@ should.exist json.name
should.exist json.version should.exist json.version
``` ```
### ✓ vanity header correctly set ### ✓ endpoint available
```javascript ```javascript
response.should.have.header 'X-Powered-By','mapzen' response.statusCode.should.equal 200
``` ```
### ✓ server header correctly set ### ✓ charset header correctly set
```javascript ```javascript
response.should.have.header 'Server' response.should.have.header 'Charset','utf8'
response.headers.server.should.match /Pelias\/\d{1,2}\.\d{1,2}\.\d{1,2}/
``` ```

4
docs/jsonp.md

@ -1,6 +1,6 @@
# jsonp # jsonp
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -27,7 +27,7 @@ Status: 200
"content-type": "application/javascript; charset=utf-8", "content-type": "application/javascript; charset=utf-8",
"content-length": "57", "content-length": "57",
"etag": "W/\"39-b8a2aba1\"", "etag": "W/\"39-b8a2aba1\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```

41
docs/reverse/success.md

@ -1,6 +1,6 @@
# valid reverse query # valid reverse query
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -25,16 +25,34 @@ Status: 200
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "32", "content-length": "263",
"etag": "W/\"20-a1afccd5\"", "etag": "W/\"107-75b55c25\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1411133881593, "type": "FeatureCollection",
"body": [] "features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-82.506198,
29.542519
]
},
"properties": {
"name": "Archer",
"admin0": "United States",
"admin1": "*florida",
"text": "Archer, *florida, United States"
}
}
],
"date": 1411669520735
} }
``` ```
@ -50,9 +68,12 @@ response.statusCode.should.equal 200
now = new Date().getTime() now = new Date().getTime()
should.exist json should.exist json
should.not.exist json.error should.not.exist json.error
should.exist json.date json.date.should.be.within now-5000, now+5000
json.date.should.be.within now-2000, now+2000 ```
should.exist json.body
json.body.should.be.instanceof Array ### ✓ valid geojson
```javascript
json.type.should.equal 'FeatureCollection'
json.features.should.be.instanceof Array
``` ```

277
docs/search/success.md

@ -1,6 +1,6 @@
# valid search query # valid search query
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:21 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -25,257 +25,35 @@ Status: 200
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "3549", "content-length": "289",
"etag": "W/\"Koi2nJQQ+otDRPmBy8JU7g==\"", "etag": "W/\"121-69343a38\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1411133881591, "type": "FeatureCollection",
"body": [ "features": [
{ {
"admin2": "Alachua", "type": "Feature",
"admin1": "Florida", "geometry": {
"admin0": "United States", "type": "Point",
"name": { "coordinates": [
"default": "Hidden Lake" -82.357442,
}, 29.72089
"gn_id": 0, ]
"suggest": { },
"input": [ "properties": {
"hidden lake" "name": "Hidden Lake",
], "admin0": "United States",
"payload": { "admin1": "Florida",
"id": "neighborhood/29372:_:_:_:hidden_lake", "admin2": "Alachua",
"geo": "-82.357442,29.720890" "text": "Hidden Lake, Alachua, United States"
},
"output": "Hidden Lake, Alachua, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-82.357442",
"lat": "29.720890"
}
},
{
"admin0": "United States",
"name": {
"default": "Lake Butler",
"alt": "Lake Butler city"
},
"gn_id": "4161171",
"suggest": {
"input": [
"lake butler",
"lake butler city"
],
"payload": {
"id": "locality/4387:locality:u:us:lake_butler",
"geo": "-82.339724,30.015529"
},
"output": "Lake Butler, United States"
},
"woe_id": null,
"center_point": {
"lon": "-82.339724",
"lat": "30.015529"
}
},
{
"admin0": "United States",
"name": {
"default": "Lake City",
"alt": "Lake City city"
},
"gn_id": "4161187",
"suggest": {
"input": [
"lake city",
"lake city city"
],
"payload": {
"id": "locality/4346:locality:u:us:lake_city",
"geo": "-82.659959,30.201687"
},
"output": "Lake City, United States"
},
"woe_id": null,
"center_point": {
"lon": "-82.659959",
"lat": "30.201687"
}
},
{
"admin2": "Lake",
"admin1": "Florida",
"admin0": "United States",
"name": {
"default": "Villages Of Lady Lake"
},
"gn_id": 0,
"suggest": {
"input": [
"villages of lady lake"
],
"payload": {
"id": "neighborhood/34180:_:_:_:villages_of_lady_lake",
"geo": "-81.952515,28.916553"
},
"output": "Villages Of Lady Lake, Lake, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-81.952515",
"lat": "28.916553"
}
},
{
"admin0": "United States",
"name": {
"default": "Lady Lake",
"alt": "Lady Lake town"
},
"gn_id": "4161118",
"suggest": {
"input": [
"lady lake",
"lady lake town"
],
"payload": {
"id": "locality/4478:locality:u:us:lady_lake",
"geo": "-81.922691,28.921806"
},
"output": "Lady Lake, United States"
},
"woe_id": null,
"center_point": {
"lon": "-81.922691",
"lat": "28.921806"
}
},
{
"admin0": "United States",
"name": {
"default": "Lake Panasoffkee",
"alt": "Lake Panasoffkee CDP"
},
"gn_id": "4161327",
"suggest": {
"input": [
"lake panasoffkee",
"lake panasoffkee cdp"
],
"payload": {
"id": "locality/4888:locality:u:us:lake_panasoffkee",
"geo": "-82.125431,28.785189"
},
"output": "Lake Panasoffkee, United States"
},
"woe_id": null,
"center_point": {
"lon": "-82.125431",
"lat": "28.785189"
}
},
{
"admin0": "United States",
"name": {
"default": "Asbury Lake",
"alt": "Asbury Lake CDP"
},
"gn_id": "4146302",
"suggest": {
"input": [
"asbury lake",
"asbury lake cdp"
],
"payload": {
"id": "locality/4797:locality:u:us:asbury_lake",
"geo": "-81.780018,30.050684"
},
"output": "Asbury Lake, United States"
},
"woe_id": null,
"center_point": {
"lon": "-81.780018",
"lat": "30.050684"
}
},
{
"admin0": "United States",
"name": {
"default": "Silver Lake",
"alt": "Silver Lake CDP"
},
"gn_id": "4172971",
"suggest": {
"input": [
"silver lake",
"silver lake cdp"
],
"payload": {
"id": "locality/4992:locality:u:us:silver_lake",
"geo": "-81.804157,28.846269"
},
"output": "Silver Lake, United States"
},
"woe_id": null,
"center_point": {
"lon": "-81.804157",
"lat": "28.846269"
}
},
{
"admin2": "Lake",
"admin1": "Florida",
"admin0": "United States",
"name": {
"default": "Oaks At Lake Dorr"
},
"gn_id": 0,
"suggest": {
"input": [
"oaks at lake dorr"
],
"payload": {
"id": "neighborhood/33992:_:_:_:oaks_at_lake_dorr",
"geo": "-81.639404,28.993127"
},
"output": "Oaks At Lake Dorr, Lake, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-81.639404",
"lat": "28.993127"
}
},
{
"admin2": "Lake",
"admin1": "Florida",
"admin0": "United States",
"name": {
"default": "Lake South"
},
"gn_id": 0,
"suggest": {
"input": [
"lake south"
],
"payload": {
"id": "neighborhood/34534:_:_:_:lake_south",
"geo": "-81.742766,28.797112"
},
"output": "Lake South, Lake, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-81.742766",
"lat": "28.797112"
} }
} }
] ],
"date": 1411669520989
} }
``` ```
@ -286,10 +64,13 @@ Status: 200
now = new Date().getTime() now = new Date().getTime()
should.exist json should.exist json
should.not.exist json.error should.not.exist json.error
should.exist json.date json.date.should.be.within now-5000, now+5000
json.date.should.be.within now-2000, now+2000 ```
should.exist json.body
json.body.should.be.instanceof Array ### ✓ valid geojson
```javascript
json.type.should.equal 'FeatureCollection'
json.features.should.be.instanceof Array
``` ```
### ✓ 200 ok ### ✓ 200 ok

216
docs/suggest/success.md

@ -1,6 +1,6 @@
# valid suggest query # valid suggest query
*Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)* *Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -25,115 +25,199 @@ Status: 200
"access-control-allow-headers": "X-Requested-With,content-type", "access-control-allow-headers": "X-Requested-With,content-type",
"access-control-allow-credentials": "true", "access-control-allow-credentials": "true",
"content-type": "application/json; charset=utf-8", "content-type": "application/json; charset=utf-8",
"content-length": "1248", "content-length": "1933",
"etag": "W/\"l7SMjqn0lVxkVsxRTJizhA==\"", "etag": "W/\"I89q+0HZNmXyHsTfLSP5Ww==\"",
"date": "Fri, 19 Sep 2014 13:38:01 GMT", "date": "Thu, 25 Sep 2014 18:25:20 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1411133881441, "type": "FeatureCollection",
"body": [ "features": [
{ {
"text": "ACRELÂNDIA, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/708:adm2:br:bra:acrel__ndia", "coordinates": [
"geo": "-66.908143,-9.954353" 7.56019,
5.419786
]
},
"properties": {
"text": "Abia, Nigeria",
"score": 1,
"type": "admin1",
"id": "1775:adm1:ng:nga:abia"
} }
}, },
{ {
"text": "ALTA FLORESTA, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/2986:adm2:br:bra:alta_floresta", "coordinates": [
"geo": "-56.404593,-10.042071" -66.908143,
-9.954353
]
},
"properties": {
"text": "Acrelândia, Brazil",
"score": 1,
"type": "admin2",
"id": "708:adm2:br:bra:acrel_ndia"
} }
}, },
{ {
"text": "ALTO ALEGRE, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/4611:adm2:br:bra:alto_alegre", "coordinates": [
"geo": "-62.627879,3.103540" -60.005461,
-3.099378
]
},
"properties": {
"text": "Adrianópolis, Manaus, Brasil",
"score": 1,
"type": "neighborhood",
"id": "799:_:_:_:adrian_polis"
} }
}, },
{ {
"text": "ALTO PARAÍSO, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/4584:adm2:br:bra:alto_para__so", "coordinates": [
"geo": "-63.418743,-9.697774" 7.909644,
5.013733
]
},
"properties": {
"text": "Akwa Ibom, Nigeria",
"score": 1,
"type": "admin1",
"id": "1776:adm1:ng:nga:akwa_ibom"
} }
}, },
{ {
"text": "ALVARÃES, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/832:adm2:br:bra:alvar__es", "coordinates": [
"geo": "-65.296384,-3.674615" 9.691808,
4.050576
]
},
"properties": {
"text": "Akwa, Littoral, Cameroun",
"score": 1,
"type": "neighborhood",
"id": "1863:_:_:_:akwa"
} }
}, },
{ {
"text": "AMAJARI, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/4610:adm2:br:bra:amajari", "coordinates": [
"geo": "-62.710104,3.724864" -56.404593,
-10.042071
]
},
"properties": {
"text": "Alta Floresta, Brazil",
"score": 1,
"type": "admin2",
"id": "2986:adm2:br:bra:alta_floresta"
} }
}, },
{ {
"text": "AMAZONAS, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin1/3232:adm1:br:bra:amazonas", "coordinates": [
"geo": "-64.949558,-3.785708" -62.627879,
3.10354
]
},
"properties": {
"text": "Alto Alegre, Brazil",
"score": 1,
"type": "admin2",
"id": "4611:adm2:br:bra:alto_alegre"
} }
}, },
{ {
"text": "ANAMÃ, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/834:adm2:br:bra:anam__", "coordinates": [
"geo": "-61.683670,-3.473836" -63.418743,
-9.697774
]
},
"properties": {
"text": "Alto Paraíso, Brazil",
"score": 1,
"type": "admin2",
"id": "4584:adm2:br:bra:alto_para_so"
} }
}, },
{ {
"text": "ANORI, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/835:adm2:br:bra:anori", "coordinates": [
"geo": "-62.182138,-4.154809" -65.296384,
-3.674615
]
},
"properties": {
"text": "Alvarães, Brazil",
"score": 1,
"type": "admin2",
"id": "832:adm2:br:bra:alvar_es"
} }
}, },
{ {
"text": "APIACÁS, Brazil", "type": "Feature",
"score": 1, "geometry": {
"payload": { "type": "Point",
"id": "admin2/2992:adm2:br:bra:apiac__s", "coordinates": [
"geo": "-57.803447,-8.583036" -62.710104,
3.724864
]
},
"properties": {
"text": "Amajari, Brazil",
"score": 1,
"type": "admin2",
"id": "4610:adm2:br:bra:amajari"
} }
} }
] ],
"date": 1411669520909
} }
``` ```
## Tests ## Tests
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
```
### ✓ valid geojson
```javascript
json.type.should.equal 'FeatureCollection'
json.features.should.be.instanceof Array
```
### ✓ valid response ### ✓ valid response
```javascript ```javascript
now = new Date().getTime() now = new Date().getTime()
should.exist json should.exist json
should.not.exist json.error should.not.exist json.error
should.exist json.date json.date.should.be.within now-5000, now+5000
json.date.should.be.within now-2000, now+2000
should.exist json.body
json.body.should.be.instanceof Array
```
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
``` ```

Loading…
Cancel
Save