Photos - adithya/image-repo GitHub Wiki

Upload a photo

Endpoint POST /photo/upload

Request:

curl -b /tmp/cookies \
  --request POST \
  --header 'content-type: multipart/form-data' \
  -F IsPublic=false \
  -F [email protected] \
  --url http://localhost:8080/photo/upload

Response:

0c4be1b0-4f0b-40ca-8d9c-5a141860b652

Delete a photo

Endpoint DEL /photo/delete

Request:

curl -b /tmp/cookies \
  --request DELETE \
  --url http://localhost:8080/photo/delete \
  --header 'content-type: application/json' \
  --data '{ "PhotoID":"07c010e7-6994-407e-8b44-e03cfb50ce61" }'

Response:

photo deleted

Change the visibility of a photo

Endpoint GET /photo/edit/permissions

Request:

curl -b /tmp/cookies \
  --request GET \
  --url http://localhost:8080/photo/edit/permissions \
  --header 'content-type: application/json' \
  --data '{ "PhotoID":"07c010e7-6994-407e-8b44-e03cfb50ce61", "IsPublic":true }'

Response:

photo visibility has been changed

Get all details about a photo

Endpoint GET /photo/details

Request:

curl -b /tmp/cookies \
  --request GET \
  --url http://localhost:8080/photo/details \
  --header 'content-type: application/json' \
  --data '{ "PhotoID":"07c010e7-6994-407e-8b44-e03cfb50ce61" }'

Response:

{
  "PhotoID": "07c010e7-6994-407e-8b44-e03cfb50ce61",
  "IsPublic": false,
  "ImageURL": "http://localhost:4443/7bc29a69-20b7-4043-8c0f-a0d718021b26/07c010e7-6994-407e-8b44-e03cfb50ce61",
  "Username": "testuser",
  "IsOwnedByAPIUser": true
}