Symfony also is useful with API
Identify how create APIs in Symfony, creating and reading post and only reading categories
Server: Symfony 6, API Platform
- Clone this repository.
- Navegate to the project directory
- Run
composer install
to install the dependencies.
- Configure your environment variables.
Type |
Path |
Description |
Params |
GET |
/api/categories |
All categories |
|
{
"id": 0,
"name": "string",
"posts": [
"string"
]
}
Type |
Path |
Description |
Params |
GET |
/api/categories/{id} |
An specific category |
id |
{
"id": 0,
"name": "string",
"posts": [
"string"
]
}
Type |
Path |
Description |
Params |
GET |
/api/posts |
All posts |
|
{
"id": 0,
"title": "string",
"category": {
"id": 0,
"name": "string"
},
"summary": "string"
}
Type |
Path |
Description |
Params |
GET |
/api/posts/{id} |
An specific post |
id |
{
"id": 0,
"title": "string",
"body": "string",
"category": {
"id": 0,
"name": "string"
}
}
Type |
Path |
Description |
Params |
POST |
/api/posts |
Create a post |
title, body, category |
{
"id": 0,
"title": "string",
"body": "string",
"category": "string",
"summary": "string"
}
Type |
Path |
Description |
Params |
PATCH |
/api/posts/{id} |
Update a post |
id, title, body, category |
{
"id": 0,
"title": "string",
"body": "string",
"category": "string",
"summary": "string"
}
The Laravel framework is open-sourced software licensed under the MIT license.