Giter VIP home page Giter VIP logo

bulbthings's Introduction

Bulb Things API

Getting Started

Prerequisites

Developing

Run following commands in app directory

  1. Run npm install to install server dependencies.
  2. Run bower install to install front-end dependencies.
  3. Run gulp serve to start the development server.

Build & development

  1. Run gulp build for building in app directory
  2. Run docker-compose up -d from main directory

Testing

Running npm test will run the unit tests with karma.

API

Base API url in development mode is: http://localhost:9000

Base API url in production mode is: http://localhost

Correct header apikey is 778b6b01-68ba-4156-970e-fd4fdb18c7dd

Allocation Service

Get All Allocations

Service url: /api/allocations

Method: GET

Example request: http://localhost/api/allocations

Filter Allocations

Service url: /api/allocations

Method: GET

Query Parameters: UserId, AssetId, allocated(true/false value)

Example request: http://localhost/api/allocations?AssetId=137&allocated=true

Create Allocation

Service url: /api/allocations

Method: POST

Example request: http://localhost/api/allocations

Example request body:

{
    "allocatedFrom": "2016-06-08T00:00:00.000Z",
    "allocatedTo": "2016-07-08T00:00:00.000Z",
    "AssetId": 36,
    "UserId": 15
}

Update Allocation

Service url: /api/allocations/:id

Method: PUT

Parameters: id

Example request: http://localhost/api/allocations/1

Example request body:

{
    "allocatedFrom": "2016-06-08T00:00:00.000Z",
    "allocatedTo": "2016-07-08T00:00:00.000Z"
}

Delete Allocation

Service url: /api/allocations/:id

Method: DELETE

Parameters: id

Example request: http://localhost/api/allocations/1

Asset Service

Get All Assets

Service url: /api/assets

Method: GET

Example request: http://localhost/api/assets

Get Single Asset

Service url: /api/assets/:id

Method: GET

Example request: http://localhost/api/assets/1

Create Asset

Service url: /api/assets

Method: POST

Example request: http://localhost/api/assets

Example request body:

{
    "name": "Kia Sportage",
    "TypeId": 1,
    "parameters": {
        "brand": "Kia",
        "model": "Sportage"
    }
}

Update Asset

Service url: /api/assets/:id

Method: PUT

Parameters: id

Example request: http://localhost/api/assets/1

Example request body:

{
    "parameters": {
        "brand": "Hyundai",
        "model": "ix35"
    }
}

Delete Asset

Service url: /api/assets/:id

Method: DELETE

Parameters: id

Example request: http://localhost/api/assets/1

Type Service

Get All Types

Service url: /api/types

Method: GET

Example request: http://localhost/api/types

Get Single Type

Service url: /api/types/:id

Method: GET

Example request: http://localhost/api/types/1

Create Type

Service url: /api/types

Method: POST

Example request: http://localhost/api/types

Example request body:

{
    "name": "Car",
    "attrs": ["brand", "model"]
}

Update Type

Service url: /api/types/:id

Method: PUT

Parameters: id

Example request: http://localhost/api/types/1

Example request body:

{
    "attrs": ["brand", "model", "productionYear"]
}

Delete Type

Service url: /api/types/:id

Method: DELETE

Parameters: id

Example request: http://localhost/api/types/1

User Service

Get All Users

Service url: /api/users

Method: GET

Example request: http://localhost/api/users

Get Single User

Service url: /api/users/:id

Method: GET

Example request: http://localhost/api/users/1

Create User

Service url: /api/users

Method: POST

Example request: http://localhost/api/users

Example request body:

{
    "firstName": "Marcin",
    "lastName": "Mrotek",
    "email": "[email protected]"
}

Update User

Service url: /api/users/:id

Method: PUT

Parameters: id

Example request: http://localhost/api/users/1

Example request body:

{
    "email": "[email protected]"
}

Delete User

Service url: /api/users/:id

Method: DELETE

Parameters: id

Example request: http://localhost/api/users/1

bulbthings's People

Contributors

abdizriel avatar

Watchers

James Cloos avatar  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.