ponzu-cms / ponzu

Headless CMS with automatic JSON API. Featuring auto-HTTPS from Let's Encrypt, HTTP/2 Server Push, and flexible server framework written in Go.
https://docs.ponzu-cms.org
BSD 3-Clause "New" or "Revised" License
5.67k stars 387 forks source link

Pagination details on contents API missing #334

Open mangelajo opened 4 years ago

mangelajo commented 4 years ago

The GET /api/contents?type= request provides the capability to request by offset/count. But it's impossible to determine how many items exist in the database.

Such information would be helpful to implement pagination on the frontends.

{
  "data": [
    {
        "uuid": "024a5797-e064-4ee0-abe3-415cb6d3ed18",
        "id": 6,
        "slug": "item-id-024a5797-e064-4ee0-abe3-415cb6d3ed18", // customizable
        "timestamp": 1493926453826, // milliseconds since Unix epoch
        "updated": 1493926453826,
        // your content data...,
    }, { ... }
  ],
 "total_count" : 110,
}

I suggest to implement a "total_count" (or any similar name on the response).

I can send a PR for that.

mangelajo commented 4 years ago

@nilslice ^ does that make sense?

nilslice commented 4 years ago

That does make sense, feel free to send the PR. I'll try to get this and your other PR merged by the weekend. Been busy wrapping up 2019! Happy new year!

mangelajo commented 4 years ago

Happy new year, thanks!!! :)

Enviado desde mi iPhone

El 1 ene 2020, a las 22:58, Steve Manuel notifications@github.com escribió:

 That does make sense, feel free to send the PR. I'll try to get this and your other PR merged by the weekend. Been busy wrapping up 2019! Happy new year!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.