Director REST API: how to associate data fields to host template?

I am creating a bunch of objects in Icinga Director using the REST API, including host templates, but I cannot find out how to add data fields to my host templates nor how to read them out.

I have tried to read them like this but as you can see I get a strange output (two different JSONs concatenated, with a 500 Internal Server Error (???)), and no trace of my data fields (that were defined on this template):

curl -ki -H 'Accept: application/json' -u 'USERNAME:PASSWORD' 'https://MY.ICINGAWEB2.HOST/icingaweb2/director/host/fields?name=MY_TEMPLATE_NAME'
HTTP/1.1 500 Internal Server Error
Date: Mon, 14 Jun 2021 15:33:40 GMT
Server: Apache
X-Powered-By: PHP/7.3.11
Connection: close
Content-Type: application/json

    "object_name": "MY_TEMPLATE_NAME",
    "object_type": "template"
{"status":"error","message":"Not found"}

I am using the latest stable releases of IcingaWeb2 (v2.8.2) and Director module (v1.8.0).

Any help would be appreciated, I am particularly interested in adding data fields to an existing host template or adding them at host template creation time. Thank you.