You can access the following routes on the Behest API:
If the request was successful, the API will return the following message:
{
success: true,
message: "Found user #{@user.id}",
found_user: @user
}
If the desired username is already taken, the API will return the following message:
{
success: false,
message: "username already taken, try again"
}
If registration was successful, the API will return the following message:
{
success: true,
user_id: user.id,
username: user.username,
message: "you are logged in and you have a cookie attached to all the responses"
}
If login was successful, the API will return the following message:
{
success: true,
user_name: user.name,
user_id: user.id,
username: username,
message: "Login successful"
}
If login was not successful, the API will return the following message:
{
success: false,
message: "Invalid Username or password"
}
If the attempt to edit a user's account was successful, the API will return the following message:
{
success: true,
message: "User was successfully updated"
}
If the new desired username has already been taken, the API will return the following message:
{
success: false,
message: "username already taken, try again"
}
If the user was successfully logged out, the API will return the following message:
{
success: true,
message: "you are logged out"
}
The user must be logged in to access their forms. If the user tries to hit any of the form routes without being logged in to Behest, the API will return the following message:
{
success: false,
message: "you are not logged in"
}
If the request is successful, the API will return the following message:
{
success: true,
form: @form
}
This will the form belonging to the current user.
If the request is successful, the API will return the following message:
{
success: true,
message: "Form #{@form.id} successfully created",
added_form: @form
}
To ensure all parts of the form were created, check the added_form object to make sure that form.id is not null.
If the request is successful, the API will return the following message:
{
success: true,
message: "You updated form ##{form.id}",
updated_form: @form,
}
To ensure the form was updated successfully, check the updated_form object to make sure that form_id is not null.
If the request is successful, the API will return the following message:
{
success: true,
message: "form #{@form.id} deleted successfully"