Please reach out to [email protected] for the API key and URL.
POST /
https:/xyz.......xyz/getQuestions
(provided by Questgen)
x-api-key
text
(string, required): The source text from which the quiz questions will be generated. Maximum limit of text: 6000 words.type
(string, optional): Type of questions to generate. The default is "MCQ". Other options include "TrueFalse", "Higher Order QA", "FAQ", "Fill in the blanks", "MCQ (Multiple Correct Answers)", "MCQ (Fill in the blanks)"count
(int or string optional): Number of questions to generate. The default is Auto which generates approximately 1 question for every 60 words with a maximum of 20 questions. The maximum value for the count is 20. So you can generate up to a maximum of 20 quiz questions from text.difficultylevel
(string, optional): The difficulty level of the questions. The default is "Medium". Options include "Easy", "Medium", "Hard".mcqOptionsCount
(int, optional): Number of options for MCQs. The default is 4. The possible values are 3,4,5,6.output_language
(string, optional): The language that the quizzes should be generated in, irrespective of the input text language. The default is Auto. The possible values are any valid internet languages like Spanish, German, French, Hindi, etc. Works well only for popular internet languages.The response is a JSON object containing a list of ques_ans_pairs
, with each pair representing a quiz question and its corresponding answer(s).
Response Fields
question
(string): The quiz question that was generated from the text.choices
(array of strings): A list of possible answers.answers
(array of strings): The correct answer(s) to the question.import requestsimport jsonurl = "https://xyz......xyz/getQuestions"payload = json.dumps({ "text": "Elon Musk has shown again he can influence the digital currency market with just his tweets. After saying that his electric vehicle-making company Tesla will not accept payments in Bitcoin because of environmental concerns, he tweeted that he was working with developers of Dogecoin to improve system transaction efficiency. Following the two distinct statements from him, the world's largest cryptocurrency hit a two-month low, while Dogecoin rallied by about 20 percent. The SpaceX CEO has in recent months often tweeted in support of Dogecoin, but rarely for Bitcoin. In a recent tweet, Musk put out a statement from Tesla that it was concerned about the rapidly increasing use of fossil fuels for Bitcoin (price in India) mining and transaction, and hence was suspending vehicle purchases using the cryptocurrency. A day later he again tweeted saying, To be clear, I strongly believe in crypto, but it can't drive a massive increase in fossil fuel use, especially coal. It triggered a downward spiral for Bitcoin value but the cryptocurrency has stabilised since. A number of Twitter users welcomed Musk's statement. One of them said it's time people started realising that Dogecoin is here to stay and another referred to Musk's previous assertion that crypto could become the world's future currency.", "type": "MCQ", "count": 5, "difficultylevel": "Hard", "mcqOptionsCount": 4,
"output_language": "Auto"})headers = { 'x-api-key': 'xyz71......abc', 'Content-Type': 'application/json'}response = requests.request("POST", url, headers=headers, data=payload)output = response.json()print (output)
const fetchData = async () => { const url = "https://xyz......xyz/getQuestions"; const payload = { text: "Elon Musk has shown again he can influence the digital currency market with just his tweets. After saying that his electric vehicle-making company Tesla will not accept payments in Bitcoin because of environmental concerns, he tweeted that he was working with developers of Dogecoin to improve system transaction efficiency. Following the two distinct statements from him, the world's largest cryptocurrency hit a two-month low, while Dogecoin rallied by about 20 percent. The SpaceX CEO has in recent months often tweeted in support of Dogecoin, but rarely for Bitcoin. In a recent tweet, Musk put out a statement from Tesla that it was concerned about the rapidly increasing use of fossil fuels for Bitcoin (price in India) mining and transaction, and hence was suspending vehicle purchases using the cryptocurrency. A day later he again tweeted saying, To be clear, I strongly believe in crypto, but it can't drive a massive increase in fossil fuel use, especially coal. It triggered a downward spiral for Bitcoin value but the cryptocurrency has stabilised since. A number of Twitter users welcomed Musk's statement. One of them said it's time people started realising that Dogecoin is here to stay and another referred to Musk's previous assertion that crypto could become the world's future currency.", type: "MCQ", count: 5, difficultylevel: "Hard", mcqOptionsCount: 4, "output_language": "Auto"
}; const headers = { 'x-api-key': 'xyz71......abc', 'Content-Type': 'application/json' }; try { const response = await fetch(url, { method: "POST", headers: headers, body: JSON.stringify(payload) }); if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); } const output = await response.json(); console.log(output); } catch (error) { console.error('Error fetching data: ', error); }};fetchData();
{ "ques_ans_pairs": [ { "question": "Why did Elon Musk tweet that Tesla will not accept payments in Bitcoin?", "choices": ["Because Bitcoin is a volatile currency", "Because of government regulations", "Because of rising electricity costs", "Because of environmental concerns"], "answers": ["Because of environmental concerns"] }, // Additional questions... ], "text": "Elon Musk has shown again he can influence the digital currency market with just his tweets..."}
Questgen
Copyright © QuestgenAI, Inc. All rights reserved.