You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: retrieve a image; if /:id = first then gets first image, else must specify an image id
request: GET /api/image/:gallery/:id
response: 200 || 403 if Unauthorized
content: application/json
body: list of objects
status: (int) repsonse
raw: object (contains image data)
title: (string) image title
author: (string) image author
type: (string) image type (url or file)
source: (string) location of image, if type = url then its a url if type = file then its the file name accessable at localhost:3000/source
_id: the image id
createdAt: when the image was made
upadatedAt: when the image was last updated
$ curl http://localhost:3000/api/x/image/first
where x is the username of the user who's gallery you want to access
Getting the next image
description: given an image id get 'next' image. This is for the next image button on the front-end and behaves as one expects it to (i.e. A1 specs).
request: GET /api/next/:gallery/:id
response: 200
content-type: application/json
body: list of objects
status: (int) status
raw: object (contains image data)
title: (string) image title
author: (string) image author
type: (string) image type (url or file)
source: (string) location of image, if type = url then its a url if type = file then its the file name accessable at localhost:3000/source
_id: the image id
createdAt: when the image was made
upadatedAt: when the image was last updated
$ curl http://localhost:3000/api/next/x/TpDXlZpFPlyxKN8N
** where TpDXlZpFPlyxKN8N is an arbitrary img id **
where x is the username of the user who's gallery you want to access
Getting the previous image
description: given an image id get 'previous' image. This is for the previous image button on the front-end and behaves as one expects it to (i.e. A1 specs).
request: GET /api/prev/:gallery/:id
response: 200
content-type: application/json
body: list of objects
status: (int) status
raw: object (contains image data)
title: (string) image title
author: (string) image author
type: (string) image type (url or file)
source: (string) location of image, if type = url then its a url if type = file then its the file name accessable at localhost:3000/source
_id: the image id
createdAt: when the image was made
upadatedAt: when the image was last updated
$ curl http://localhost:3000/api/next/x/TpDXlZpFPlyxKN8N
** where TpDXlZpFPlyxKN8N is an arbitrary img id **
where x is the username of the user who's gallery you want to access
Deleting an image
description: remove an image given its id
request: DELETE /api/image/:gallery/:image
response: 200 || 403 if Unauthorized
status: (int) status
$ curl http://localhost:3000/api/next/x/TpDXlZpFPlyxKN8N
** where TpDXlZpFPlyxKN8N is an arbitrary img id **
where x is the username of the user who's gallery you want to access
Comments API
Adding/Creating A Comment
description: create a comment, recommend test using form on front-end
request POST /api/addcomment/
content-type: application/json
body: object
imgid: (string) the id of image associated with comment
description get the next (start_index + 10) comments for image with a given imgid
request: GET /api/comments/:imgid/:start_index
response: 200 || 403 if Unauthorized
content-type: application/json
body: object
status: (int) status code
comments: (list) of comment objects
imgid: id of the image comment belongs to
html: the html content of comment
_id: the comment id
createdAt: when comment was made
updatedAt: when comment was last updated
$curl http://localhost:3000/api/comments/xyz/0
Deleting a Comment
description: remove comment given its imgid and html content, recommend testing using front-end (make a comment then press x to delete - it makes a call straight to this method). Moreover, for whatever reason curl commands act weird with passing body to DELETE.
request: DELETE /api/comment/:id/:owner
content-type: params
id: (string) the id of the comment to delete
owner: (string) true if the requesting user is the OP of comment false o/w
response: 200 || 403 if Unauthorized
body: object
numRemoved: (string) number of items removed (1 or 0)
$ curl http://localhost:3000/api/next/TpDXlZpFPlyxKN8N/true
where TpDXlZpFPlyxKN8N is an arbitrary comment id