I am new to developing webservice, my idea is to build a REST API based on PHP. Which make possible to CRUD images files e.g. images/test.jpg.
Is possible to get images over a REST webservice? If yes, then how? Or is a webservice only for json responses provided?
I prefer approach without a framework, because i want to learn.
My routes:
// GET
/api/images # Get alle images
/api/images/1 # Get images based on primary key
// PUT
/api/images/1 # Update images based on primary key
// POST
/api/images # Add a new image
// DELETE
/api/images/1 # Delete images based on primary key
JSON Response example
/api/images/1
Version the image file itself stored phyisical on webservice project(www.example.com).
{
"filename": "example.jpg",
"filepath": "www.example.com/images/example.jpg",
"htmlAlt": "Example Image",
}
or be better this version
Version the image itself stored phyisical on frontend project(www.example-frontend.com).
{
"filename": "example.jpg",
"filepath": "images/example.jpg",
"htmlAlt": "Example Image",
}