There are several functions for handling organism objects. To display the list of endpoints call the Swagger UI (e.g., http://localhost:5050/swagger) and select the item Organism.

The interface will show the list of functions nested under the Organism node. As you can see here, organisms can be listed, added, and deleted. 

Listing organisms

To list all organisms in the database by using the UI, select the first item /api/organism/all:

Please note that each function has a description shown in the top right corner. The middle part of the panel shows the example value format.

The function execution is done by pressing the button "Try it out!":

To call this function from the linux prompt, run the following:

$ curl http://localhost:5050/api/organism/all
[{"Id":1753,"Name":"Allium cepa","CommonName":"onion","TaxonomyNumber":4879},{"Id":1,"Name":"mura1","CommonName":"mura","TaxonomyNumber":1},...

Tip

The provided output is a machine-readable JSON text. If you plan to read it, pass the output through the jq utility. It will help format the JSON output.

This endpoint emulates the PersephoneShell's command list organism with the long listing mode.

Another flavor of the listing uses an individual organism name or identifier:

Provide the exact name of the organism in the "name" field and push "Try it out!".

To display organism by Id, use another endpoint: /api/organism/id/{id}, for example, /api/organism/id/1753.

Adding an organism

This time, we are trying to add a new organism and this step requires filling out all the relevant organism information in the JSON format. On the right you will see an example input. 

Clicking this panel will populate the config field:

Let's add a new organism Citrus sinensis. Not all values are required. We can provide just three values, others can be omitted for now. The server will auto-generate the field OrganismId trying to match TaxonomyId if possible.

Now, when we push the button "Try it out!", Swagger will show the responses. The Response Code 200 corresponds to Success. The organism entry will be added to the database.

The Response Body is a task identifier. It can now be used in another part of the API available under Task menu. Select the endpoint for checking the status of a task by its ID 13435043514734: