Skip to content

Commit 4de673d

Browse files
committed
[DOC] Improved the example in README and small edits
1 parent 57be082 commit 4de673d

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

rest-api-spec/README.markdown

+25-23
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,32 @@ Their purpose is to formalize and standardize the API, to facilitate development
77
Example for the ["Create Index"](http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/) API:
88

99
```json
10-
{
11-
"indices.create": {
12-
"documentation": "http://elasticsearch.org/guide/reference/mapping/",
13-
14-
"methods": ["PUT", "POST"],
15-
16-
"url": {
17-
"path": "/{index}",
18-
19-
"paths": ["/{index}"],
20-
21-
"parts": {
22-
"index": {}
23-
},
24-
25-
"params": {
26-
"index": {},
27-
"timeout": {}
28-
}
29-
},
30-
"body": {
10+
{
11+
"indices.create": {
12+
"documentation": "http://www.elasticsearch.org/guide/reference/api/admin-indices-create-index/",
13+
"methods": ["PUT", "POST"],
14+
"url": {
15+
"path": "/{index}",
16+
"paths": ["/{index}"],
17+
"parts": {
18+
"index": {
19+
"type" : "string",
20+
"required" : true,
21+
"description" : "The name of the index"
22+
}
23+
},
24+
"params": {
25+
"timeout": {
26+
"type" : "time",
27+
"description" : "Explicit operation timeout"
3128
}
3229
}
30+
},
31+
"body": {
32+
"description" : "The configuration for the index (`settings` and `mappings`)"
3333
}
34+
}
35+
}
3436
```
3537

3638
The specification contains:
@@ -39,12 +41,12 @@ The specification contains:
3941
* Link to the documentation at <http://elasticsearch.org>
4042
* List of HTTP methods for the endpoint
4143
* URL specification: path, parts, parameters
42-
* Whether body is allowed for the endpoint or not
44+
* Whether body is allowed for the endpoint or not and its description
4345

4446
The `methods` and `url.paths` elements list all possible HTTP methods and URLs for the endpoint;
4547
it is the responsibility of the developer to use this information for a sensible API on the target platform.
4648

47-
The repository also contains a utility script in Ruby which will scan and parse the Elasticsearch source code
49+
The repository contains a utility script in Ruby which will scan and parse the Elasticsearch source code
4850
to extract the information from the Java source files. Run `bundle install` and then `thor help api:generate:spec`.
4951

5052
## License

0 commit comments

Comments
 (0)