I wanted to preface this with a little note. While we allow anyone to use our database in their products via our API, first and foremost the database is designed for use by PixelTail Games, specifically for Tower Unite. What this boils down to, is that features are really only added to the database when we need them ourselves. I also wanted to note, that while it wasn’t hard to implement this, nor did it take a lot of time, it was 12:50AM in my region when I posted my note about future implementation.
That being said, I have created two API calls that can be used to retrieve the number of questions in the database.
The first API call I created was “count”, and it can be used like so.
https://opentdb.com/api_count.php?category=VALID_CATEGORY_ID_HERE
Here’s an example snippet of what it’ll return:
{
"category_id": 9,
"category_question_count": {
"total_question_count": 182,
"total_easy_question_count": 69,
"total_medium_question_count": 81,
"total_hard_question_count": 32
}
}
The second API call I created was “count_global”, and can be used like so.
https://opentdb.com/api_count_global.php
Here’s an example snippet of what it’ll return:
{
"overall": {
"total_num_of_questions": 4166,
"total_num_of_pending_questions": 550,
"total_num_of_verified_questions": 2595,
"total_num_of_rejected_questions": 1021
},
"categories": {
"9": {
"total_num_of_questions": 483,
"total_num_of_pending_questions": 84,
"total_num_of_verified_questions": 182,
"total_num_of_rejected_questions": 217
},
I’ve also updated the API documentation to contain these calls.
Hopefully these will be of use to you, and I wish you the best in developing your Trivia application.