Skip to content

[HOW TO] Register a plugin via the REST API

Jorge edited this page Apr 18, 2024 · 5 revisions

Register a plugin via the REST API

Consists of the following steps:

  1. Get the plugin representation JSON file by running a container from the plugin's docker image
  2. Edit the JSON file by adding the name and dock_image keys and their values to the JSON file's dictionary
  3. An admin user (like chris) uploads the JSON file to CUBE through a POST request to the admin API /chris-admin/api/v1/

For instance, using the httpie client and assuming that the ChRIS service is running at localhost:8000:

Register pl-dircopy

  1. Get the plugin representation:
mkdir ~/plugin_json_files 
docker run --rm fnndsc/pl-dircopy dircopy --json > ~/plugin_json_files/pl-dircopy.json
  1. Add "name": "pl-dircopy", "dock_image": "fnndsc/pl-dircopy" key-value pairs to the JSON file's dictionary and save the file

  2. Upload the JSON file to CUBE:

http -a chris:chris1234 -f POST http://localhost:8000/chris-admin/api/v1/  \
fname@~/plugin_json_files/pl-dircopy.json compute_names='host'             \
Accept:application/vnd.collection+json

Register pl-topologicalcopy

  1. Get the plugin representation:
docker run --rm fnndsc/pl-topologicalcopy topologicalcopy --json > ~/plugin_json_files/pl-topologicalcopy.json
  1. Add "name": "pl-topologicalcopy", "dock_image": "fnndsc/pl-topologicalcopy" key-value pairs to the JSON file's dictionary and save the file

  2. Upload the JSON file to CUBE:

http -a chris:chris1234 -f POST http://localhost:8000/chris-admin/api/v1/  \
fname@~/plugin_json_files/pl-topologicalcopy.json  compute_names='host'    \
Accept:application/vnd.collection+json

Register pl-simpledsapp

  1. Get the plugin representation:
docker run --rm fnndsc/pl-simpledsapp simpledsapp --json > ~/plugin_json_files/pl-simpledsapp.json
  1. Add "name": "pl-simpledsapp", "dock_image": "fnndsc/pl-simpledsapp" key-value pairs to the JSON file's dictionary and save the file

  2. Upload the JSON file to CUBE:

http -a chris:chris1234 -f POST http://localhost:8000/chris-admin/api/v1/  \
fname@~/plugin_json_files/pl-simpledsapp.json  compute_names='host'        \
Accept:application/vnd.collection+json
Clone this wiki locally