# Use of YAML in REST API

**URL:** <https://discuss.elastic.co/t/use-of-yaml-in-rest-api/45520>\
**Category:** Elasticsearch\
**Created:** [March 26, 2016, 8:20pm UTC](https://discuss.elastic.co/t/use-of-yaml-in-rest-api/45520 "2016-03-26T20:20:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 26, 2016, 8:20pm UTC](https://discuss.elastic.co/t/use-of-yaml-in-rest-api/45520/1 "2016-03-26T20:20:37Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-create-index.html)), but AFAICT YAML isn't accepted when defining index templates:

```nohighlight
$ 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?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:04pm UTC](https://discuss.elastic.co/t/use-of-yaml-in-rest-api/45520/2 "2017-07-05T23:04:54Z")

</div>


