Browse Source

docs

pull/11/head
Peter Johnson 11 years ago
parent
commit
2ff3274cbe
  1. 22
      docs/404.md
  2. 4
      docs/cors.md
  3. 30
      docs/index.md
  4. 4
      docs/jsonp.md
  5. 45
      docs/reverse/success.md
  6. 270
      docs/search/success.md
  7. 20
      docs/suggest/success.md

22
docs/404.md

@ -1,6 +1,6 @@
# invalid path # invalid path
*Generated: Thu Sep 18 2014 14:53:39 GMT+0100 (BST)* *Generated: Fri Sep 19 2014 14:38:01 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": "Thu, 18 Sep 2014 13:53:39 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -39,14 +39,19 @@ Status: 404
## Tests ## Tests
### ✓ not found ### ✓ cache-control header correctly set
```javascript ```javascript
response.statusCode.should.equal 404 response.should.have.header 'Cache-Control','public,max-age=300'
``` ```
### ✓ cache-control header correctly set ### ✓ content-type header correctly set
```javascript ```javascript
response.should.have.header 'Cache-Control','public,max-age=300' response.should.have.header 'Content-Type','application/json; charset=utf-8'
```
### ✓ not found
```javascript
response.statusCode.should.equal 404
``` ```
### ✓ should respond in json with server info ### ✓ should respond in json with server info
@ -56,8 +61,3 @@ 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: Thu Sep 18 2014 14:53:39 GMT+0100 (BST)* *Generated: Fri Sep 19 2014 14:38:01 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": "Thu, 18 Sep 2014 13:53:39 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```

30
docs/index.md

@ -1,6 +1,6 @@
# api root # api root
*Generated: Thu Sep 18 2014 14:53:39 GMT+0100 (BST)* *Generated: Fri Sep 19 2014 14:38:01 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": "Thu, 18 Sep 2014 13:53:39 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```
@ -42,17 +42,6 @@ Status: 200
## Tests ## Tests
### ✓ server header correctly set
```javascript
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
```javascript
response.should.have.header 'Content-Type','application/json; charset=utf-8'
```
### ✓ endpoint available ### ✓ endpoint available
```javascript ```javascript
response.statusCode.should.equal 200 response.statusCode.should.equal 200
@ -63,9 +52,9 @@ response.statusCode.should.equal 200
response.should.have.header 'Cache-Control','public,max-age=60' response.should.have.header 'Cache-Control','public,max-age=60'
``` ```
### ✓ vanity header correctly set ### ✓ content-type header correctly set
```javascript ```javascript
response.should.have.header 'X-Powered-By','mapzen' response.should.have.header 'Content-Type','application/json; charset=utf-8'
``` ```
### ✓ charset header correctly set ### ✓ charset header correctly set
@ -80,3 +69,14 @@ should.exist json.name
should.exist json.version should.exist json.version
``` ```
### ✓ vanity header correctly set
```javascript
response.should.have.header 'X-Powered-By','mapzen'
```
### ✓ server header correctly set
```javascript
response.should.have.header 'Server'
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: Thu Sep 18 2014 14:53:39 GMT+0100 (BST)* *Generated: Fri Sep 19 2014 14:38:01 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": "Thu, 18 Sep 2014 13:53:39 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```

45
docs/reverse/success.md

@ -1,6 +1,6 @@
# valid reverse query # valid reverse query
*Generated: Fri Sep 19 2014 01:19:18 GMT-0400 (EDT)* *Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -25,44 +25,26 @@ 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": "319", "content-length": "32",
"etag": "W/\"13f-2852cff1\"", "etag": "W/\"20-a1afccd5\"",
"date": "Fri, 19 Sep 2014 05:19:18 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1411103958553, "date": 1411133881593,
"body": [ "body": []
{
"name": {
"default": "Adam"
},
"admin0": "United States",
"admin1": "Florida",
"admin2": "Alachua County",
"center_point": {
"lat": "29.49136",
"lon": "-82.50622"
},
"suggest": {
"input": [
"adam"
],
"payload": {
"id": "geoname/4145612",
"geo": "-82.50622,29.49136"
},
"output": "Adam, Alachua County, United States"
}
}
]
} }
``` ```
## Tests ## Tests
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
```
### ✓ valid response ### ✓ valid response
```javascript ```javascript
now = new Date().getTime() now = new Date().getTime()
@ -74,8 +56,3 @@ should.exist json.body
json.body.should.be.instanceof Array json.body.should.be.instanceof Array
``` ```
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
```

270
docs/search/success.md

@ -1,6 +1,6 @@
# valid search query # valid search query
*Generated: Fri Sep 19 2014 01:19:18 GMT-0400 (EDT)* *Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -25,234 +25,254 @@ 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": "3127", "content-length": "3549",
"etag": "W/\"w8ylf9fjcQKf+FF+Qzff1Q==\"", "etag": "W/\"Koi2nJQQ+otDRPmBy8JU7g==\"",
"date": "Fri, 19 Sep 2014 05:19:18 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1411103958550, "date": 1411133881591,
"body": [ "body": [
{ {
"name": { "admin2": "Alachua",
"default": "Blue Pete Lake"
},
"admin0": "United States",
"admin1": "Florida", "admin1": "Florida",
"admin2": "Alachua County", "admin0": "United States",
"center_point": { "name": {
"lat": "29.50312", "default": "Hidden Lake"
"lon": "-82.5052"
}, },
"gn_id": 0,
"suggest": { "suggest": {
"input": [ "input": [
"blue pete lake" "hidden lake"
], ],
"payload": { "payload": {
"id": "geoname/4148289", "id": "neighborhood/29372:_:_:_:hidden_lake",
"geo": "-82.5052,29.50312" "geo": "-82.357442,29.720890"
}, },
"output": "Blue Pete Lake, Alachua County, United States" "output": "Hidden Lake, Alachua, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-82.357442",
"lat": "29.720890"
} }
}, },
{ {
"name": {
"default": "Sawgrass Lake"
},
"admin0": "United States", "admin0": "United States",
"admin1": "Florida", "name": {
"admin2": "Levy County", "default": "Lake Butler",
"center_point": { "alt": "Lake Butler city"
"lat": "29.47185",
"lon": "-82.52097"
}, },
"gn_id": "4161171",
"suggest": { "suggest": {
"input": [ "input": [
"sawgrass lake" "lake butler",
"lake butler city"
], ],
"payload": { "payload": {
"id": "geoname/4172213", "id": "locality/4387:locality:u:us:lake_butler",
"geo": "-82.52097,29.47185" "geo": "-82.339724,30.015529"
}, },
"output": "Sawgrass Lake, Levy County, United States" "output": "Lake Butler, United States"
},
"woe_id": null,
"center_point": {
"lon": "-82.339724",
"lat": "30.015529"
} }
}, },
{ {
"name": {
"default": "Johnson Lake"
},
"admin0": "United States", "admin0": "United States",
"admin1": "Florida", "name": {
"admin2": "Marion County", "default": "Lake City",
"center_point": { "alt": "Lake City city"
"lat": "29.4468",
"lon": "-82.39141"
}, },
"gn_id": "4161187",
"suggest": { "suggest": {
"input": [ "input": [
"johnson lake" "lake city",
"lake city city"
], ],
"payload": { "payload": {
"id": "geoname/4160400", "id": "locality/4346:locality:u:us:lake_city",
"geo": "-82.39141,29.4468" "geo": "-82.659959,30.201687"
}, },
"output": "Johnson Lake, Marion County, United States" "output": "Lake City, United States"
},
"woe_id": null,
"center_point": {
"lon": "-82.659959",
"lat": "30.201687"
} }
}, },
{ {
"name": { "admin2": "Lake",
"default": "Ledwith Lake"
},
"admin0": "United States",
"admin1": "Florida", "admin1": "Florida",
"admin2": "Alachua County", "admin0": "United States",
"center_point": { "name": {
"lat": "29.49526", "default": "Villages Of Lady Lake"
"lon": "-82.35435"
}, },
"gn_id": 0,
"suggest": { "suggest": {
"input": [ "input": [
"ledwith lake" "villages of lady lake"
], ],
"payload": { "payload": {
"id": "geoname/4161738", "id": "neighborhood/34180:_:_:_:villages_of_lady_lake",
"geo": "-82.35435,29.49526" "geo": "-81.952515,28.916553"
}, },
"output": "Ledwith Lake, Alachua County, United States" "output": "Villages Of Lady Lake, Lake, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-81.952515",
"lat": "28.916553"
} }
}, },
{ {
"name": {
"default": "Levy Lake"
},
"admin0": "United States", "admin0": "United States",
"admin1": "Florida", "name": {
"admin2": "Alachua County", "default": "Lady Lake",
"center_point": { "alt": "Lady Lake town"
"lat": "29.52469",
"lon": "-82.35316"
}, },
"gn_id": "4161118",
"suggest": { "suggest": {
"input": [ "input": [
"levy lake" "lady lake",
"lady lake town"
], ],
"payload": { "payload": {
"id": "geoname/4047808", "id": "locality/4478:locality:u:us:lady_lake",
"geo": "-82.35316,29.52469" "geo": "-81.922691,28.921806"
}, },
"output": "Levy Lake, Alachua County, United States" "output": "Lady Lake, United States"
},
"woe_id": null,
"center_point": {
"lon": "-81.922691",
"lat": "28.921806"
} }
}, },
{ {
"name": {
"default": "Fox Lake"
},
"admin0": "United States", "admin0": "United States",
"admin1": "Florida", "name": {
"admin2": "Levy County", "default": "Lake Panasoffkee",
"center_point": { "alt": "Lake Panasoffkee CDP"
"lat": "29.54036",
"lon": "-82.66311"
}, },
"gn_id": "4161327",
"suggest": { "suggest": {
"input": [ "input": [
"fox lake" "lake panasoffkee",
"lake panasoffkee cdp"
], ],
"payload": { "payload": {
"id": "geoname/4156149", "id": "locality/4888:locality:u:us:lake_panasoffkee",
"geo": "-82.66311,29.54036" "geo": "-82.125431,28.785189"
}, },
"output": "Fox Lake, Levy County, United States" "output": "Lake Panasoffkee, United States"
},
"woe_id": null,
"center_point": {
"lon": "-82.125431",
"lat": "28.785189"
} }
}, },
{ {
"name": {
"default": "Lake Kanapaha"
},
"admin0": "United States", "admin0": "United States",
"admin1": "Florida", "name": {
"admin2": "Alachua County", "default": "Asbury Lake",
"center_point": { "alt": "Asbury Lake CDP"
"lat": "29.61705",
"lon": "-82.40502"
}, },
"gn_id": "4146302",
"suggest": { "suggest": {
"input": [ "input": [
"lake kanapaha" "asbury lake",
"asbury lake cdp"
], ],
"payload": { "payload": {
"id": "geoname/4161281", "id": "locality/4797:locality:u:us:asbury_lake",
"geo": "-82.40502,29.61705" "geo": "-81.780018,30.050684"
}, },
"output": "Lake Kanapaha, Alachua County, United States" "output": "Asbury Lake, United States"
},
"woe_id": null,
"center_point": {
"lon": "-81.780018",
"lat": "30.050684"
} }
}, },
{ {
"name": {
"default": "Doorshutter Lake"
},
"admin0": "United States", "admin0": "United States",
"admin1": "Florida", "name": {
"admin2": "Levy County", "default": "Silver Lake",
"center_point": { "alt": "Silver Lake CDP"
"lat": "29.53274",
"lon": "-82.70873"
}, },
"gn_id": "4172971",
"suggest": { "suggest": {
"input": [ "input": [
"doorshutter lake" "silver lake",
"silver lake cdp"
], ],
"payload": { "payload": {
"id": "geoname/4153479", "id": "locality/4992:locality:u:us:silver_lake",
"geo": "-82.70873,29.53274" "geo": "-81.804157,28.846269"
}, },
"output": "Doorshutter Lake, Levy County, United States" "output": "Silver Lake, United States"
},
"woe_id": null,
"center_point": {
"lon": "-81.804157",
"lat": "28.846269"
} }
}, },
{ {
"name": { "admin2": "Lake",
"default": "Wauberg Lake"
},
"admin0": "United States",
"admin1": "Florida", "admin1": "Florida",
"admin2": "Alachua County", "admin0": "United States",
"center_point": { "name": {
"lat": "29.52978", "default": "Oaks At Lake Dorr"
"lon": "-82.30215"
}, },
"gn_id": 0,
"suggest": { "suggest": {
"input": [ "input": [
"wauberg lake" "oaks at lake dorr"
], ],
"payload": { "payload": {
"id": "geoname/4177568", "id": "neighborhood/33992:_:_:_:oaks_at_lake_dorr",
"geo": "-82.30215,29.52978" "geo": "-81.639404,28.993127"
}, },
"output": "Wauberg Lake, Alachua County, United States" "output": "Oaks At Lake Dorr, Lake, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-81.639404",
"lat": "28.993127"
} }
}, },
{ {
"name": { "admin2": "Lake",
"default": "Lake Stafford"
},
"admin0": "United States",
"admin1": "Florida", "admin1": "Florida",
"admin2": "Levy County", "admin0": "United States",
"center_point": { "name": {
"lat": "29.30795", "default": "Lake South"
"lon": "-82.47914"
}, },
"gn_id": 0,
"suggest": { "suggest": {
"input": [ "input": [
"lake stafford" "lake south"
], ],
"payload": { "payload": {
"id": "geoname/4173950", "id": "neighborhood/34534:_:_:_:lake_south",
"geo": "-82.47914,29.30795" "geo": "-81.742766,28.797112"
}, },
"output": "Lake Stafford, Levy County, United States" "output": "Lake South, Lake, United States"
},
"woe_id": 0,
"center_point": {
"lon": "-81.742766",
"lat": "28.797112"
} }
} }
] ]

20
docs/suggest/success.md

@ -1,6 +1,6 @@
# valid suggest query # valid suggest query
*Generated: Thu Sep 18 2014 14:53:39 GMT+0100 (BST)* *Generated: Fri Sep 19 2014 14:38:01 GMT+0100 (BST)*
## Request ## Request
```javascript ```javascript
{ {
@ -26,14 +26,14 @@ Status: 200
"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": "1248",
"etag": "W/\"H7TGcVqWuu8sAb6aBhpd6A==\"", "etag": "W/\"l7SMjqn0lVxkVsxRTJizhA==\"",
"date": "Thu, 18 Sep 2014 13:53:39 GMT", "date": "Fri, 19 Sep 2014 13:38:01 GMT",
"connection": "close" "connection": "close"
} }
``` ```
```javascript ```javascript
{ {
"date": 1411048419796, "date": 1411133881441,
"body": [ "body": [
{ {
"text": "ACRELÂNDIA, Brazil", "text": "ACRELÂNDIA, Brazil",
@ -121,19 +121,19 @@ Status: 200
## Tests ## Tests
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
```
### ✓ 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 should.exist json.date
json.date.should.be.within now-1000, now+1000 json.date.should.be.within now-2000, now+2000
should.exist json.body should.exist json.body
json.body.should.be.instanceof Array json.body.should.be.instanceof Array
``` ```
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
```

Loading…
Cancel
Save