csharp

Externe REST services aanroepen met Refit

Dit artikel werd eerder gepubliceerd in het SDN Magazine. Je kunt je bijna geen applicatie meer voorstellen die geen gebruik maakt van externe gegevens. Vaak komt deze data uit REST Api’s1. Als developer kan het behoorlijk saai zijn om de zoveelste API te moeten ontsluiten maar gelukkig zijn er mogelijkheden om dit een stuk eenvoudiger te maken. Één van die opties is het gebruik van Refit2. Om te laten zien hoe je met behulp van Refit2 een API aan kunt roepen gebruik ik een een voorbeeeld API met een 5-tal methodes.

Arrowhead anti-pattern challenge

update (2019-11-08): added a bonus contribution from Bob, written in prolog Just recently I had to work on a huge flow-chart to determine farm types based on the animal transports to and from farm locations. I started out with a small proof of concept but didn’t like the way it turned out. I did some research and learned I was basically creating a so called arrow head (“Arrowhead” anti-pattern ).

Retry and fallback policies in C# with Polly

In this blog I will try to explain how one can create clean and effective policies to retry API calls and have fallbacks when requests are failing. With Polly it is possible to create complex and advanced scenarios for error handling with just a few lines of code. This week I was connecting an eCommerce web application to an ERP system with REST APIs. There are multiple endpoints, all authenticated with OAuth.