List of Posts
This is the complete list of categories of posts written during Jun 2022. They have been ordered by the publish date, with the most recent first.
- Published: 01-Jun-2022Http Repl is a command-line tool for testing web api. This tool targets the ASP.NET Core environment. Let's have a look at a brief introduction to this tool. We will also learn how to activate it in visual studio. And in the coming tutorials we shall use it to make a few web api calls.
- Published: 01-Jun-2022Before we can execute and test any web api, we have to establish a connection between httprepl and our web server. If you are following this chapter, then you must have observed that each of our route templates starts with the segment "doctor". Technically, it is called an end-point. The objective of this tutorial is to learn how to connect to a server, and how to get a list of available endpoints, and how to finally navigate to a specific endpoint - which is "doctor" in our case. In the coming tutorials we shall make calls to the various types of web api that we have already added to our web api project.
- Published: 03-Jun-2022Now its time to use httprepl for testing our web api. To begin with, we shall test a GET api. I shall assume that your httprepl is installed and ready. If things appear difficult, then you may have to go through the previous two tutorials for learning the basics of httprepl.
- Published: 04-Jun-2022In this tutorial we shall test a POST Web Api - and create a new record. So we shall have to first establish a connection between httprepl and our web server, and, then we will have to post the json for the new record that we have to create on the server. Let's see how!
- Published: 04-Jun-2022X and Y are two points in a river. Points P and Q divide the straight line XY into three equal parts. River is flowing along XY and the time taken by the boat to row from X to Q and from Y to Q are in the ratio 4 : 5. The ratio of the speed of the boat downstream to the speed of the current is?
- Published: 05-Jun-2022Write Lewis symbols for the following atoms and ions: S and S2-; Al and Al3+; H and H-
- Published: 17-Jun-2022So far, we have been writing all our minimal web api in the program.cs file. But this can become un-manageable and un-readable in a full blown project. We need a scheme for organizing our web api so that they can stay in a class of their own, inside a file of their own. We can even have a possibility of multiple classes - with each class containing all the related web api - those of a doctor in one file, whereas those of a patient in another. In this tutorial we have a brief look at the various possibilities, and finally I show an implementation of the scheme that I personally prefer.
- Published: 22-Jun-2022We have been obtaining our web api parameters from route templates. A route is not the only source of parameters - in fact the parameters can be obtained from a query string, header values and from the body of the request also. In this tutorial we examine how to obtain the parameters from a query string variable, and how to set the parameter as optional.
- Published: 24-Jun-2022Parameters of a web api can be obtained from the values in a request header also. For this an attribute called "FromHeader" is used to decorate a parameter, and it provides an easy access to the value contained in the header of that name. In this tutorial we shall learn how to bind a header to a web api parameter. For continuity please go through the previous tutorial where we saw how to bind a query string variable to a parameter.
- Published: 25-Jun-2022ASP.NET Core provides certain "special" parameters that are always available to an api handler. These parameters are "utility" parameters like HttpContext, HttpRequest, HttpResponse, CancellationToken and ClaimsPrincipal. They do not need any attribute decorations like those for the query-string, header, body and route segments.
- Published: 27-Jun-2022Consider a web api that extracts parameters x, y and z from its query string and then uses these values to construct a Point object, say for example, by passing these data to a constructor of the Point class. This program can be made more readable by passing a single string of a comma separated list of three numbers, and then have that string directly parsed into a Point object. This technique of customized binding is the subject matter of this tutorial.
- Published: 29-Jun-2022If you already know of the Task type, and have now happened to meet a similar looking ValueTask, then you are likely interested in knowing more about these types, and this article is my attempt at a quick explanation of the relation between ValueTask and Task types.