-
Notifications
You must be signed in to change notification settings - Fork 0
API Calls
Note that user data passed in quotations here are simple filler placeholder.
#Token Endpoint This is for the Token endpoint. Define the URL with this global variable (specifically defined in the config.js):
var foodloop_token_url = ...This endpoint is then called with the following post data:
{
"token": "mytokenvalue"
}On a success this expects a response of:
{
"success": true,
"username": "usernametouse"
}On a failure this expects a response of:
{
"success": false,
"message": "Token is invalid or has already been used"
}#Registration Endpoint This is for the Token endpoint. Define the URL with this global variable (specifically defined in the config.js):
var foodloop_register_url = ...This endpoint is then called with the following post data:
{
"name": "myfullname",
"username": "usernametouse",
"email": "myemail",
"postcode": "mypostcode",
"age": "myage",
"gender": "mygender",
"grouping": "mygrouping",
"password": "mypassword"
}On a success this expects a response of:
{
"success": true,
}On a failure this expects a response of:
{
"success": false,
"message": "Username not recognised, has your token expired?"
}OR
{
"success": false,
"message": "Token has already been used?"
}#Edit Endpoint This is for the Token endpoint. Define the URL with this global variable (specifically defined in the config.js):
var foodloop_edit_url = ...This endpoint is then called with the following post data:
{
"name": "myfullname",
"username": "usernametouse",
"postcode": "mypostcode",
"age": "myage",
"gender": "mygender",
}On a success this expects a response of:
{
"success": true,
}On a failure this expects a response of:
{
"success": false,
"message": "Username not recognised, has your token expired?"
}OR
{
"success": false,
"message": "Token has not been used yet!"
}#Upload Endpoint This is for the Token endpoint. Define the URL with this global variable (specifically defined in the config.js):
var foodloop_upload_url = ...This endpoint is then called with a file upload of an image, along with several DOMstring object parameters attached to it - sends it as a application/x-www-form-urlencoded:
| Key | Value |
|---|---|
| file | The file to send |
On a success this expects a response of:
{
"success": true,
}On a failure this expects a response of:
{
"success": false,
}And an HTML 403 status error. OR
{
"success": false,
"message": "Wrong image extension!"
}