Skip to main content

GET Collection Endpoint

src/ApiResource/Admin/BookDto.php
namespace App\ApiResource\Admin;

use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\GetCollection;
use App\ApiState\Admin\Book\BookCollectionProvider;

#[ApiResource(
shortName: 'Admin/Book',
routePrefix: '/admin',
// // Uncomment the following to enable keyset-pagination:
// extraProperties: [
// 'api_lite_rekapager' => true
// ]
operations: [
// ...
new GetCollection(
uriTemplate: '/books',
provider: BookCollectionProvider::class,
),
// ...
]
)]
class BookDto
{
// ...
}