When exposing APIs, you need to throttle them. There are many methods available to do this, such as limiting the number of simultaneous users or limiting the number of calls within a given period of time, for example.
In this section, we are going to throttle our API. The method we will use to throttle our API will be to limit our API to run only once a month on the 25th of the month. Add the following line to yourappsettings.jsonfile:
"MorningstarNextRunDate": null,
This value will contain the date that the next API can be executed. Now, add theAppSettingsclass at the root of your project, and then add the following property:
public DateTime? MorningstarNextRunDate { get; set; }
This property will hold the value of theMorningstarNextRunDatekey. The next thing to do is to add our static method, which will be called to add or update an application setting in theappsetting.jsonfile:
public static void...