1

I have an application that will be consuming several REST APIs by a number of third parties and I am tossing up between using HttpClient and ServiceStack.Client to consume them.

I'd love to stay unified and use ServiceStack.Client, but I'm not sure if it's targeted more to support the patterns & practices of a ServiceStack REST API or whether it is flexible enough to be used to consume any arbitrary HTTP REST API.

Specifically, the APIs I am consuming have their own custom authentication methods (not basic or digest etc) and require the client to accept cookies. Is ServiceStack.Client appropriate to use in these scenarios?

Sebastian Nemeth
  • 5,505
  • 4
  • 26
  • 36
  • 1
    Sounds like a [duplicate of this question](http://stackoverflow.com/a/10118120/85785), i.e. Whilst it may be suitable for a lot of use-cases, I don't recommend using the ServiceClients for consuming 3rd Party APIs, you can use something like [HTTP Utils](https://github.com/ServiceStack/ServiceStack/wiki/Http-Utils) instead/ – mythz May 06 '14 at 22:47

1 Answers1

1

Following on from what @mythz said, I ended up using the ServiceStack HTTP Utils library.

To handle cookies and custom authentication requirements, I hooked the 'requestFilter' parameter that is available in most of the extension methods, to manipulate the post's header prior to it being sent. It's just a simple Action.

It's covered my needs quite well and been quite elegant.

Sebastian Nemeth
  • 5,505
  • 4
  • 26
  • 36