libgs.restapi

date:Mon Sep 18 09:22:40 2017
author:Kjetil Wormnes

The REST-API interface to the libgs databases (and arbitrary XMRPC APIs)

Basic usage:

>>> api = RESTAPI()
>>> api.start()

See RESTAPI for detailed information on the permitted arguments.

the class, when calling start() will set up a number of API endpoints for access to the different libgs databases. It is also possible to connect arbitrary XMLRPC APIs that will also be exposed.

A detailed help with examples for how to use the api is automatically generated by the API itself and made available to the user. Just to to hostname:port/api to see it, where hostname and port can be configured when creating the RESTAPI.

XMLRPC API endpoints can also, as mentioned, be mapped to the RESTAPI. To do so you must pass some information when creating the api. For example:

>>> api = RESTAPI(rpcapi={'rpc/gs':'http://localhost:10001', 'rpc/sch':'http://localhost:8000'})

will create two additional api endpoints on /api/rpc/gs and /api/rpc/sch to which it will map the libgs.groundstation.GroundStation and libgs.rpc.RPCSchedulerServer XMLRPC API interfaces respectively.

Note that any XMLRPC interface can be mapped this way so long as it has registered introspection functions. See SimpleXMLRPCServer. register_introspection_functions(). (you can of course also use libgs.rpc.RPCServer as a drop-in replacement for SimpleXMLRPCServer anytime you make such an api)

Classes

RESTAPI([commslog, monlog, passdb, host, …]) THE REST API class.