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.

224 lines
4.4 KiB

10 years ago
# valid suggest query
10 years ago
*Generated: Thu Sep 25 2014 19:25:20 GMT+0100 (BST)*
10 years ago
## Request
```javascript
{
"protocol": "http:",
"host": "localhost",
"method": "GET",
"port": 3100,
10 years ago
"path": "/suggest?input=a&lat=0&lon=0"
10 years ago
}
```
## Response
```javascript
Status: 200
{
10 years ago
"x-powered-by": "mapzen",
10 years ago
"charset": "utf8",
10 years ago
"cache-control": "public,max-age=60",
"server": "Pelias/0.0.0",
10 years ago
"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": "1933",
"etag": "W/\"I89q+0HZNmXyHsTfLSP5Ww==\"",
"date": "Thu, 25 Sep 2014 18:25:20 GMT",
10 years ago
"connection": "close"
}
```
```javascript
{
10 years ago
"type": "FeatureCollection",
"features": [
10 years ago
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
7.56019,
5.419786
]
},
"properties": {
"text": "Abia, Nigeria",
"score": 1,
"type": "admin1",
"id": "1775:adm1:ng:nga:abia"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-66.908143,
-9.954353
]
},
"properties": {
"text": "Acrelândia, Brazil",
"score": 1,
"type": "admin2",
"id": "708:adm2:br:bra:acrel_ndia"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-60.005461,
-3.099378
]
},
"properties": {
"text": "Adrianópolis, Manaus, Brasil",
"score": 1,
"type": "neighborhood",
"id": "799:_:_:_:adrian_polis"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
7.909644,
5.013733
]
},
"properties": {
"text": "Akwa Ibom, Nigeria",
"score": 1,
"type": "admin1",
"id": "1776:adm1:ng:nga:akwa_ibom"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
9.691808,
4.050576
]
},
"properties": {
"text": "Akwa, Littoral, Cameroun",
"score": 1,
"type": "neighborhood",
"id": "1863:_:_:_:akwa"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-56.404593,
-10.042071
]
},
"properties": {
"text": "Alta Floresta, Brazil",
"score": 1,
"type": "admin2",
"id": "2986:adm2:br:bra:alta_floresta"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-62.627879,
3.10354
]
},
"properties": {
"text": "Alto Alegre, Brazil",
"score": 1,
"type": "admin2",
"id": "4611:adm2:br:bra:alto_alegre"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-63.418743,
-9.697774
]
},
"properties": {
"text": "Alto Paraíso, Brazil",
"score": 1,
"type": "admin2",
"id": "4584:adm2:br:bra:alto_para_so"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-65.296384,
-3.674615
]
},
"properties": {
"text": "Alvarães, Brazil",
"score": 1,
"type": "admin2",
"id": "832:adm2:br:bra:alvar_es"
10 years ago
}
},
{
10 years ago
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-62.710104,
3.724864
]
},
"properties": {
"text": "Amajari, Brazil",
"score": 1,
"type": "admin2",
"id": "4610:adm2:br:bra:amajari"
10 years ago
}
}
10 years ago
],
"date": 1411669520909
10 years ago
}
```
## Tests
10 years ago
### ✓ 200 ok
```javascript
response.statusCode.should.equal 200
```
### ✓ valid geojson
```javascript
json.type.should.equal 'FeatureCollection'
json.features.should.be.instanceof Array
```
10 years ago
### ✓ valid response
```javascript
now = new Date().getTime()
should.exist json
should.not.exist json.error
10 years ago
json.date.should.be.within now-5000, now+5000
10 years ago
```