-
Notifications
You must be signed in to change notification settings - Fork 2
WebAPI Docs
Server data will always be sent down in JSON format in the following protocol:
{
"status": "success",
"data": {
//return data will appear here
},
"message": null //optional success message
}
{
"status": "error",
"data": null,
"message": "Error message" //Custom error message
}
ND specifies that the action will have a NULL data
payload back from the server
Basic server tests. Destination: api/test/action
Get request test, server will always send back success
Send:
- foo: test paramater, can be anything
Server will indicate success if foo
parameter is set. Recieve:
- fooback: server will echo foo back
Send:
- f"test": file named test
Server will send back the SHA-256 hash of your file
- sha256: SHA-256 hash of file
Handles all user actions. Destination: /api/user/action
.
Send:
- username: user username, must be above 5 characters in length
- password: user password, must be above 8 characters in length
Send:
- username: user username
- password: user password
Recieve:
- authcode: authentication code
After recieving the authentication code, all future API requests MUST have the authentication code attached as a GET parameter.
Example: /API/user/info?authcode=XxxxXxxxX
Verifies authcode is valid or invalid, returns success/failure.
Returns user info
Recieve:
- username: username of user
- more to come
Logs out of account, CHANGES authcode!
Handles everything picture related. Destination: api/picture/action
Send:
- title: title of picture
- picture: picture file in to be specified format
- geolat & geolong: current geographic location in latitude and longitude
Recieve:
Server will send back picture id of your uploaded pic
- pid: picture id
Send (URL params):
- geolat & geolong: current geographic location in latitude and longitude
- Filter specifications: (supports multiple filters)
- ft_dist: Filter by distance (specify distance), will return
d <= ft_dist
- ft_time: Filter by create time (specify time), will return
t >= ft_time
- ft_name: Filter by username, will return
n == ft_name
- ft_views: Filter by views, will return
v <= ft_views
- ft_me: Filter by if I viewed or not, determined through the comments table: boolean (0/1)
Recieve:
An array of image ids containing the following info:
[
{
"pid": xxx, //picture id
"title": //Title of the image
"geolat": //pic taken location latitude (STRING)
"geolong": //pic taken location longitude (STRING)
"created": //created by time
"dist": //distance from current location in miles
"username": //username of picture creator
"views": //number of views (likes + dislikes)
},
{
//...
}
]
Returns a list of your own pictures with some more detailed info.
Recieve:
An array of image ids containing the following info:
[
{
"pid": xxx, //picture id
"title": //Title of the image
"geolat": //pic taken location latitude (STRING)
"geolong": //pic taken location longitude (STRING)
"created": //created by time
"likes": //picture likes
"dislikes": //picture dislikes
"views": //number of views (likes + dislikes)
},
{
//...
}
]
Fetches actual image data of image id
Recieve:
Raw picture data, 404 not found
on case of incorrect id
Are able to comment on pictures. Destination: /api/picture/{pid}/action
, where {pid}
is the id of the picture you wish to comment on
You are only able to retrieve the comments on the pictures YOU upload.
Recieve:
A list of comments:
[
{
"username": //username of commentor
"comment": //comment of user
"style": //style rating, can be null
},
{
//...
}
]
Comment and evaluate the picture.
Send:
- like: boolean value (0/1) indicating if you like the picture
- comment: 800 char max comment about the picture
- style: integer style evaluation