mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
1.6 KiB
81 lines
1.6 KiB
10 years ago
|
# valid doc query
|
||
10 years ago
|
|
||
10 years ago
|
*Generated: Thu Oct 23 2014 11:58:14 GMT-0400 (EDT)*
|
||
10 years ago
|
## Request
|
||
|
```javascript
|
||
|
{
|
||
|
"protocol": "http:",
|
||
|
"host": "localhost",
|
||
|
"method": "GET",
|
||
|
"port": 3100,
|
||
10 years ago
|
"path": "/doc?id=geoname:4221195"
|
||
10 years ago
|
}
|
||
|
```
|
||
|
|
||
|
## Response
|
||
|
```javascript
|
||
|
Status: 200
|
||
|
{
|
||
|
"x-powered-by": "mapzen",
|
||
|
"charset": "utf8",
|
||
|
"cache-control": "public,max-age=60",
|
||
|
"server": "Pelias/0.0.0",
|
||
|
"access-control-allow-origin": "*",
|
||
|
"access-control-allow-methods": "GET",
|
||
|
"access-control-allow-headers": "X-Requested-With,content-type",
|
||
|
"access-control-allow-credentials": "true",
|
||
|
"content-type": "application/json; charset=utf-8",
|
||
10 years ago
|
"content-length": "311",
|
||
|
"etag": "W/\"137-ab9138f7\"",
|
||
|
"date": "Thu, 23 Oct 2014 15:58:14 GMT",
|
||
10 years ago
|
"connection": "close"
|
||
|
}
|
||
|
```
|
||
|
```javascript
|
||
|
{
|
||
|
"type": "FeatureCollection",
|
||
|
"features": [
|
||
|
{
|
||
|
"type": "Feature",
|
||
|
"geometry": {
|
||
|
"type": "Point",
|
||
|
"coordinates": [
|
||
|
-82.9207,
|
||
|
34.36094
|
||
|
]
|
||
|
},
|
||
|
"properties": {
|
||
|
"name": "Sanders Grove Cemetery",
|
||
|
"admin0": "United States",
|
||
|
"admin1": "Georgia",
|
||
|
"admin2": "Hart County",
|
||
10 years ago
|
"text": "Sanders Grove Cemetery, Hart County, Georgia"
|
||
10 years ago
|
}
|
||
|
}
|
||
|
],
|
||
10 years ago
|
"date": 1414079894512
|
||
10 years ago
|
}
|
||
|
```
|
||
|
|
||
|
## Tests
|
||
|
|
||
10 years ago
|
### ✓ valid response
|
||
10 years ago
|
```javascript
|
||
10 years ago
|
now = new Date().getTime()
|
||
|
should.exist json
|
||
|
should.not.exist json.error
|
||
|
json.date.should.be.within now-5000, now+5000
|
||
10 years ago
|
```
|
||
|
|
||
|
### ✓ 200 ok
|
||
|
```javascript
|
||
|
response.statusCode.should.equal 200
|
||
|
```
|
||
|
|
||
10 years ago
|
### ✓ valid geojson
|
||
10 years ago
|
```javascript
|
||
10 years ago
|
json.type.should.equal 'FeatureCollection'
|
||
|
json.features.should.be.instanceof Array
|
||
10 years ago
|
```
|
||
|
|