{"id":1754,"date":"2021-09-14T11:40:33","date_gmt":"2021-09-14T11:40:33","guid":{"rendered":"https:\/\/www.reloadly.com\/blog\/?p=1754"},"modified":"2021-10-05T11:35:21","modified_gmt":"2021-10-05T11:35:21","slug":"deploying-an-airtime-api-via-command-line-and-asp-net","status":"publish","type":"post","link":"https:\/\/blog.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/","title":{"rendered":"Deploying an airtime API via command line and ASP .NET"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_46 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"ez-toc-toggle-icon-1\"><label for=\"item-69ed5d0bad4b0\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><svg style=\"fill: #000000;color:#000000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #000000;color:#000000\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/label><input  type=\"checkbox\" id=\"item-69ed5d0bad4b0\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-visibility-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blog.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#Prerequisites_for_this_tutorial\" title=\"Prerequisites for this tutorial\">Prerequisites for this tutorial<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blog.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#Getting_Started_with_NET\" title=\"Getting Started with .NET\">Getting Started with .NET<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blog.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#Getting_started_with_Reloadlys_Airtime_API\" title=\"Getting started with Reloadly\u2019s Airtime API\">Getting started with Reloadly\u2019s Airtime API<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blog.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#Working_with_NET_classes_and_methods\" title=\"Working with .NET classes and methods\">Working with .NET classes and methods<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blog.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#Summary\" title=\"Summary\">Summary<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>Recent trends in software development have shown that APIs are the best option for enabling cross-communication between apps, end-users, and other apps. Tons of data can be wrapped around an API and extended via a single endpoint. Often interfaces are needed to interact with an API and these interfaces have to be user-friendly. However, situations may arise where a user-friendly interface cannot be put together or isn\u2019t needed as stated by existing use cases. <\/p>\n\n\n\n<p>Thus it\u2019s important to know how to communicate with APIs in other ways \u00a0\u2014 \u00a0one of which is the command-line interface. In this tutorial, you will use Reloadly\u2019s airtime API and the ASP .NET framework to learn how to deploy REST APIs through a command-line interface.\u00a0<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Prerequisites_for_this_tutorial\"><\/span>Prerequisites for this tutorial<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul><li>Intermediate knowledge of C#. You can get started <a target=\"_blank\" href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/tour-of-csharp\/tutorials\/\" rel=\"noreferrer noopener\">here<\/a><\/li><li>.NET SDK 5.0 or later \u2014 this can be found with installation instructions <a target=\"_blank\" href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/5.0\" rel=\"noreferrer noopener\">here<\/a><\/li><li>An open-source, cross-platform code editor such as <a target=\"_blank\" href=\"https:\/\/code.visualstudio.com\/\" rel=\"noreferrer noopener\">VS Code<\/a><\/li><li><a href=\"https:\/\/www.newtonsoft.com\/json\">Newtonsoft<\/a> &nbsp;\u2014 a high performant JSON framework for .NET applications<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Getting_Started_with_NET\"><\/span>Getting Started with .NET<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The first step to working with the .NET framework is to create a new application. Navigate to the command line of your code editor and &nbsp;use the &nbsp;<code>dotnet new console<\/code> &nbsp;command to create a new application:<\/p>\n\n\n\n<div style=\"height:21px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>dotnet new console --name WebAPIClient<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Once this is done, navigate to the newly created &nbsp;WebAPIClient application directory and install Newtonsoft. Once this is done, run the application:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>cd WebAPIClient\n\ndotnet add package Newtonsoft.Json --version 13.0.1\n\ndotnet run<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>At this point, all there is to your application is a function that prints the phrase <strong>&#8220;Hello World&#8221;<\/strong>. The next section will show how you can improve things by adding more functionality to your app.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Getting_started_with_Reloadlys_Airtime_API\"><\/span>Getting started with Reloadly\u2019s Airtime API<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>To make an airtime recharge through Reloadly\u2019s API, you\u2019ll need an access token. You can get this by signing up for an account on Reloadly and using your client credentials to make a POST request for an access token. On your Reloadly dashboard, you can view your client credentials in the Developers section as shown below:<\/p>\n\n\n\n<p>To make an airtime recharge through Reloadly\u2019s API, you\u2019ll need an access token. You can get this by <a href=\"https:\/\/www.reloadly.com\/registration\" target=\"_blank\" rel=\"noreferrer noopener\">signing up for an account<\/a> on Reloadly and using your client credentials to make a POST request for an access token. On your Reloadly dashboard, you can view your client credentials in the <strong>Developers<\/strong> section as shown below:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"354\" src=\"https:\/\/www.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/image-7-1024x354.png\" alt=\"\" class=\"wp-image-1780\" srcset=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/image-7-1024x354.png 1024w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/image-7-300x104.png 300w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/image-7-768x265.png 768w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/image-7-1536x531.png 1536w, https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/image-7.png 1667w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption><em>An image that describes how to obtain your credentials on Reloadly&#8217;s dashboard<\/em><\/figcaption><\/figure>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Next, use these credentials to make a POST request to the <a rel=\"noreferrer noopener\" target=\"_blank\" href=\"https:\/\/auth.reloadly.com\/oauth\/token\">https:\/\/auth.reloadly.com\/oauth\/token<\/a> URL with the following properties:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n  \"client_id\":\"YOUR_CLIENT_ID\",\n  \"client_secret\":\"YOUR_CLIENT_SECRET\",\n  \"grant_type\":\"client_credentials\",\n  \"audience\":\"https:\/\/topups.reloadly.com\"\n}<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>You can do this via Postman or any other tool. Personally, I would recommend <a target=\"_blank\" href=\"https:\/\/reqbin.com\/\" rel=\"noreferrer noopener\">ReqBin<\/a>, an online testing tool for REST APIs. <\/p>\n\n\n\n<p>A successful response containing your access token would be similar to the code snippet below:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"access_token\": \"eyJraWQiOiIwMDA1YzFmMC0xMjQ3LTRmNmUtYjU2ZC1jM2ZkZDVmMzhhOTIiLCJ0e      XAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI2ODkzIiwiaXNzIjoiaHR0cHM6Ly9yZWxvYWRse      S5hdXRoMC5jb20vIiwiaHR0cHM6Ly9yZWxvYWRseS5jb20vc2FuZGJveCI6ZmFsc2UsImh0dHBzOi8vcm      Vsb2FkbHkuY29tL3ByZXBhaWRVc2VySWQiOiI2ODkzIiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIiw      iYXVkIjoiaHR0cHM6Ly90b3B1cHMtaHMyNTYucmVsb2FkbHkuY29tIiwibmJmIjoxNjI3OTk4NDQzLCJh      enAiOiI2ODkzIiwic2NvcGUiOiJzZW5kLXRvcHVwcyByZWFkLW9wZXJhdG9ycyByZWFkLXByb21vdGlvb      nMgcmVhZC10b3B1cHMtaGlzdG9yeSByZWFkLXByZXBhaWQtYmFsYW5jZSByZWFkLXByZXBhaWQtY29tbW      lzc2lvbnMiLCJleHAiOjE2MzMxODI0NDMsImh0dHBzOi8vcmVsb2FkbHkuY29tL2p0aSI6Ijg1YjMwYmF      iLTIzYjUtNDUxMy04NDUwLWMxMzQ1ZDA0NmE0ZiIsImlhdCI6MTYyNzk5ODQ0MywianRpIjoiYThhOTIy      MjAtYzRlNS00M2MyLWE4NTctNjRkMjhlNzU5OWRhIn0.cAAGo4h0R3lPetkRpKATkwdHdS1bM791-vxgccEa9T4\",\n    \"scope\": \"send-topups read-operators read-promotions read-topups-history read-prepaid-balance read-prepaid-commissions\",\n    \"expires_in\": 5184000,\n    \"token_type\": \"Bearer\"\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Working_with_NET_classes_and_methods\"><\/span>Working with .NET classes and methods<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Your application when complete should be able to do the following:<\/p>\n\n\n\n<ul><li>Receive details such as a mobile phone number, operator ID, and recharge amount as input<\/li><li>Make an HTTP POST request to Reloadly\u2019s API with the received details and share a response in the command line<\/li><\/ul>\n\n\n\n<p>To begin, you\u2019ll instantiate .NET\u2019s &nbsp;<code>Main<\/code> method. The <code>Main<\/code> method serves as an entry point for every .NET application. You will also create an asynchronous method that will define the API request you\u2019re going to make. Navigate to the &nbsp;<code>Program<\/code> &nbsp;class in your application\u2019s folder and create the asynchronous method alongside the &nbsp;<code>Main<\/code> method:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\/ Program.cs\n\nnamespace WebAPIClient {\n  class Program {\n    static async Task Main(string&#91;] args) {\n      await ApiCall();\n    }\n\n    private static async Task ApiCall() {\n  \n    }\n  }\n}<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Next, create an instance of an object that contains details of the airtime recharge you are going to make. This can be done via Newtonsoft\u2019s &nbsp;<code>JsonConvert<\/code> &nbsp;class which provides a method for converting between .NET types and JSON types:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\/ Program.cs\n\nnamespace WebAPIClient {\n  class Program {\n    static async Task Main(string&#91;] args) {\n      await ApiCall();\n    }\n\n    private static async Task ApiCall() {\n    \/\/...\n\n       var json = JsonConvert.SerializeObject(new {\n              operatorId = \"341\",\n              amount = \"20\",\n              customIdentifier = \"airtime-recharge\",\n              recipientPhone = new {\n                countryCode = \"NG\", \n                number = \"08147628727\"\n              }\n          });\n    \/\/...\n  \n    }\n  }\n}<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In the code snippet above, the details for the airtime recharge to be made using Reloadly\u2019s Airtime API were defined in a JSON object. Here\u2019s a brief summary of what each property represents:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Property<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td><code>amount<\/code><\/td><td>This indicates the amount to be recharged<\/td><\/tr><tr><td><code>operatorId<\/code><\/td><td>This indicates the mobile number\u2019s operator ID<\/td><\/tr><tr><td><code>countryCode<\/code><\/td><td>This is the country code of the mobile number to be recharged<\/td><\/tr><tr><td><code>number<\/code><\/td><td>This is the mobile number that is to be recharged<\/td><\/tr><tr><td><code>customIdentifier<\/code><\/td><td>This is a unique transaction reference that is to be assigned to a recharge<\/td><\/tr><tr><td><code>recipientPhone<\/code><\/td><td>This represents an object that contains the details of the mobile number to be recharged<\/td><\/tr><tr><td><\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div style=\"height:51px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>After this, include the endpoint that will be used to make the HTTP POST request in your application. You can do this by using the &nbsp;<code>HttpRequestMessage<\/code> class which represents an HTTP request message in .NET applications. The request can be instantiated as shown in the code snippet below:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\/ Program.cs\n\nnamespace WebAPIClient {\n  class Program {\n    static async Task Main(string&#91;] args) {\n      await ApiCall();\n    }\n\n    private static async Task ApiCall() {\n    \/\/...\n\n       var json = JsonConvert.SerializeObject(new {\n              operatorId = \"341\",\n              amount = \"20\",\n              customIdentifier = \"airtime-recharge\",\n              recipientPhone = new {\n                countryCode = \"NG\", \n                number = \"08147628727\"\n              }\n          });\n       var message = new HttpRequestMessage(HttpMethod.Post, \"https:\/\/topups.reloadly.com\/topups\"){\n            Content = new StringContent(json, Encoding.UTF8, \"application\/json\")\n          };\n    \/\/...\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In the code snippet above, an HTTP POST request was instantiated using the &nbsp;https:\/\/topups.reloadly.com\/topups &nbsp;endpoint. The content type to be expected as a response was also specified using the &nbsp;<code>StringContent<\/code> &nbsp;class.&nbsp;<br>Once this is done, the next step is to authorize the HTTP request. This is done by including the access token gotten when you signed up for an account on Reloadly. The access token can be included in the HTTP request header as shown in the code snippet below:<\/p>\n\n\n\n<div style=\"height:21px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\/ Program.cs\n\nnamespace WebAPIClient {\n  class Program {\n    static async Task Main(string&#91;] args) {\n      await ApiCall();\n    }\n\n    private static async Task ApiCall() {\n    \/\/...\n\n       var json = JsonConvert.SerializeObject(new {\n              operatorId = \"341\",\n              amount = \"20\",\n              customIdentifier = \"airtime-recharge\",\n              recipientPhone = new {\n                countryCode = \"NG\", \n                number = \"08147628727\"\n              }\n          });\n      var message = new HttpRequestMessage(HttpMethod.Post, \"https:\/\/topups.reloadly.com\/topups\"){\n            Content = new StringContent(json, Encoding.UTF8, \"application\/json\")\n          };\n     message.Headers.TryAddWithoutValidation(\"Authorization\", \"Bearer ACCESS_TOKEN\");\n     message.Headers.TryAddWithoutValidation(\"Accept\", \"application\/com.reloadly.topups-v1+json\");\n    \/\/...\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>In the code snippet above, the &nbsp;<code>TryAddWithoutValidation<\/code> &nbsp;method is used to add the following values to the request\u2019s header:<\/p>\n\n\n\n<ul><li>The <code>Authorization<\/code> &nbsp;header which includes the access token&nbsp;<\/li><li>The <code>Accept<\/code> &nbsp;header which specifies the response types that are acceptable from Reloadly\u2019s servers.<\/li><\/ul>\n\n\n\n<p>Now you\u2019re done configuring your request, the next thing to do is refine the data format of the response you\u2019ll get from Reloadly. To achieve this, you will use a combination of .NET and Newtonsoft methods:<\/p>\n\n\n\n<ul><li><code>HttpClient()<\/code> : For making HTTP requests<\/li><li><code>SendAsync()<\/code> : &nbsp;For sending HTTP requests as an asynchronous operation<\/li><li><code>ReadAsStringAsync()<\/code> : &nbsp;Serializing HTTP content to a string as an asynchronous operation<\/li><li><code>JsonConvert<\/code> : &nbsp;Newtonsoft method that converts your API response to JSON<\/li><li><code>DeserializeObject<\/code> : &nbsp;Newtonsoft method that deserializes JSON to an object<\/li><li><code>Console.WriteLine()<\/code> : For writing the response to the standard output stream&nbsp;<\/li><\/ul>\n\n\n\n<p>The code snippet below shows how you can combine these methods to retrieve, parse and display the response gotten from Reloadly\u2019s servers:<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\/ Program.cs\n\nnamespace WebAPIClient {\n  class Program {\n    static async Task Main(string&#91;] args) {\n      await ApiCall();\n    }\n\n    private static async Task ApiCall() {\n    \/\/...\n\n       var json = JsonConvert.SerializeObject(new {\n              operatorId = \"341\",\n              amount = \"20\",\n              customIdentifier = \"airtime-recharge\",\n              recipientPhone = new {\n                countryCode = \"NG\", \n                number = \"08147628727\"\n              }\n          });\n      var message = new HttpRequestMessage(HttpMethod.Post, \"https:\/\/topups.reloadly.com\/topups\"){\n            Content = new StringContent(json, Encoding.UTF8, \"application\/json\")\n          };\n      message.Headers.TryAddWithoutValidation(\"Authorization\", \"Bearer ACCESS_TOKEN\");\n      message.Headers.TryAddWithoutValidation(\"Accept\", \"application\/com.reloadly.topups-v1+json\");\n\n      using\n          var httpClient = new HttpClient();\n          var response = await httpClient.SendAsync(message);\n          var responseBody = await response.Content.ReadAsStringAsync();\n          var result = JsonConvert.DeserializeObject &lt; dynamic > (responseBody);\n          Console.WriteLine(result);\n    }\n  }\n}\n<\/code><\/pre>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Your application should be complete now. Navigate to your command line and run the application with the&nbsp;<code>dotnet<\/code> run command. Your result should be similar to what\u2019s in the video clip below:<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"deploying_dotnet_airtime_api\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/nFbHkHzDBb0?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><figcaption><em><sub>A video depicting how to make airtime top-ups via the command line when working with a .NET application<\/sub><\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this tutorial, you learned how useful the .NET framework is in providing options when working with REST APIs. You also learned how to add and work with inbuilt .NET methods and dependency methods as well. Should you need to take a look at the full codebase of the application used in this tutorial, you can find it on <a target=\"_blank\" href=\"https:\/\/github.com\/Reloadly\/dotnet-airtime-sample-application\" rel=\"noreferrer noopener\">GitHub<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When building an airtime service with an API, it\u2019s important to know how to communicate with APIs in other ways. <\/p>\n","protected":false},"author":17,"featured_media":1775,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[274],"tags":[11,281,282,280,275],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Deploying an airtime API via command line and ASP .NET - Reloadly<\/title>\n<meta name=\"description\" content=\"Reloadly Resources. Insights, Info and Analysis For The Mobile Airtime API Community\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deploying an airtime API via command line and ASP .NET - Reloadly\" \/>\n<meta property=\"og:description\" content=\"Reloadly Resources. Insights, Info and Analysis For The Mobile Airtime API Community\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/\" \/>\n<meta property=\"og:site_name\" content=\"Reloadly\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-14T11:40:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-10-05T11:35:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/Artboard-\u2013-3.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"7 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#organization\",\"name\":\"Reloadly\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/\",\"sameAs\":[],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2020\/11\/logo-1.svg\",\"width\":100,\"height\":100,\"caption\":\"Reloadly\"},\"image\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#website\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/\",\"name\":\"Reloadly\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/blog.reloadly.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/wp-content\/uploads\/2021\/09\/Artboard-\\u2013-3.png\",\"width\":1000,\"height\":420},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#webpage\",\"url\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/\",\"name\":\"Deploying an airtime API via command line and ASP .NET - Reloadly\",\"isPartOf\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#primaryimage\"},\"datePublished\":\"2021-09-14T11:40:33+00:00\",\"dateModified\":\"2021-10-05T11:35:21+00:00\",\"description\":\"Reloadly Resources. Insights, Info and Analysis For The Mobile Airtime API Community\",\"breadcrumb\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/\",\"url\":\"https:\/\/blog.reloadly.com\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/\",\"url\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/\",\"name\":\"Deploying an airtime API via command line and ASP .NET\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#webpage\"},\"author\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#\/schema\/person\/2400042054e3b3009489e487224a6984\"},\"headline\":\"Deploying an airtime API via command line and ASP .NET\",\"datePublished\":\"2021-09-14T11:40:33+00:00\",\"dateModified\":\"2021-10-05T11:35:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#primaryimage\"},\"keywords\":\"airtime,C#,developer,dotnet,reloadly\",\"articleSection\":\"Developer Blog\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.reloadly.com\/blog\/deploying-an-airtime-api-via-command-line-and-asp-net\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#\/schema\/person\/2400042054e3b3009489e487224a6984\",\"name\":\"Raphael Ugwu\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/blog.reloadly.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/656844c0101d37e5695eee915ed3a49d?s=96&d=mm&r=g\",\"caption\":\"Raphael Ugwu\"},\"url\":\"https:\/\/blog.reloadly.com\/blog\/author\/fullstackmafia\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","authors":[{"term_id":359,"user_id":17,"is_guest":0,"slug":"fullstackmafia","display_name":"Raphael Ugwu"}],"_links":{"self":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts\/1754"}],"collection":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/comments?post=1754"}],"version-history":[{"count":25,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts\/1754\/revisions"}],"predecessor-version":[{"id":1910,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/posts\/1754\/revisions\/1910"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/media\/1775"}],"wp:attachment":[{"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/media?parent=1754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/categories?post=1754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.reloadly.com\/blog\/wp-json\/wp\/v2\/tags?post=1754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}