Coder Social home page Coder Social logo

toby2o12 / dalsoft.restclient Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dalsoft/dalsoft.restclient

0.0 1.0 0.0 638 KB

The dynamic REST Client - the world's fastest REST Client :)

Home Page: http://dalsoft.co.uk/blog

License: MIT License

C# 100.00%

dalsoft.restclient's Introduction

DalSoft.RestClient

Help and chat on Gitter

Inspired by Simple.Data and AngularJS's $http service, DalSoft.RestClient is a very lightweight wrapper around System.Net.HttpClient that uses the dynamic features of .NET 4 to provide a fluent way of accessing RESTFul API's.

Originally created to remove the boilerplate code involved in creating integration tests and SDK's for RESTFul API's. I know there are a couple of dynamic rest clients out there but I wanted the syntax to look a particular way, and I wanted it to be particularly useful for testing.

DalSoft.RestClient is biased towards RESTFul API's returning JSON - if you don't provide Accept and Content-Type headers then they are set to application/json. See Working with non JSON content

Supported Platforms

DalSoft.RestClient targets .NET Standard 1.4 therefore supports Windows, Linux, Mac and Xamarin (iOS, Android and UWP).

Getting Started

Install via NuGet

PM> Install-Package DalSoft.RestClient

You start by new'ing up the RestClient and passing in the base uri for your RESTful API. Then simply chain members that would make up the resource you want to access - ending with the HTTP method you want to use. The example below will perform a GET on http://jsonplaceholder.typicode.com/users/:

dynamic client = new RestClient("http://jsonplaceholder.typicode.com");

await client.Users.Get();

Note all HTTP methods are async

New in Version 3.0 Pipeline Awesomeness!

See Configuration, Plugins and Pipeline

Breaking Change Since Version 3.1

Since version 3.1 the DefaultRequestHeaders Dictionary is readonly the only way to add DefaultHeaders is passing a Dictionary to the constructor. You can add/override the headers on a per request basis using the Headers method.

client.DefaultRequestHeaders.Add("Accept", "application/json"); //Not supported since version 3.1

Everything You Need To Know

Advanced

Standing on the Shoulders of Giants

DalSoft.RestClient is built using the following great open source projects:

DalSoft.RestClient is inspired by and gives credit to:

dalsoft.restclient's People

Contributors

dalsoft avatar joakimjm 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.