{% extends "base.html" %} {% block content %}
When using the harness as a JSON API, all requests must specify the Content-Type headers as 'application/json'. It is also possible to script the normal form endpoints, but the response will be HTML, so this is not recommended.
curl -X POST http://localhost:5000/single -H "Content-Type: application/json" -d '{ {% for f in req_fields -%} "{{ f }}": "{{ numbers[loop.index-1] }}"{% if loop.index < req_fields|length -%}, {% else %} {% endif -%} {% endfor -%} }'
{ {% for f in req_fields -%} "{{ f }}": {{ numbers[loop.index-1] }}, {% endfor -%} "flags": [] }
curl -X POST http://localhost:5000/single -H "Content-Type: application/json" -d '{ "items": [ { {% for f in req_fields -%} "{{ f }}": "{{ numbers[loop.index-1] }}"{% if loop.index < req_fields|length -%}, {% else %} {% endif -%} {% endfor -%} }, { {% for f in req_fields -%} "{{ f }}": "{{ numbers[loop.index-1+req_fields|length] }}"{% if loop.index < req_fields|length -%}, {% else %} {% endif -%} {% endfor -%} } ] }'
{ "items": [ { {% for f in req_fields -%} "{{ f }}": {{ numbers[loop.index-1] }}, {% endfor -%} "flags": [] }, { {% for f in req_fields -%} "{{ f }}": {{ numbers[loop.index-1+req_fields|length] }}, {% endfor -%} "flags": [] } ] }