mykiwi
mykiwi

Reputation: 1693

Disable /api/entities route to get the list

When creating an entity with @ApiResource, you get 5 routes:

GET    /api/entities
POST   /api/entities
GET    /api/entities/{id}
DELETE /api/entities/{id}
PUT    /api/entities/{id}

How can I disable the first route ?

Thanks.

Upvotes: 0

Views: 281

Answers (1)

Ayan
Ayan

Reputation: 98

You should customize the collectionOperations attribute in your @ApiResource annotation

/**
 * @ApiResource(
 *     collectionOperations={}
 * )
 */

For more information: https://api-platform.com/docs/core/operations/#enabling-and-disabling-operations

Upvotes: 1

Related Questions