Giter Club home page Giter Club logo

final_project_api's Introduction

Behest API

Welcome to the Behest API.

You can access the following routes on the Behest API:

USER

1. "../user/" <- Get the user who is currently logged in (GET)

If the request was successful, the API will return the following message:

{
success: true,
message: "Found user #{@user.id}",
found_user: @user
}

2. "../user/register" <- Register a new user (POST)

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"
}

3. "../user/login" <- Log in to Behest (POST)

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"
}

4. "../user/:id" <- Edit an existing user (PUT)

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"
}

5. "../user/logout" <- Log out of Behest (GET)

If the user was successfully logged out, the API will return the following message:

{
success: true,
message: "you are logged out"
}

Forms

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"
}

1. "../form/" <- Get the form for the current user (GET)

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.

2. "../form/" <- Create a new form (POST)

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.

4. "../form/:id" <- Update an existing form (PUT)

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.

5. "../form/" <- Delete an existing form (DELETE

If the request is successful, the API will return the following message:

{
success: true,
message: "form #{@form.id} deleted successfully"

final_project_api's People

Contributors

zoesreagan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.