Giter VIP home page Giter VIP logo

dunstan's Introduction

DUNSTAN API GUIDE

Accounts API

Sign up

POST: /api/v1/account/sign_up

parameters accepted
  door_name           String *
  email               String *
  phone_number        String *
  keypad_code         String *
  password            String *

  curl \
    -F "door_name=room1" \
    -F "[email protected]" \
    -F "password=asdfasdf" \
    -F "phone_number=+8613050387411" \
    -F "keypad_code=11-214" \
    http://localhost:5000/api/v1/account/sign_up
  results:
  {"status": 1, "data":"sent notification to the phone_number"}

Sign in

POST: /api/v1/account/sign_in

parameters accepted
  phone_number        String *
  password            String *

  curl \
    -F "password=asdfasdf" \
    -F "phone_number=+8613050385446" \
    http://localhost:5000/api/v1/account/sign_in
  results:
  {"status": 1, "data":{token: string}}

Update Email

POST: /api/v1/account/update_email

parameters accepted
  token                   String *
  old_email               String *
  new_email               String *

  curl \
    -F "token=7GbxtN9-NDcLARjE30Jfvamh9iP5NbvykhTfoSBAAZU" \
    -F "[email protected]" \
    -F "[email protected]" \
    http://localhost:5000/api/v1/account/update_email
  results:
  {status: 1, data: "Updated email successfully"}

Update Password

POST: /api/v1/account/update_password

parameters accepted
  token               String *
  old_password        String *
  new_password        String *

  curl \
    -F "token=7GbxtN9-NDcLARjE30Jfvamh9iP5NbvykhTfoSBAAZU" \
    -F "old_password=tester1" \
    -F "new_password=test1" \
    http://localhost:5000/api/v1/account/update_password
  results:
  {status: 1, data: "Updated password successfully"}

Get all security questions

GET: /api/v1/account/security_questions
  Parameters accepted
  Results
    {status: 1, data: [{id, question}, {...}]}

Answer

POST: /api/v1/account/security_answer

parameters accepted
  token               String *
  question_id         Integer *
  answer              String *

  curl \
    -F "token=qMoSX7-6S5gTIiInRY0f4d5uutPEvSmv6-RL8eZnmDo" \
    -F 'answers=[{"question_id":1,"answer":"test111"},{"question_id":2,"answer":"test222"}]' \
    http://localhost:5000/api/v1/account/security_answer
  results:
  {status: 1, data: {answer_id: answer.id}}

Get doors

GET: /api/v1/account/doors
  Parameters accepted
    token               String *
  Results
    {status: 1, data: [{id,number,code,stat,name},{...}}]}

Get admin doors

GET: /api/v1/account/admin_doors
  Parameters accepted
    token               String *
  Results
    {status: 1, data: [{id,number,code,stat},{...}}]}

Get Users

GET: /api/v1/account/users
  Parameters accepted
    token               String *
    keypad_code         String *
  Results
    {status: 1, data: [{id, first_name, last_name, phone_number}, {...}]}

Invite user

  Invite user
  POST: /api/v1/account/invite
    Parameters accepted
      token               String *
      phone_number        String *
      email               String *
      first_name          String *
      last_name           String *
      keypad_code         String *
  Results
      {status: 1, data: successfully invited user}
EX:
curl \
  -F "token=M-io2Wq4pLv5eM74vDaOVuByZrdswlNrmKfLwNZnYek" \
  -F "phone_number=+8613050387422" \
  -F "keypad_code=11-214" \
  -F "[email protected]" \
  -F "first_name=Tester" \
  -F "last_name=tester3" \
  http://localhost:5000/api/v1/account/invite

Delete User

POST: /api/v1/account/delete_user
  Parameters accepted
    token               String *
    keypad_code         String *
    phone_number        String *
  Results
    {status: 1, data: [{id,number,code,stat},{...}}]}

Get door status

GET: /api/v1/accounts/door_status
  Parameters accepted
    token               String *
    keypad_code         String *
  Results
    {status: 1, data: door_status}

Delete admin doors

POST: /api/v1/account/delete_doors
  Parameters accepted
    token               String *
    keypad_codes        String *
  Results
    {status: 1, data: "Deleted doors"}

Keypad API

On, Off Door

POST: /api/v1/keypads/door_lock
  Parameters accepted
    token               String *
    keypad_code         String *
    keypad_password     String *
    open                Boolean *
  Results
    {status: 1, data: door_status}
curl \
  -F "token=M-io2Wq4pLv5eM74vDaOVuByZrdswlNrmKfLwNZnYek" \
  -F "keypad_code=11-214" \
  -F "keypad_password=asdfasdf" \
  -F "open=true" \
  http://localhost:5000/api/v1/keypads/door_lock
results:
  {status: 1, data: {answer_id: answer.id}}

Door bell

POST: /api/v1/keypads/door_bell
  Parameters accepted
    token               String *
    keypad_code         String *
    keypad_password     String *
    bell                Boolean *
  Results
    {status: 1, data: door_status}
curl \
  -F "token=hS3UEw4PsYzcpoCtb8vCTXqv87EmlTY59Fjbzl8zJ7I" \
  -F "keypad_code=123" \
  -F "keypad_password=asdfasdf" \
  -F "bell=true" \
  http://localhost:5000/api/v1/keypads/door_bell
results:
  {status: 1, data: {answer_id: answer.id}}

Door block

POST: /api/v1/keypads/door_block
  Parameters accepted
    token               String *
    keypad_code         String *
    keypad_password     String *
    block               Boolean *
  Results
    {status: 1, data: door_status}
curl \
  -F "token=hS3UEw4PsYzcpoCtb8vCTXqv87EmlTY59Fjbzl8zJ7I" \
  -F "keypad_code=123" \
  -F "keypad_password=asdfasdf" \
  -F "block=true" \
  http://localhost:5000/api/v1/keypads/door_block
results:
  {status: 1, data: {answer_id: answer.id}}

Door status

POST: /api/v1/keypads/door_status
  Parameters accepted
    token               String *
    keypad_code         String *
    keypad_password     String *
    status                Boolean *
  Results
    {status: 1, data: door_status}
curl \
  -F "token=hS3UEw4PsYzcpoCtb8vCTXqv87EmlTY59Fjbzl8zJ7I" \
  -F "keypad_code=123" \
  -F "keypad_password=asdfasdf" \
  -F "status=true" \
  http://localhost:5000/api/v1/keypads/door_status
results:
  {status: 1, data: {answer_id: answer.id}}

Get door picture

GET: /api/v1/keypads/door_picture
  Parameters accepted
    token               String *
    keypad_code         String *
    keypad_password     String *
    view                Boolean *
  Results
    {status: 1, data: door_status}

dunstan's People

Stargazers

 avatar

Watchers

Full-Stack & Web Developer 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.