witsWITS
Docs

Get Quizzes


Get quizzes list

import { createClientAPI } from "wits-client"

export const clientAPI = createClientAPI({
  appId: "",
  jwtToken: "",
})

clientAPI.GET("/v2/quiz/competitions/")

Get a quiz

clientAPI.GET("/v2/quiz/competitions/{id}/", {
  params: {
    path: {
      id: 1,
    },
  },
})

Validate referral code

Before enrolling, if the quiz is vip you can check if the referral code matches the quiz referral code

clientAPI.POST("/v2/quiz/competitions/{id}/check-referral-code/", {
  body: {
    referralCode: "",
  },
  params: {
    path: {
      id: -1,
    },
  },
})

Enroll in a quiz

to register as a participant of a quiz, the user must enroll first before the quiz starts.

clientAPI.POST("/v2/quiz/competitions/enroll/", {
  body: {
    competition: -1,
    competitionData: null,
    referralCode: null, // pass if present
    userHints: [], // hints pk
  },
})

Get List of the users enrollments

clientAPI.GET("/quiz/competitions/enroll/")

Cancel an enrollment

clientAPI.DELETE("/quiz/competitions/enroll/{id}/", {
  params: {
    path: {
      id: -1,
    },
  },
})