Using REST API in Managed Service for TimescaleDB

Managed Service for TimescaleDB has an API for integration and automation tasks. For information about using the endpoints, see the API Documentation. MST offers an HTTP API with token authentication and JSON-formatted data. You can use the API for all the tasks that can be performed using the web console. To get started you need to first create an authentication token, and then use the token in the header to use the API endpoints.

Creating an authentication token in Managed Service for TimescaleDB

  1. Log in to your Managed Service for TimescaleDB portal.
  2. Click User Information in the top right corner.
  3. In the User Profile page, navigate to the Authenticationtab.
  4. Click Generate Token.
  5. In the Generate access token dialog, type a descriptive name for the token and leave the rest of the fields blank.
  6. Copy the generated authentication token and save it.

Using cURL to get your details

  1. Set the environment variable MST_API_TOKEN with the access token that you generate:

    1. export MST_API_TOKEN="access token"
  2. To get the details about the current user session using the /me endpoint:

    1. curl -s -H "Authorization: aivenv1 $MST_API_TOKEN" https://api.aiven.io/v1/me|json_pp

    The output looks similar to this:

    1. {
    2. "user": {
    3. "auth": [],
    4. "create_time": "string",
    5. "features": { },
    6. "intercom": {},
    7. "invitations": [],
    8. "project_membership": {},
    9. "project_memberships": {},
    10. "projects": [],
    11. "real_name": "string",
    12. "state": "string",
    13. "token_validity_begin": "string",
    14. "user": "string",
    15. "user_id": "string"
    16. }
    17. }