This is an API for a photo gallery made using laravel PHP.
URL: <base_url>/api/photo/add
Method: POST
JSON Data:
{
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path"
}
Response:
{
"id": 1,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"in_albums": [],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
URL: <base_url>/api/photo/{id}
Method: GET
Response:
{
"id": 1,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"in_albums": [],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
URL: <base_url>/api/photo/list
Method: GET
Response:
[
{
"id": 1,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"in_albums": [],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
},
{
"id": 2,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"in_albums": [],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
]
URL: <base_url>/api/photo/{id}/update
Method: POST
JSON Data:
{
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path"
}
Response:
{
"msg": "Photo updated successfully"
}
URL: <base_url>/api/photo/{id}/delete
Method: POST
Response:
{
"msg": "Photo deleted successfully"
}
URL: <base_url>/api/album/add
Method: POST
JSON Data:
{
"name": "Album Name",
"description": "Album Description",
"photos": [1, PHOTO_ID]
}
Response:
{
"id": 1,
"name": "Album Name",
"description": "Album Description",
"photos": [
{
"id": 1,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
URL: <base_url>/api/album/{id}
Method: GET
Response:
{
"id": 1,
"name": "Album Name",
"description": "Album Description",
"photos": [
{
"id": 1,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
URL: <base_url>/api/album/list
Method: GET
Response:
[
{
"id": 1,
"name": "Album Name",
"description": "Album Description",
"photos": [
{
"id": 1,
"name": "Photo Name",
"description": "Photo Description",
"photo": "Photo File Path",
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
},
{
"id": 2,
"name": "Album Name",
"description": "Album Description",
"photos": [],
"created_at": "2020-01-01 00:00:00",
"updated_at": "2020-01-01 00:00:00"
}
]
URL: <base_url>/api/album/{id}/update
Method: POST
JSON Data:
{
"name": "Album Name",
"description": "Album Description",
"photos": [1, PHOTO_ID]
}
Response:
{
"msg": "Album updated successfully"
}
URL: <base_url>/api/album/{id}/delete
Method: POST
Response:
{
"msg": "Album deleted successfully"
}