Docspring - add a filed inside an Object inside an Array
docspring
Docspring UI and add_field API will allow you to add base level fields.
But if you need to add Array of Objects to loop through nowhere in their docs they mention how to do this. Even their field schema doc is ignoring this use-case
So if you need
{% for client in clients %} <h2>{{ client.name }}</h2> {% if client.role == 'Shareholder' or client.role == 'Director' %} <h3 class="item">Company share percentage</h3> <p class="detail">{{ client.company_share_percentage }}</p> {% endif %} {% endfor %}
you need schema:
clients: [ {name:"...", role:"..."]
only way how to do this by sending API call to add_fields API
curl 'https://api.docspring.com/api/v1/templates/tpl_xxxxxxxxxxx/add_fields' \ --request PUT \ --header 'Content-Type: application/json' \ --header "Authorization: Basic xxxxx==" \ --data '{ "fields": [ { "name": "clients/0/role", "type": "string", "title": "Client role" } ] }'