Skip to content

[Autolab API] Onboarding and Initialisation

Addhyan Malhotra requested to merge iris_api_setup into iris-nitk-mods

API Description

  • POST /api/iris/users/create
    • params: :first_name, :last_name, :email, :branch, :year, :school("NITK")
  • POST /api/iris/users/create_batch
    • Params: user_datum: Array [{email first_name last_name school branch year}]
  • POST /api/iris/courses/create
    • Params: :course_name, :course_code, :instructor_email
  • POST /api/iris/courses/sync_course
    • Params :display_name, :start_date, :end_date, :instructor_emails, :students_emails, :ta_emails

How to test

create an api_client using autolab (under manage autolab) generate token using device_flow, make requests using that token

Example:

require "oauth2"
client = OAuth2::Client.new client_id, client_secret, site: site_path
client.auth_code.authorize_url(:redirect_uri => redirect_uri)
token = client.auth_code.get_token(code, :redirect_uri => redirect_uri)

follow link generated to authorise the client and get code from redirect_uri (i set redirect uri to the dev server istelf so i could simply copy the code from server logs 😅 )

Then finally you can

token.post("api/iris/courses/sync_course", params: {display_name: "EC COURSE NAME", instructor_emails: ["a@b.com"], students_emails: ["25@18thoct.test5", "24@18thoct.test5"], course_code: "EC111"})
Edited by Addhyan Malhotra

Merge request reports

Loading