forked from addonscript/addonscript-spec
API improvements
This commit is contained in:
parent
f265e1c858
commit
83c8948f95
|
@ -4,27 +4,48 @@
|
||||||
|
|
||||||
`GET {base URL}`
|
`GET {base URL}`
|
||||||
|
|
||||||
The index endpoint can be used to get basic information about an API
|
The index endpoint can be used to get basic information about which
|
||||||
instance, including the API versions and features supported by that
|
API versions an API instance implements. The response object of this
|
||||||
instance and the [default namespace](../concepts/namespaces.md#default-namespaces) of the instance.
|
endpoint contains a `versions` property, which is an array containing
|
||||||
The response object of this endpoint contains a `versions` property, which is an object with API
|
all API versions available on this instance.
|
||||||
version numbers as keys and the configuration objects for the specific API version as values.
|
|
||||||
For API version `v2` (AddonScript major release 2) the configuration object contains a `features`
|
|
||||||
property, which is an array containing all [API features](#features) available on this API instance.
|
|
||||||
|
|
||||||
### Example response body:
|
### Example response body:
|
||||||
|
|
||||||
``` json
|
``` json
|
||||||
{
|
{
|
||||||
"versions": {
|
"versions": ["v2"]
|
||||||
"v2": {
|
|
||||||
"features": ["addons", "env", "com.example.customfeature"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Features
|
`GET {base URL}/{API version}`
|
||||||
|
|
||||||
|
Each API version also has an index endpoint with information specifically
|
||||||
|
about that version. The response of that index MAY differ across different
|
||||||
|
API versions. If an API version is not implemented on an instance, the
|
||||||
|
corresponding index endpoint MUST return a `400 Bad Request` or
|
||||||
|
`404 Not Found` status code.
|
||||||
|
|
||||||
|
## API Version v2:
|
||||||
|
|
||||||
|
This version of the AddonScript specification only specifies API version `v2`,
|
||||||
|
which is currently the only existing version.
|
||||||
|
|
||||||
|
`GET {base URL}/v2`
|
||||||
|
|
||||||
|
The `v2` version index endpoint can be used to retrieve the API features
|
||||||
|
supported by this API instance on version `v2`. The response object of
|
||||||
|
this endpint contains a `features` property, which is an array containing
|
||||||
|
all [API features](#features) supported on this instance.
|
||||||
|
|
||||||
|
### Example response body:
|
||||||
|
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"features": ["addons", "env", "com.example.customfeature"]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
API features can be either part of the specification itself or
|
API features can be either part of the specification itself or
|
||||||
are specified by third parties. Third-party API features SHOULD
|
are specified by third parties. Third-party API features SHOULD
|
||||||
|
|
Loading…
Reference in a new issue