GithubHelp home page GithubHelp logo

fitcause-api's Introduction

To start, please run the following command:

rake db:setup

This will setup the database, tables, and a couple initial missions.

Notes: You have to have mongodb running.

To make testing way easier, use the Chrome Extension called Postman - REST Client chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm?hl=en

To test the API using Curl:

1. GET

Simple GET request that returns all missions:

curl -i -H "Accept: application/json" http://localhost:3000/api/v1/missions/
*Pick an id from the list. Store that mentally as {valid_id}

This can also accept a search based on the name parameters. For example:

curl -i -H "Accept: application/json" http://localhost:3000/api/v1/missions/?name=Goodwill

2. POST

Successful: (name, image and global points are all set)

curl --data "name=mediocrewill&image=mediocrewill.png&goal_points=10000000" http://localhost:3000/api/v1/missions/

Missing data: (name, image or global points not there)

curl --data "image=mediocrewill.png&current_points=0&goal_points=10000000" http://localhost:3000/api/v1/missions/

Not missing any parameters, but provided invalid data.

curl --data "name=&image=mediocrewill.png&current_points=0&goal_points=10000000" http://localhost:3000/api/v1/missions/

3. PUT

Sucessful: (Valid parameters and valid id)

curl -X PUT -d image=test http://localhost:3000/api/v1/missions/{valid_id}

Can’t find ID:

curl -X PUT -d image=test http://localhost:3000/api/v1/missions/123

Can find ID but invalid parameters.

curl -X PUT -d name="" http://localhost:3000/api/v1/missions/{valid_id}

4. DELETE

Successful:

curl -X DELETE "http://localhost:3000/api/v1/missions/{valid_id}"

Can’t find the id to delete:

curl -X DELETE "http://localhost:3000/api/v1/missions/1123"

fitcause-api's People

Contributors

bennycwong avatar

Watchers

Mike Ni avatar James Cloos avatar Russell M.  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.