ver. 1958 (4e4db56) services/apiref services/apisrv services/attrs services/caches services/caches/formatters services/caches/map services/caches/search services/caches/shortcuts services/logs services/logs/images services/oauth services/replicate services/users |
Search for caches and retrieve formatted results
|
|
||||
https://opencache.uk/okapi/services/caches/shortcuts/search_and_retrieve | ||||
We think that searching and retrieving data are two different things and that's why they were cleanly separated in the documentation (put in separate methods). This was done primarily to keep the docs clean. This method allows you to do a quick search+retrieve task in one request. All services/caches/search/* methods respond with a list of cache codes. Then you have to use other method (like services/caches/geocaches) to retrieve the names and locations, based on those cache codes. The search_and_retrieve method allows you to do these two steps in one method call. Permissions derived from your Access Token will be delegated to both of these methods. First, you have to choose both methods and their parameters - one method which returns the cache codes, and the other one, which responds with additional data for those cache codes. |
||||
search_method | required |
Name of the search method (begin with "services/"). E.g. services/caches/search/nearest. |
||
search_params | required |
JSON-formatted dictionary of parameters to be passed on to the search method. E.g. {"center": "49|19", "status": "Available"}. |
||
retr_method | required |
Name of the retrieval method (begin with "services/"). E.g. services/caches/geocaches. |
||
retr_params | required |
JSON-formatted dictionary of parameters to be passed on to the retrieval method. E.g. {"fields": "name|location|type"} The method will be called with one additional parameter - cache_codes. These will be the cache codes collected from the results of the search method. |
||
wrap | required |
Boolean.
|
||
format | optional | Standard common formatting argument. | ||
callback | optional | Standard common formatting argument. | ||
Plus required consumer_key argument, assigned for your application. | ||||
Returned value: If wrap is true, then the method will return a dictionary of the following structure:
If wrap is false, then the method will return anything the retrieval methods responds with (along with its HTTP headers). Example: search_and_retrieve Possible output: The same example with wrap=true would return: |