Generating AI Riddle via topic
A topic or theme can be provided to the generative AI API to get a Riddle surrounding a rather general subject; opposing to specific content, e.g. attributed to an URL.
Generating different Riddle types
Generate a Quiz
To generate a quiz about 'Soccer', use the /riddle-ai/topic/quiz API endpoint. Here is an example payload:
{
"topic": "Soccer",
"numQuestions": 5,
"language": "en",
"difficulty": "easy"
}
Generate a Poll
To generate a poll about 'Harry Potter', use the /riddle-ai/topic/poll API endpoint. Here is an example payload:
{
"topic": "Harry Potter",
"numQuestions": 5,
"language": "en"
}
Generate a Personality test
To generate a personality quiz about 'Harry Potter', use the /riddle-ai/topic/personality API endpont. Here is an example payload:
{
"topic": "Harry Potter",
"numQuestions": 5,
"language": "en",
"numAttributes": 0,
"numPersonalities": 3
}
Optional parameters
There are several optional parameters you can use with every Riddle type to further customize the generated Riddle and control its flow:
Property | Type | Description | Default |
---|---|---|---|
project | integer|null | The project the generated Riddle will be assigned to; pass NULL if it should be added to the personal project | |
publish | boolean | Whether to publish the Riddle immediately after generation; pass false to only generate a draft | false |
callbackUrl | string | A URL to which the generated Riddle will be sent; useful as the generation happens asynchronously |
Tip: Using the callbackUrl
parameter is a good way to avoid having to poll the API for the Riddle ID. You can use this URL to trigger a webhook to your server and be notified when the Riddle is ready to use and for embedding.
Example Poll object
{
"topic": "Harry Potter",
"numQuestions": 5,
"language": "en",
"project": 123,
"publish": true,
"callbackUrl": "https://example.com/callback",
}