{"swagger":"2.0","info":{"version":"0.0.0","title":"3DAY API","description":"REST API for the 3DAY application.  This is a modification of the existing 3DAY API designed to conform more closesly to REST standards.  My intention is to add HATEOAS features with time.","license":{"name":"Unlicensed"}},"host":"127.0.0.1","definitions":{"status-success":{"type":"object","properties":{"status":{"type":"string","example":"success"},"message":{"type":"string","example":"Item was created"}}},"status-failure":{"type":"object","properties":{"status":{"type":"string","example":"failed"},"message":{"type":"string","example":"Something failed"}}},"user-profile":{"type":"object","properties":{"id":{"type":"string","example":"507f1f77bcf86cd799439011"},"username":{"type":"string","example":"Iain M. Banks"},"autoApprove":{"type":"boolean","example":true},"reportCount":{"type":"number","minimum":0,"example":134}}},"image-record":{"type":"object","properties":{"id":{"type":"string","example":"507f1f77bcf86cd799439011"},"description":{"type":"string","example":"a picture of a balloon"}}},"category":{"type":"object","properties":{"type":{"type":"string","enum":["food","sleep","exercise","missing1","missing2"],"example":"exercise"},"checked":{"type":"boolean","example":false},"message":{"type":"string","example":"today I ran 5 miles"}}},"report":{"type":"object","properties":{"userid":{"type":"string","example":"507f1f77bcf86cd799439011"},"date":{"type":"string","example":"November 5, 2016"},"categories":{"type":"array","items":{"$ref":"#/definitions/category"}},"images":{"type":"array","items":{"$ref":"#/definitions/image-record"}}}},"follower-status":{"type":"object","properties":{"approved":{"type":"boolean","example":true},"blocked":{"type":"boolean","example":false}}},"follower":{"type":"object","properties":{"id":{"type":"string","example":"507f1f77bcf86cd799439011"},"status":{"$ref":"#/definitions/follower-status"}}}},"paths":{"/api/v1/profile":{"get":{"summary":"get current user profile","description":"Returns current user's profile.  As the user has to be authenticated, then this will always be successful.","responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/user-profile"}}}},"post":{"summary":"create new user profile","description":"Create a new user account","parameters":[{"name":"details","description":"The username of the new account","in":"body","required":true,"schema":{"type":"object","properties":{"username":{"type":"string","example":"ian-m-banks"},"password":{"type":"string","example":"password123"}}}}],"responses":{"201":{"description":"New user account created","schema":{"$ref":"#/definitions/status-success"}},"400":{"description":"An error occured","schema":{"$ref":"#/definitions/status-failure"}}}},"patch":{"summary":"update user profile","description":"Update current user's profile","parameters":[{"name":"user profile","description":"Updated properties of the user profile","in":"body","schema":{"type":"object","properties":{"username":{"type":"string","example":"ian.m.banks"},"password":{"type":"string","example":"password123"},"autoApprove":{"type":"boolean","example":true}}}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/status-success"}},"400":{"description":"Invalid request","schema":{"$ref":"#/definitions/status-failure"}}}}},"/api/v1/users/{username}":{"get":{"summary":"get user-id by username","description":"Find a user by their username","parameters":[{"name":"username","description":"The friendly display name of this user","in":"path","type":"string","required":true}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/user-profile"}},"404":{"description":"User not found","schema":{"$ref":"#/definitions/status-failure"}}}}},"/api/v1/following/":{"get":{"summary":"get all people you are following","description":"Retrieve a list of all the people a user is following","responses":{"200":{"description":"A list of the users that we are following","schema":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","example":"507f1f77bcf86cd799439011"},"username":{"type":"string","example":"Iain M. Banks"}}}}}}}},"/api/v1/following/{user-id}":{"post":{"summary":"start following user","description":"Start following a user","parameters":[{"name":"user-id","description":"The user-id of the person to start following","in":"path","type":"string","required":true}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/status-success"}},"400":{"description":"Bad request, probably a missing or misformed user-id parameter","schema":{"$ref":"#/definitions/status-failure"}},"404":{"description":"Person not found","schema":{"$ref":"#/definitions/status-failure"}}}},"delete":{"summary":"stop following user","description":"Stop following a user","parameters":[{"name":"user-id","description":"The ID of the user to stop following","in":"path","type":"string","required":true}],"responses":{"200":{"description":"Successfully stopped following the user","schema":{"$ref":"#/definitions/status-success"}},"400":{"description":"Badly formatted ID","schema":{"$ref":"#/definitions/status-failure"}},"404":{"description":"User not found","schema":{"$ref":"#/definitions/status-failure"}}}}},"/api/v1/followers":{"get":{"summary":"get list of followers","description":"Retrieve a list of all followers","responses":{"200":{"description":"Success","schema":{"type":"array","items":{"$ref":"#/definitions/follower"}}}}}},"/api/v1/followers/{id}":{"put":{"summary":"update follower status","description":"Update the status of a follower","parameters":[{"name":"id","description":"The id of the follower","in":"path","type":"string","required":true},{"name":"status","description":"The new status","in":"body","required":true,"schema":{"$ref":"#/definitions/follower-status"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/status-success"}},"400":{"description":"Bad request","schema":{"$ref":"#/definitions/status-failure"}}}}},"/api/v1/reports":{"get":{"summary":"retrieve reports","description":"Retrieve some reports","parameters":[{"name":"limit","description":"The number of reports to return","in":"query","type":"string","required":false},{"name":"offset","description":"Reports are returned in reverse order with most recent first.  This parameter skips the required number of reports.  For paging.","in":"query","type":"string","required":false}],"responses":{"200":{"description":"A list of reports","schema":{"type":"array","items":{"$ref":"#/definitions/report"}}}}},"post":{"summary":"create report","description":"Create a new report","parameters":[{"name":"report","description":"The report to create","in":"body","required":true,"schema":{"$ref":"#/definitions/report"}}],"responses":{"201":{"description":"Created","schema":{"$ref":"#/definitions/status-success"}}}}},"/api/v1/reports/{report-id}":{"put":{"summary":"update report","description":"Update a report","parameters":[{"name":"report-id","description":"The ID of the report to be modified","in":"path","type":"string","required":true},{"name":"report","description":"The new content of the report","in":"body","required":true,"schema":{"$ref":"#/definitions/report"}}],"responses":{"200":{"description":"Report updated","schema":{"$ref":"#/definitions/status-success"}},"404":{"description":"Report not found","schema":{"$ref":"#/definitions/status-failure"}}}},"delete":{"summary":"delete report","description":"Delete a report","parameters":[{"name":"report-id","description":"The ID of the report to be modified","in":"path","type":"string","required":true}],"responses":{"200":{"description":"Report deleted","schema":{"$ref":"#/definitions/status-success"}},"404":{"description":"Report not found","schema":{"$ref":"#/definitions/status-failure"}}}}},"/api/v1/timeline/page":{"get":{"summary":"timeline for paging","description":"Retrieve a timeline of reports from other users limited by the number of records that are returned","parameters":[{"name":"time","description":"The time before which the reports should be generated","in":"query","type":"string"},{"name":"number","description":"The number of reports to return","in":"query","type":"string"},{"name":"users","description":"Optional filter of users","in":"query","type":"array","collectionFormat":"csv","items":{"type":"string"}}],"responses":{"200":{"description":"A list of reports","schema":{"type":"array","items":{"$ref":"#/definitions/report"}}}}}},"/api/v1/timeline/window":{"get":{"summary":"timeline window","description":"Retrieve a timeline of reports from other users based on the 'from' and 'to' date-times provided","parameters":[{"name":"from","description":"The time from which reports should be returned","in":"query","type":"string"},{"name":"to","description":"The time to which reports should be returned","in":"query","type":"string"},{"name":"users","description":"Optional filter of users","in":"query","type":"array","collectionFormat":"csv","items":{"type":"string"}}],"responses":{"200":{"description":"A list of reports","schema":{"type":"array","items":{"$ref":"#/definitions/report"}}}}}},"/api/v1/images":{"post":{"summary":"upload image","description":"Upload a new image","consumes":["multipart/form-data"],"parameters":[{"name":"report-id","description":"The ID of the report to associate with the image","in":"query","type":"string","required":true},{"name":"image","in":"formData","type":"file","required":true,"description":"The image to upload."}],"responses":{"201":{"description":"Image has been uploaded","schema":{"$ref":"#/definitions/status-success"}},"400":{"description":"Error in file upload","schema":{"$ref":"#/definitions/status-failure"}}}}},"/api/v1/images/{image-id}":{"get":{"summary":"download image","description":"Get an image","parameters":[{"name":"image-id","description":"The ID of the image","in":"path","type":"string","required":true}],"produces":["image/jpeg"],"responses":{"200":{"description":"Returns the image"},"404":{"description":"Image not found","schema":{"$ref":"#/definitions/status-failure"}}}},"delete":{"summary":"delete image","description":"Delete an image","parameters":[{"name":"image-id","description":"The ID of the image","in":"path","type":"string","required":true}],"responses":{"200":{"description":"The image was deleted","schema":{"$ref":"#/definitions/status-success"}},"404":{"description":"Image not found","schema":{"$ref":"#/definitions/status-failure"}}}}}}}