addonscript-spec/docs/api/README.md

69 lines
2.4 KiB
Markdown
Raw Normal View History

2022-02-25 22:54:10 +01:00
# The AddonScript API
## The Index Endpoint
2022-08-31 21:11:12 +02:00
`GET {base URL}`
2022-02-25 22:54:10 +01:00
2022-12-27 23:01:50 +01:00
The index endpoint can be used to get basic information about which
API versions an API instance implements. The response object of this
endpoint contains a `versions` property, which is an array containing
all API versions available on this instance.
2022-02-25 22:54:10 +01:00
2022-08-31 21:11:12 +02:00
### Example response body:
2022-02-25 22:54:10 +01:00
``` json
{
2022-12-27 23:01:50 +01:00
"versions": ["v2"]
2022-02-25 22:54:10 +01:00
}
```
2022-12-27 23:01:50 +01:00
`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
2022-12-27 23:26:23 +01:00
all [API features](#features) supported on this instance. It also contains
a `manifest_version` property, which is the latest
[manifest version](../schema/addonscript.md#version) available on this API
instance. This version MUST be part of AddonScript major version 2.
The manifest version of all manifests (and other objects using the manifest
version), returned by enpoints of this API version on this instance, MUST be
equal or less than this property, but MUST also be part of AddonScript major
version 2 (manifest version must be greater or equal to 2). If a client does
not support the manifest version returned by this endpoint, it SHOULD try to
request addons from other API instances, as this instance MAY return manifests
which are unsupported by the client.
2022-12-27 23:01:50 +01:00
### Example response body:
``` json
{
2022-12-27 23:26:23 +01:00
"features": ["addons", "env", "com.example.customfeature"],
"manifest_version": 2
2022-12-27 23:01:50 +01:00
}
```
### Features
2022-02-25 22:54:10 +01:00
API features can be either part of the specification itself or
are specified by third parties. Third-party API features SHOULD
2022-02-25 22:54:10 +01:00
be in a namespace-like format (reversed domain name).
These API features are part of the AddonScript specification itself:
2022-08-31 14:40:32 +02:00
- `addons`: [Addon repository](./features/addons.md)
2022-09-10 16:56:51 +02:00
- `files`: [File repository](./features/files.md)
2023-04-10 16:10:08 +02:00
- `builder`: [Environment builder](./features/builder.md)