GithubHelp home page GithubHelp logo

anthrax3 / pointw.webapi.resourcemodel Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pointw-dev/pointw.webapi.resourcemodel

0.0 1.0 0.0 512 KB

An easy way to model resources in C# for use with ASP.NET Web Api without having to worry about how resources will be serialized into representations, like HAL, Collection+JSON and others.

License: GNU General Public License v2.0

C# 99.50% Shell 0.50%

pointw.webapi.resourcemodel's Introduction

PointW.WebApi.ResourceModel

** PLEASE NOTE: support for HAL is stable, but support for Collection+JSON is about 60% complete **

The goal of this project is to provide a simple abstraction for modelling resources, decoupled from formatting concerns. Your Web API application can model resources and not worry about representations or media types.

Through configuration your application will be able to support multiple media types, mixing and matching as you wish, without impacting the resource model. Through content negotiation your clients can pick supported media types they prefer.

In other words, you write this...

public class Person : Resource
{
  public string Name { get; set; }
  public string Address { get; set; }
  public string Phone { get; set; }
}  

...and your clients see this (application/hal+json)...

{
  "name": "John Doe",
  "address": "123 Main St.",
  "_links": {
    "self": {
      "href": "http://example.org/api/person/1"
    },
    "car": {
      "href": "http://example.org/api/car/1"
    }
  }
}

...or this (application/vnd.collection+json)...

{
  "collection": {
    "href" : "http://example.org/api/person"
    "items": [
      {
        "data": [
          { "name": "name", "value": "John Doe" },
          { "name": "address", "value": "123 Main St." },
        ],
        "href": "http://example.org/api/person/1",
        "links": [
          { "rel": "car", "href": "http://example.org/api/car/1" }
        ]
      }
    ]
  }
}

...or other representations.

Please see the wiki for more details.

pointw.webapi.resourcemodel's People

Contributors

biscuit314 avatar

Watchers

 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.