GithubHelp home page GithubHelp logo

front-end's Introduction

Water My Plants API

What To Know About This API

I've made a LOT of endpoints. Some will be useful, some are just for reference (and maybe you want them, I don't know, I'm not your mom). JSON examples listed underneath this list. Don't care about reference? These are the ones you want:

[GET] /api/plants/:plant_id

RESTRICTED ENDPOINT

See the plant data (including plant owner) at a :plant_id

[POST] /api/plants/user/:user_id

RESTRICTED ENDPOINT

Post a plant to a user's data using the user's user_id

[PUT] /api/plants/:plant_id

RESTRICTED ENDPOINT

Edit a plant's information using the plant id

[DELETE] /api/plants/:user_id/:plant_id

RESTRICTED ENDPOINT

Remove a plant using the user id and the plant id

[GET] /api/users/:user_id

RESTRICTED ENDPOINT

See a specific user's information

[GET] /api/users/:user_id/plants

RESTRICTED ENDPOINT

See all plants created by a single user

[POST] /api/users/register

Create a new user

[POST] /api/users/login

Logs in a user, receives a token for authorization

[PUT] /api/users/:user_id

RESTRICTED ENDPOINT

Edit the user's phone_number and password only Need to send back username, phone_number, and password

Plants

[GET] /api/plants

RESTRICTED ENDPOINT

See the full array of plants

[
    {
        "plant_id": 1,
        "nickname": "Fish",
        "species": "gillyweed",
        "h2o_frequency": 3,
        "image": null,
        "plant_owner_id": 1,
        "plant_owner": "connie"
    },
    {
        "plant_id": 2,
        "nickname": "Tailss",
        "species": "dirigible plum",
        "h2o_frequency": 3,
        "image": null,
        "plant_owner_id": 2,
        "plant_owner": "michael"
    },
    {
        "plant_id": 3,
        "nickname": "Tyke",
        "species": "mandrake",
        "h2o_frequency": 3,
        "image": null,
        "plant_owner_id": 3,
        "plant_owner": "dave"
    },
    {
        "plant_id": 4,
        "nickname": "Pussy Patty",
        "species": "bubotuber",
        "h2o_frequency": 3,
        "image": null,
        "plant_owner_id": 4,
        "plant_owner": "veronica"
    },
    {
        "plant_id": 5,
        "nickname": "Wiggles",
        "species": "venomous tentacula",
        "h2o_frequency": 3,
        "image": null,
        "plant_owner_id": 5,
        "plant_owner": "jonathan"
    },
    {
        "plant_id": 6,
        "nickname": "Turtle",
        "species": "shrivelpig",
        "h2o_frequency": 3,
        "image": null,
        "plant_owner_id": 6,
        "plant_owner": "daniel"
    }
]
[GET] /api/plants/:plant_id

RESTRICTED ENDPOINT

See the plant data (including plant owner) at a :plant_id

{
    "plant_id": 1,
    "nickname": "Fish",
    "species": "gillyweed",
    "h2o_frequency": 3,
    "image": null,
    "plant_owner_id": 1,
    "plant_owner": "connie"
}
[POST] /api/plants/user/:user_id

RESTRICTED ENDPOINT

Post a plant to a user's data using the user's user_id

*** Required information *** nickname species h2o_frequency

*** Optional information *** image

{
    "plant_id": 9,
    "nickname": "Spike",
    "species": "cactus",
    "h2o_frequency": 1200,
    "image": null
}
[PUT] /api/plants/:plant_id

RESTRICTED ENDPOINT

Edit a plant's information using the plant id

*** Required information *** nickname species h2o_frequency

*** Optional information *** image

{
    "nickname": "Spikey",
    "species": "cactus",
    "h2o_frequency": 1200
}
[DELETE] /api/plants/:user_id/:plant_id

RESTRICTED ENDPOINT

Remove a plant using the user id and the plant id

{
    "message": "Did your plant die? That's okay. I'm only judging you the slightest bit."
}

Users

[GET] /api/users

RESTRICTED ENDPOINT

See the full array of users

[
    {
        "user_id": 1,
        "username": "connie",
        "phone_number": "1118675309"
    },
    {
        "user_id": 2,
        "username": "michael",
        "phone_number": "2228675309"
    },
    {
        "user_id": 3,
        "username": "dave",
        "phone_number": "3338675309"
    },
    {
        "user_id": 4,
        "username": "veronica",
        "phone_number": "4448675309"
    },
    {
        "user_id": 5,
        "username": "jonathan",
        "phone_number": "5558675309"
    },
    {
        "user_id": 6,
        "username": "daniel",
        "phone_number": "6668675309"
    }
]
[GET] /api/users/:user_id

RESTRICTED ENDPOINT

See a specific user's information

{
    "user_id": 3,
    "username": "dave",
    "phone_number": "3338675309"
}
[GET] /api/users/:user_id/plants

RESTRICTED ENDPOINT

See all plants created by a single user

[
    {
        "plant_id": 3,
        "nickname": "Tyke",
        "species": "mandrake",
        "h2o_frequency": 3,
        "image": null
    }
]
[POST] /api/users/register

Create a new user

*** Required information *** username phone_number password

{
    "user_id": 7,
    "username": "gabe",
    "phone_number": "7778675309"
}
[POST] /api/users/login

Logs in a user, receives a token for authorization

*** Required information *** username password

{
    "message": "Login successful",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImdhYmUiLCJpYXQiOjE2MjE2NjEwODMsImV4cCI6MTYyMTc0NzQ4M30.7VWM3Q1JWAgw-HWKpDCu2GZN4AzVlkA-FUZoEIO0oZg"
}
[PUT] /api/users/:user_id

RESTRICTED ENDPOINT

Edit the user's phone_number and password only Need to send back username, phone_number, and password

*** Required information *** username phone_number password

{
    "username": "gabe",
    "password": "password",
    "phone_number": 7778675308
}
[DELETE] /api/users/:user_id

RESTRICTED ENDPOINT

Delete a user

{
    "message": "Sorry you hate plants."
}

front-end's People

Contributors

bukit3point0 avatar coderjonathan avatar danielbrannon avatar davedwight avatar michaelmcfaddenjr 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.