Library Microservice
The lib microservice is responsible for handling and serving the contents of library assets of the DTaaS platform. It provides API endpoints for clients to query, and fetch these assets.
This document provides instructions for using the library microservice.
Please see assets for a suggested storage conventions of your library assets.
Once the assets are stored in the library, they become available in user workspace.
Application Programming Interface (API)
The lib microservice application provides services at two end points:
GraphQL API Endpoint: http://foo.com/lib
HTTP Endpoint: http://foo.com/lib/files
HTTP protocol
Endpoint: localhost:PORT/lib/files
This option needs to be enabled with -H http.json
flag.
The regular file upload and download options become available.
Here are sample screenshots.
GraphQL protocol
Endpoint: localhost:PORT/lib
The http://foo.com/lib
URL opens a graphql playground.
You can check the query schema and try sample queries here. The graphql queries need to be sent as HTTP POST requests and get responses.
The library microservice services two API calls:
- Provide a list of contents for a directory
- Fetch a file from the available files
The API calls are accepted over GraphQL and HTTP API end points. The format of the accepted queries are:
Provide list of contents for a directory
To retrieve a list of files in a directory, use the following GraphQL query.
Replace path
with the desired directory path.
send requests to: https://foo.com/lib
Fetch a file from the available files
This query receives directory path and send the file contents to user in response.
To check this query, create a file files/user2/data/welcome.txt
with content of hello world
.
The path refers to the file path to look at: For example, user1 looks at files of user1; user1/functions looks at contents of functions/ directory.