...
Code Block |
---|
curl -X POST "https://ecoplots-test.tern.org.au/api/v1.0/observations?dformat=ndjson" -H "accept: */*" -H "Authorization: apikey-v1 ZjF6eUpHaE1uRDFwNmRIUi5UcHVkQVUMVHFoYn5QcU1MeF4KVydnISwtclR3dHpZaSg7dHVFeSgocVcNLEZHQ0ozeSMiUGk/TzRHUClCU0he" -H "Content-Type: application/json" -d "{\"page_num\":1,\"page_size\":50,\"query\":{\"dataset\":[\"http://linked.data.gov.au/dataset/ausplots\"],\"feature_type\":[\"http://linked.data.gov.au/def/tern-cv/b311c0d3-4a1a-4932-a39c-f5cdc1afa611\"],\"observed_property\":[\"http://linked.data.gov.au/def/tern-cv/0bbd7fcd-0782-4efc-96e6-1f0f7669c655\"]}}" |
Using Ecoplots portal to auto-generate queries
Maybe we should be leading with this and have it in it’s own section.
The easiest method to create valid queries to be used in the API requests is building the query visually and dynamically through the EcoPlots Portal.
You can play around with the faceted search that the portal provides and inspect the results in the data table. Once your search has been refined, you can access the query (shown below) and use it in the API request.
...
Define the filter via the facets menu.
Inspect the returned data. Polish your query changing the filter values dynamically and clicking in the “Show results” button.
Click on the API button.
Copy the query dictionary using the copy button and use it directly in any API request.
Info |
---|
The API code generator tool also generate the complete code needed to make the request in multiple programming languages. You can copy the generated code snipped and use it in your scripts. |