Git Product home page Git Product logo

weilin's Introduction

BigSkirmish API

Register to Obtain API Key

All requests must have the "API-KEY" header to be permitted. If you do not have an API Key you can obtain one at www.bigskirmish.com/developer/register.

Authentication With API Key

All request have an API Key header that is passed like this:

`"API-KEY: your_api_key"

If you do not have an API Key header, with a valid API Key as the value, your request will respond back with a 404 status.

Endpoints

Create User

REQUEST

HTTP Method: POST
HEADERS:"API-KEY: your_api_key"
URL Endpoint: /users
Body:

{"first_name":"Walter",
 "last_name":"White",
 "username":"heisenberg",
 "email":"[email protected]",
 "password":"a_secure_password"
}

RESPONSE

HTTP Status Code: 201

{"user":
   {"id":1,
    "first_name":"Walter",
    "last_name":"White",
    "username":"heisenberg",
    "email":"[email protected]",
    "token":"39cb0516-687GHE0194730f-4e8a-fd2b24835dd"
   }
}

Authenticate User

REQUEST

HTTP Method: POST
HEADERS:"API-KEY: your_api_key"
URL Endpoint: /users/authenticate
Body:

{"login":"your_email_address",
 "password":"a_secure_password"
}

RESPONSE

HTTP Status Code: 200

{"user":
   {"id":1,
    "first_name":"Walter",
    "last_name":"White",
    "username":"heisenberg",
    "email":"[email protected]",
    "token":"39cb0516-687GHE0194730f-4e8a-fd2b24835dd"
   }
}

Note: "login" is the field because at some point this will accept a username or an email address. Currently only email is supported

Show User

REQUEST

HTTP Method: GET
Headers: "Authorization:Token token='39cb0516-687GHE0194730f-4e8a-fd2b24835dd'"
URL Endpoint: /users/:user_id
Body: no body

RESPONSE

HTTP Status Code: 200

{"user":
   {"id":1,
    "first_name":"Walter",
    "last_name":"White",
    "username":"heisenberg",
    "email":"[email protected]",
    "token":"39cb0516-687GHE0194730f-4e8a-fd2b24835dd"
   }
}

Create War

HTTP Method: GET
Headers: "Authorization:Token token='39cb0516-687GHE0194730f-4e8a-fd2b24835dd'"
URL Endpoint:/users/:user_id/wars
Body:

{"war":
  {"name":"Darts",
   "has_end":true,
   "ending_date":1406786400,
   "ending_score":4,
   "prize":"Loser buys dinner",
   "is_private":false,
   "open_registration":false
  }
}

First Time Registrant:

  • Requests have API Key
  • Registers by passing username/password
  • Writes to token for user
    • Token is passed back in create response
  • Next requests have API Key header and Authorization Header for token

All Subsequent Uses:

  • Enters username/password and reads user token for session
  • Pass user token from then on out to register.
  • If user logs out it sets the token to nil

weilin's People

Contributors

mattcantstop avatar

Watchers

James Cloos avatar

weilin's Issues

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.