How to use the “Monolith API”?

Modified on Mon, 17 Jul 2023 at 01:24 PM

We currently support a web API (application programming interface) to allow customers to interact with the software outside of the platform UI. The API allows users to programmatically do things like load notebook steps, edit steps or upload files from automated processes and scripts which don’t require clicks through the browser.

The monolith platform has several endpoints exposed for API interaction, known as “service” endpoints. Communication to these endpoints must be authenticated with “service user” credentials. The endpoints can be called using REST requests to automate certain workflows within the platform. They accept and return JSON encoded requests and responses.

Further endpoints can be flexibly exposed in future if required. A simple Python library of functional wrappers each calling these specific endpoints is available if required. 

Full documentation for the API is available on request from the Monolith Team.

Example of how APIs could be used to call ML models and return predictions and optimal designs

Authentication

The API uses JSON Web Tokens (JWT) to authenticate requests, which must be made using a special “service worker” account. The service worker username and password are used to generate a JWT which can then be used to authenticate any further requests. All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. The JWT must be set as an ‘Authorization’ header on each request.

Authentication Tokens

  • How to register a “service worker”?
    You will need to request this from a member of the Monolith team. They can register the user and then provide you with the username and password for obtaining the JWT.
  • How to obtain the authorization token?
    You can obtain the token for your service user in the response from a specific authentication endpoint.
  • How to refresh a token if security is compromised?
    Your token can be refreshed by passing an argument into the authorization token endpoint. More detailed guidance can be obtained from the API Guide document. 
  • How long do tokens take to expire?
    30 days from issuing.

What Functionality is available now?

FileManager manipulation

  • File upload
  • Move file between folders
  • Delete files/folders
  • List all files and sub-folders in a folder

Notebook interaction

  • Load all data, steps and outputs for a notebook
  • Load specific steps of a notebook
  • Edit or re-run an existing step within a notebook
  • Load a tabular input/output dataset used within a notebook as JSON
  • Load a tabular input/output dataset as a .csv file

Dashboard Interaction

  • Edit or re-run an existing step within a dashboard if interactive

We are working on opening up more platform functionality to API interaction in the future.

For access to the full documentation for these features, please ask a member of the team.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article