Short intro to M3G API
M3G offers some of its functionalities through an application programming interface (API). In particular, a RESTful HTTP API that allows you to interact with M3G purely as data that can be uploaded, accessed, searched for, etc. via HTTP requests.
HTTP basically allows you to
DELETE etc. resources on a remote server. These resources are identified via URLs (=uniform resource locator). URLs usually consists of a protocol (e.g. HTTP), a domain (our servers), a path (a place on our servers), and query parameters (additional options).
M3G API: available operations
At present, M3G API provides 5 main "groups" of operations:
- Metadata, Product and Update (i.e. to get info, export or update some sections of station site logs in M3G, respectively)
Within most of these resource "groups", you find endpoints that either allow you to retrieve info on a given M3G entry (i.e. a network, a station) or to ask a query to locate many M3G entries at the same time (see the M3G Swagger user interface).
M3G API: tools
One can start to test M3G API thanks to different tools and libraries. For example, one could use:
- an HTTP program like curl to directly use M3G API from within a shell
- a generic Python HTTP library such as requests
- the browser, via the M3G Swagger UI, based on an OpenAPI spec, describing some of M3G function calls
In the following sections, you'll find some examples for common M3G tasks using various tools/options.