How to query the API ?

With cURL

The REST API is queryable in command line by using cURL

With Python

One of the ways to query a REST-API with Python is to use the requests library.

After installing the requests library, you can query the REST-API with the following statements by … :

import requests

# Variables
variable = "string"

# Request
result = requests.get(f"https://metabocloud.mesocentre.uca.fr/...")

# Metadata
headers = result.headers
metadata = dict(filter(lambda x: x[0].startswith("X-Metadata"), headers.items()))

# Output
output = result.textdd

print("Metadata : ", metadata)
print("Resource :\n", output)
Output return

Note

If you ran the application locally on your machine from a virtual environment or via Docker, you need to change the URL you send the request to. This means that https://metabocloud.mesocentre.uca.fr/<microservice>/<endpoint> will become http://localhost:<default port>/<endpoint> if you launched the application with the default parameters.

If you choose another port to run the application then you need to change the URL accordingly.

With a client generated by Swagger

From the OpenAPI specification file describing this REST API, you can auto-generated a client in the language you want thanks to Swagger using the option Generate Client in the menu.

The OpenAPI specification file is downloadable here : https://metabocloud.mesocentre.uca.fr/<tool>/metabocloud-<tool>.yaml