API Documentation

This API provides paginated data using a Go serverless function deployed on Vercel. The API returns a list of objects with pagination support, allowing clients to specify the page number and the number of objects per page.

Endpoint

GET /api

Query Parameters

Response

The API returns a JSON object containing the requested objects and the next page number (if available).

Success Response

{
  "objects": [
    {
      "name": "random name 1",
      "content": "random content 1",
      "image": "https://placehold.co/600x400"
    },
    {
      "name": "random name 2",
      "content": "random content 2",
      "image": "https://placehold.co/600x400"
    }
    ...
  ],
  "nextPage": 2
}

Error Response

{
  "error": "error message"
}

Example Requests

Fetch Default Page:

curl -X GET "https://your-vercel-project/api"

Fetch Specific Page:

curl -X GET "https://your-vercel-project/api?page=2"

Fetch Specific Page with Custom Objects per Page:

curl -X GET "https://your-vercel-project/api?page=2&perPage=20"

Fetch with Long Content:

curl -X GET "https://your-vercel-project/api?page=1&perPage=10&longContent=true"