Use of YAML in REST API

The index creation API supports use of YAML instead of JSON (documented at https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html), but AFAICT YAML isn't accepted when defining index templates:

$ curl -XPUT localhost:9200/_template/test -d '
> template: foo
> '
{"error":"ElasticsearchParseException[Failed to derive xcontent]","status":400}

Is this correct? If yes, is there any reason for this difference between these APIs?