Accessing the API from Go
For Go, we offer the mittwald API client library github.com/mittwald/api-client-go
. This library is an auto-generated client for the mStudio v2 (and any subsequent) API and can be installed via go get
.
Quickstart
Install this package using go get
:
$ go get github.com/mittwald/api-client-go
Then, import the version-specific client in your project:
import "github.com/mittwald/api-client-go/mittwaldv2"
To use the client, invoke the mittwaldv2.New
constructor, and configure it using the proved option methods:
- Omit authentication option for unauthenticated access
mittwaldv2.WithAccessToken
(recommended) to authenticate with an API tokenmittwaldv2.WithAccessTokenFromEnv
(recommended) to authenticate with an API token that is automatically retrieved from the process environment variables (MITTWALD_API_TOKEN
).mittwaldv2.WithUsernamePassword
to authenticate with username and password; this does not work for users that have 2FA enabledmittwaldv2.WithAccessTokenRetrievalKey
to authenticate with an access token retrieval key (only relevant for mStudio extensions)mittwaldv2.WithExtensionSecret
to authenticate as an extension (only relevant for mStudio extensions)
Have a look at our API introduction for more information on how to obtain an API token and how to get started with the API.
Further reading
For a complete documentation, have a look at the libraries README
file or the automatically generated package documentation.