Using the Frontend Plugin API to upload new versions of plugins
The Frontend Plugin API can be used to automate the process of uploading new versions of plugins, for example, from a build pipeline.
The API uses OAuth tokens for authentication. See Authentication for information on how to authenticate.
Uploading a plugin
Here is an example of how to upload plugin code. If a plugin with the same name and version already exists, it will be overwritten. This is the easiest way of updating a plugin, just by updating the code for the specific version configured. Note: Replace TOKEN with the actual authentication token.
curl -X 'POST' \
'https://api.futureordering.com/frontend/plugins?name=hello-world&version=1.0.0' \
-H 'accept: application/json' \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: text/plain' \
-d 'export default async context => {
console.log('\''Hello world'\'');
};'
Uploading a new version
If desirable to create a new version each time preserving the previous one, there are a few more steps:
- Upload new code (shown above)
- Upload new manifest
- Update plugin config
Here is an example of how to update the plugin manifest for a specific version. More about plugin manifest. Note: Replace TOKEN with the actual authentication token. See api specification for uploading plugin manifest
curl -X 'POST' \
'https://api.futureordering.com/frontend/plugins/manifest?name=hello-world' \
-H 'accept: application/json' \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"version": "1.0.1",
"description": "Prints hello world",
"parameters": []
}'
Here is an example of updating a specific plugin config. See api specification for updating plugin config with specific ID. Replace ID_OF_CONFIG with the actual ID of the config. Use the list api to get the ID of the config. See api specification for listing plugin configs
curl -X 'PUT' \
'https://api.futureordering.com/frontend/plugins/ID_OF_CONFIG/config' \
-H 'accept: application/json' \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "hello-world",
"version": "1.0.1",
"config": {},
... more config
}'
See also
For more details take a look at the API specifications for Frontend Plugins