API for services in GlimpseWearables
https://stackoverflow.com/questions/8634473/sending-json-request-with-python
The current urls will return the content as described in a json file #API functionality with put/post/get/delete/patch requests
GET "api/user/{{user_id_of_desired_user}}/" => returns the user with that device id from the database
GET "api/media/{{media_id_of_desired_media}}/" => returns the media with that media id from the database
GET "api/device/{{device_id_of_desired_device}}/" => returns the device with that device id from the database
GET "api/event/{{event_id_of_desired_event}}/" => returns the event with that event id from the database
Using "post" as the HTTP Response will allow you to create a new piece of data in the database as long as you follow the proper json syntax for the data
Make sure you include the "/" at the end of each post/patch/put url, otherwise the django framework will see this as routing and won't post any information
{ "email": "{{Desired email of user}}", "first_name": "{{Desired first name of user}}", "last_name": "{{Desired last name of user}}", "password": "{{Desired password of user}}", "phone": "{{Desired phone number of user}}" }
{ "name": "{{Desired name of event}}", "address": "{{Desired address of event}}", "end_date": "{{Desired end_date of event}}", "start_date": "{{Desired start_date of event}}", "lat": "{{Desired latitude of event}}", "long": "{{Desired longitude of event}}" }
{ "link": "{{name of the media that is stored in the s3 data}", "media_type": "{{image or video}}", "ranking": "{{Desired ranking of the media}}", "raw_or_edited" : {{Whether or not the image has been edited or not}}", "downloaded" : "{{0 means not downloaded, 1 means downloaded}}", }
{ "device_number" : "{{device number of device}}", "serial_number" : "{{serial number of the device}}" }
#All of the following routes return a specific type of data from the database
returns nothing, a loading page telling you to enter a proper url as an endpoint
returns nothing, a loading page telling you to enter a proper url as an endpoint
grabs ALL images that are being stored in the raw bucket
grabs ALL videos that are being stored in the raw bucket
grabs ALL images that are being stored in the raw bucket as well as the edited bucket
grabs ALL videos that are being stored in the raw bucket as well as the edited bucket
grabs ALL events from mysql database
grabs a specific event from the mySQL database with all of the details about the event as well as all of the content that is associated with that event
"media/getAllImagesUserEvent/{{user_id_of_who_you_want_to_grab}}/{{event_id_of_which_event_you_want_to_grab}}" =>
grabs all images for a specific user at a specific event
"media/getAllVideosUserEvent/{{user_id_of_who_you_want_to_grab}}/{{event_id_of_which_event_you_want_to_grab}}" =>
grabs all videos for a specific user at a specific event
Initializing/updating the database. Only to be used once at the very beginning of launching the website to transfer all of the existing files that are stored in the s3 database but not yet tracked in the sql database specific to the api that we are using. Once the api is able to continually update the sql database every time an image is uploaded this function will never have to be run again