Link Search Menu Expand Document

GET /api/questions (index)

Fetch a list of all of your questions. Returns all fields that an individual show request does.

curl \
  -H 'Authorization: Token token="<%= api_key %>"' \
  https://coderpad.io/api/questions?sort=updated_at,desc

index takes an optional sort parameter, which allows you to sort by either the created_at or updated_at fields on the questions. Adding a comma will allow you to change the sort direction, which is desc by default. For example, to sort your questions by updated_at from oldest to newest, specify updated_at,asc.

If no sort parameter is provided, created_at,desc is assumed.

The method also returns paginated results - no more than 50 per request. If you want more, follow the next_page or prev_page urls if present. The API also returns a total count to give you a sense of how many questions exist.

{
  "status": "OK",
  "questions": [
    // ... your questions, with the same data format as in `show`
  ],
  "next_page": "https://coderpad.io/api/question?sort=updated_at,desc&page=2",
  "total": 420
}