A request asked me, how to display data from the API clearmls.io sorted. One thing here is how to get access to the data. The other how to display that data.
Authentication at docs.clearmls.io What the API expects is described here. At the free plugin you can set the API_KEY at the plugin setup. The free plugin can’t sort the json-data, but together with the Plugin TableSorter a sortable Table is possible, see here.
Authorization: Bearer API_KEY
With the pro plugin it’s like this: Create a new pro plugin template with the following settings. The “curloptions” set the http-header. “sortbyjsonfield” sorts for the latitude-values. When saving the template you get a TEMPLATE_ID of this template:
template:
{% for i in properties | sortbyjsonfield("latitude,desc,num") %}
latitude: {{i.latitude}}, postal_code: {{i.postal_code}}<br>
{% endfor %}
url:
https://api.clearmls.io/properties
method:
curlget
curloptions:
CURLOPT_HTTPHEADER=Authorization:Bearer API_KEY
Use the new TEMPLATE_ID in the shortcode on a page or post:
The API of presseportal.de with Demo-Page: [jsoncontentimporter url="http://api.json-content-importer.com/extra/json/presseportalde.json"
basenode="content"]
{subloop-array:story:-1}<a href={url}>{title}</a><hr>{/subloop-array:story}
[/jsoncontentimporter]
gives you: