Consume RESt API from .NET

前端 未结 4 933
天涯浪人
天涯浪人 2021-01-31 06:16

I am trying to consume REST API from my .NET Application. This API\'s are all written in JAVA. I am asked to pass the authentication credentials vis HTTP headers. How can I pass

4条回答
  •  温柔的废话
    2021-01-31 06:56

    Despite its somewhat misleading name, ADO.NET Data Services (which is part of .NET 3.5) contains APIs for both exposing and consuming REST-based services. In your case you can safely ignore the part that allows you to expose services and concentrate on the client part.

    It supports LINQ and all sorts of goodness, allowing you to query your REST service like this:

    var selectedOrders = from o in context.Orders
                         where o.Freight > 30
                         orderby o.ShippedDate descending 
                         select o;
    

    There's more about it here. Give it a try - I've been pretty happy with it so far.

提交回复
热议问题