Skip to content

Latest commit

 

History

History
80 lines (65 loc) · 3.07 KB

Readme.md

File metadata and controls

80 lines (65 loc) · 3.07 KB

Knolx Service

Knolx service requires the following:

1. Mongod 2. MongoCompass 3. Sample Data set 4. Put the file Credential.json in `/home/knoldus/` [Found in the same folder from step 3] 5. export GOOGLEAPICREDENTIALPATH="/home/knoldus/credential.json"

You can find the two mentioned files above in this link: here

Setting up local database

After completing the steps mentioned above, you will need to set up a local database!

  1. Run sudo mongod in terminal to start the mongodb locally.
  2. Open MongoCompass > New connection > Connect to the default URI (You can also favourite this connection to reconnect to it easily!)
  3. Go to Databases > Create a new Database called Knolx
  4. Now you can create collections for your new database. (One collection for each file mentioned in the Sample_Data_Set)
  5. You should have a valid mongod server running in your local that has a database called knolx and contains some collections.

Running knolx service locally

  1. Checkout to develop from terminal.
  2. Run sbt run from the root directory.
  3. Knolx service should be running on http://localhost:8000

Hitting endpoints

To hit most endpoint, you will need a valid bearer token.
To get a token, run this command in terminal
  1. Run the following command in terminal. curl -d "client_id=leaderboard-ui" -d "client_secret=8090ed15-4cd1-483c-9fee-2a8b35941852" -d "username=testemployee" -d "password=testemployee" -d "grant_type=password" "https://auth.knoldus.com/auth/realms/knoldus/protocol/openid-connect/token"
  2. You will recieve a response in json format, copy the following value access_token
  3. When hitting endpoints using Postman
    1. Go to Authorization > Type: Bearer Token > Paste obtained token.
  4. Now you endpoint calls are valid!

To hit any endpoint in knox, you will have to prefix endpoints with v02 [At the time of writing this version of Readme].
i.e http://localhost:8000/v02/sessions?pageNumber=1&pageSize=10&filter=past for example.

Here is an example of a response to /sessions

{ "knolx": [ { "id": "62bc6c453407e61970360b3a", "presenterDetail": { "fullName": "test admin", "email": "[email protected]" }, "coPresenterDetails": { "fullName": "Someone", "email": "Something" }, "dateTime": 1656516219857, "sessionDurationInMins": 45, "topic": "Rust Fundamentals", "category": "Rust", "subCategory": "Scala Fundamentals", "feedbackExpriationDate": 1656700199000, "sessionType": "Knolx", "sessionState": "PendingForAdmin", "sessionDescription": "bdhfgakjfjfdajf", "contentAvailable": false, "content": { "contentStatus": "NotAvailable" } } ], "count": 1, "pages": 1 }

In this case we have a single previous knolx session under the email [email protected]