Page History
Autocomplete API
Jira | ||||||
---|---|---|---|---|---|---|
|
The CMR autocomplete API will provide autocomplete suggestions via a RESTful call to an AWS Lambda.
A secondary implementation will use WebSockets. The WebSocket implementation is a stretch goal.
If the WebSocket implementation is completed, the data format for the responses will share the same response schema as the RESTful implementation.
Table of Contents style none
OpenAPI 3.0
View file name openapi.yaml height 250
Info | ||
---|---|---|
View with https://editor.swagger.io/ or using Docker with
|
/search/autocomplete
Query with a term
Fetch autocomplete suggestions from all available facets
Code Block |
---|
curl -XGET https://.../autocomplete?q=ex |
Example Response
Code Block |
---|
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
CMR-Hits: 4
CMR-Took: 382
{
"feed": {
"entry": [
{
"type": "platform",
"value": "EXOS-A",
"score": 3.17234
},
{
"type": "instrument",
"value": "EXRAD",
"score": 2.36234
},
{
"type": "platform",
"value": "EXPLORER-9",
"score": 0.15234
},
{
"type": "provider",
"value": "PURDUE/EXTENSION",
"score": 0.12323
}
]
}
} |
Query with type filter
Only return suggestions from the supplied type
Code Block |
---|
curl -XGET https://.../autocomplete?q=ice&type[]=instrument |
Code Block |
---|
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
CMR-Hits: 1
CMR-Took: 440
{
"feed": {
"entry": [
{
"type": "instrument",
"value": "ICE AUGER",
"score": 0.281
}
]
}
} |
Query with multiple types
Multiple types may be specified. The order of types provided may not reflect order returned in results array. Only valid facets will be used, unrecognized terms will not be included in results.
Code Block |
---|
curl -XGET https://.../autocomplete?q=sol&type[]=platform&type[]=instrument |
Code Block |
---|
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
CMR-Hits: 3
CMR-Took: 166
{
"feed": {
"entry": [
{
"type": "platform",
"value": "SOLAR-A",
"score": 0.28234
},
{
"type": "platform",
"value": "SOLSAT",
"score": 0.281
},
{
"type": "instrument",
"value": "SOLARIZER",
"score": 0.263
}
]
}
} |
Query with no results
Code Block |
---|
curl -XGET https://.../autocomplete?q=foo |
Code Block |
---|
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
CMR-Hits: 0
CMR-Took: 122
{
"feed": {
"entry": []
}
} |