Giter Site home page Giter Site logo

psychic-carnival's Introduction

Toggle API

Toggle API is the web service responsible for managing feature toggles within XPTO. This service maintains toggle values state, so that applications that consume it can have their values change dynamically.

API Documentation

The Toggle API is split into the two main resources it manages.

The first one is the toggle resource. A toggle is comprised of a name, a default boolean value and a persistence identifier.

The next one is the application override. An application override is used when a toggle is required to have a different value than the default, but only for a specific application. It is comprised of an application reference, a toggle identifier and a value for the toggle.

You can also make use of this Postman collection to interact with the service.

Toggles

Get all toggles

GET api/toggle
Successful response

Code: 200 OK

Content:

[
  {
    "id": 1,
    "name": "myToggle",
    "defaultValue": true
  },
  {
    "id": 2,
    "name": "otherToggle",
    "defaultValue": false
  }
]

Get toggle

GET api/toggle/{id}
Successful response

Code: 200 OK

Content:

{
  "id": 1,
  "name": "myToggle",
  "defaultValue": true
}
Unsuccessful response

Code: 404 Not Found

Create toggle

POST api/toggle

Content:

{
  "name": "feature",
  "defaultValue": true
}
Successful response

Code: 201 Created

Content:

{
  "id": 1,
  "name": "myToggle",
  "defaultValue": true
}

Update toggle

PUT api/toggle/{id}

Content:

{
  "id": 1,
  "name": "feature",
  "defaultValue": true
}
Successful response

Code: 204 No Content

Unsuccessful response

Code: 404 Not Found

Code: 400 Bad Request (usually when id differs from content and URL)

Delete toggle

DELETE api/toggle/{id}
Successful response

Code: 204 No Content

Unsuccessful response

Code: 404 Not Found

Application Overrides

Get all application overrides

GET api/application/{application}/toggle
Successful response

Code: 200 OK

Content:

[
  {
    "toggleId": 1,
    "toggleName": "feature1",
    "value": true
  },
  {
    "toggleId": 2,
    "toggleName": "myToggle",
    "value": true
  }
]

Get application override

GET api/application/{application}/toggle/{toggleId}
Successful response

Code: 200 OK

Content:

{
  "toggleId": 1,
  "toggleName": "myToggle",
  "value": true
}
Unsuccessful response

Code: 404 Not Found

Create application override

POST api/application/{application}/toggle

Content:

{
  "toggleId": 1,
  "toggleName": "myToggle",
  "value": true
}
Successful response

Code: 201 Created

Content:

{
  "toggleId": 1,
  "toggleName": "myToggle",
  "value": true
}

Update application override

PUT api/application/{application}/toggle/{toggleId}

Content:

{
  "toggleId": 1,
  "toggleName": "myToggle",
  "value": true
}
Successful response

Code: 204 No Content

Unsuccessful response

Code: 404 Not Found

Code: 400 Bad Request

Delete application override

DELETE api/application/{application}/toggle/{toggleId}
Successful response

Code: 204 No Content

Unsuccessful response

Code: 404 Not Found

Development

Toggle API is a .NET Core 2.0 application.

Requirements

Getting started

  • Clone/fork the repository
  • Build from source using dotnet build
  • Execute the tests using dotnet test
  • Run the application locally dotnet run --project src/ToggleApi/ToggleApi.csproj
  • Debug using your .NET IDE of choice

Future Improvements

  • Implement a basic authentication and authorisation mechanism, to ensure service users are recognised and have permissions to modify resources (for instance, using JSON Web Tokens).
  • Implement a push mechanism, so that toggle state consumers (the applications) can evolve from the polling nature of the current status quo. This could be achieved by publishing an event to a messaging service of choice (example: RabbitMQ), which applications would then consume.

psychic-carnival's People

Contributors

pedro-carneiro avatar

Stargazers

Joel Bastos avatar

Watchers

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