Guide 1.5: Developer Guide

Your First SdashAPI Request

Now that you have your API key and understand how authentication works, it is time to make your very first request to the SdashAPI servers. In this guide, we will use the terminal tool cURL to fetch a random JAMB question.

The V1 Endpoint

1.5.1

For this first request, we will use the V1 Endpoint. This is the fastest and most standard endpoint for retrieving basic questions, options, answers, and solutions without any AI-generated metadata.

The base URL for this endpoint is:
https://sdashapi.com/api/v1/q

Building the Query

1.5.2

We need to tell the API exactly what kind of question we want. We do this by appending query parameters to the URL. For this test, we want a Mathematics question from the UTME (JAMB) exam.

  • type: utme
  • subject: mathematics

Combining these parameters gives us our final URL:
https://sdashapi.com/api/v1/q?type=utme&subject=mathematics

HTTP Request Methods

1.5.3

Before we send the request, it is important to note that SdashAPI strictly adheres to RESTful principles. Because you are retrieving data (not creating or deleting data), you must use the GET HTTP method.

If you attempt to send a POST, PUT, or DELETE request to the question endpoints, the server will reject the request with a 405 Method Not Allowed error.

Executing the Request

1.5.4

Open your computer's terminal or command prompt. We will use the curl command-line tool, which is pre-installed on most modern operating systems, to send our HTTP request. Remember to replace YOUR_API_KEY with the actual token from your dashboard.

curl -X GET "https://sdashapi.com/api/v1/q?type=utme&subject=mathematics" \
  -H "AccessToken: YOUR_API_KEY"

When you hit Enter, your terminal will reach out to our servers. If your API key is correct, you will instantly receive a block of JSON data representing a real past question!

Viewing Headers and Status Codes

1.5.5

By default, cURL only shows the response body (the data). If you want to see the HTTP status code (e.g., 200 OK) and the response headers returned by SdashAPI, you can add the -i (include) flag to your cURL command.

curl -i -X GET "https://sdashapi.com/api/v1/q?type=utme&subject=mathematics" \
  -H "AccessToken: YOUR_API_KEY"

This will print the server information, rate limit headers (if any), and the content type before printing the actual JSON payload, which is incredibly useful for debugging.

Received a bunch of text?

Next, we will break down exactly what that JSON response means.

Next Guide: Understanding Responses →
Avatar

How can we help?

We reply immediately

Hello! 👋 How can we help you today?