{% ckan_extends %} {% block custom %} {{ super() }} {% if examples %} {% call register_example('curl', 'request_filter_custom') %}
curl {{ h.url_for('api.action', logic_function='datastore_search', qualified=True) }} \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "{{ resource_id }}",
"filters": {{ examples.text_column_filters_object | tojson(indent=2) | indent(2) }}
}'
{% endcall %}
{% call register_example('curl', 'request_sql_custom') %}
curl {{ h.url_for('api.action', logic_function='datastore_search_sql', qualified=True) }} \
-H"Authorization:$API_TOKEN" -d @- <<END
{
"sql": "SELECT * FROM \"{{ resource_id }}\" WHERE {{ examples.text_column_name_sql }} LIKE 'jones'"
}
END
{% endcall %}
{% call register_example('curl', 'request_insert') %}
curl {{ h.url_for('api.action', logic_function='datastore_upsert', qualified=True) }} \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "{{ resource_id }}",
"method": "insert",
"records: [
{{ examples.insert_record_object | tojson(indent=2) | indent(4) }}
]
}'
{% endcall %}
{% call register_example('curl', 'request_update') %}
curl {{ h.url_for('api.action', logic_function='datastore_upsert', qualified=True) }} \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "{{ resource_id }}",
"method": "update",
"records: [
{{ examples.update_record_object | tojson(indent=2) | indent(4) }}
]
}'
{% endcall %}
{% call register_example('curl', 'request_delete') %}
curl {{ h.url_for('api.action', logic_function='datastore_records_delete', qualified=True) }} \
-H"Authorization:$API_TOKEN" -d '
{
"resource_id": "{{ resource_id }}",
"filters": {{ examples.unique_filter_object | tojson(indent=2) | indent(2) }}
}'
{% endcall %}
{% endif %}
{% endblock %}