Tuesday, August 24, 2021

.NET REST Integration

Of course, I need to cover off the other web services practice, RESTful.

Building the API is pretty simple, using something like https://restunited.com/

Just plug in the JSON requests and let rest united generate all of the entities and clients for you!

Obviously, it is useful to have a guide that describes the RESTful service and provides examples, e.g. https://hotdocsadvance.com/api/rest/documentation/index.html

Then it is just a simple matter of calling the API from your c# code, e.g.

            ServicesApi serviceAPI = new ServicesApi();
            ServiceListResponse ServiceListResponse =
                serviceAPI.SearchServices(headerValue, parameter1, parameter2);
            List<Results> results = ServiceListResponse.Results;

There are a few tips that are useful for setting up the endpoints in rest united, that I will cover off in another post.