The following MicetroAPI class lets you integrate Gateway workflows with
Micetro using the Micetro REST API. To doing so, Gateway provides
workflows with an already-authenticated client to the Micetro REST API through the
global user field g.user.micetro_api.v2
of type class
MicetroAPI
.
The following Python code assigns this client to a variable in workflow code:
# Get the API client.
client = g.user.micetro_api.v2
The following example code snippet uses the Micetro API client to make an HTTP GET
request to the Micetro REST API, using the http_get()
function provided
by the Gateway Micetro API client.
from flask import g
def api_get_user():
client = g.user.micetro_api.v2
data = client.http_get("/users")["result"]
return {"data": data}