<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>RESTful &#8211; AnonyViet &#8211; English Version</title>
	<atom:link href="https://en.anonyviet.com/tag/restful/feed/" rel="self" type="application/rss+xml" />
	<link>https://en.anonyviet.com</link>
	<description>The most popular website for sharing information technology, computer networks, and security knowledge. Stay up to date with the hottest news and tips</description>
	<lastBuildDate>Tue, 24 Jan 2023 23:28:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://en.anonyviet.com/wp-content/uploads/2023/01/cropped-ico-logo-75x75-1.png</url>
	<title>RESTful &#8211; AnonyViet &#8211; English Version</title>
	<link>https://en.anonyviet.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Let&#8217;s find out what is API, REST API and RESTful API?</title>
		<link>https://en.anonyviet.com/lets-find-out-what-is-api-rest-api-and-restful-api/</link>
					<comments>https://en.anonyviet.com/lets-find-out-what-is-api-rest-api-and-restful-api/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Tue, 24 Jan 2023 23:28:07 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Find]]></category>
		<category><![CDATA[Lets]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[RESTful]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=2310</guid>

					<description><![CDATA[REST API and RESTful API are commonly used in client/server architecture in software development. So in this article, I will introduce you to API, Rest API and Restful API. Join the channel Telegram of the AnonyViet 👉 Link 👈 What is API? An Application Program Interface (API) is a piece of middleware that allows two [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div id="ftwp-postcontent">
<p>REST API and RESTful API are commonly used in client/server architecture in software development.  So in this article, I will introduce you to API, Rest API and Restful API.</p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2 id="ftoc-api-la-gi" class="ftwp-heading">What is API?</h2>
<p>An Application Program Interface (API) is a piece of middleware that allows two applications to talk to each other.  You can see an example in the image below.</p>
<p><img fetchpriority="high" decoding="async" class="aligncenter wp-image-41951 size-full" src="https://anonyviet.com/wp-content/uploads/2022/06/1_VtzBqZ-yYr_c6DpJsQkiyA.jpg" alt="Let's find out what is API, REST API and RESTful API?" width="671" height="500" srcset="https://anonyviet.com/wp-content/uploads/2022/06/1_VtzBqZ-yYr_c6DpJsQkiyA.jpg 671w, https://anonyviet.com/wp-content/uploads/2022/06/1_VtzBqZ-yYr_c6DpJsQkiyA-300x224.jpg 300w" sizes="(max-width: 671px) 100vw, 671px" title="Let's find out what is API, REST API and RESTful API?  6"/></p>
<p>If user wants to book train ticket, web application will show departure time, train stations and all information, when we view from developer side, developer wants to show all information of train timetables in the web application, then the developer will use the APIs to get these train information from the web server, which stores all the train details and information.  Developers can then retrieve data from the web server using the APIs to display in the web application.</p>
<h3 id="ftoc-loi-ich-cua-viec-su-dung-api" class="ftwp-heading">Benefits of using API</h3>
<p>APIs are required to make connections between functions in the application to process data from different processes.</p>
<p>● <strong>Easy integration:</strong> API can be integrated into any kind of software application, So it can be easily integrated with applications and functions between different websites.</p>
<p>● <strong>Reduce software development time:</strong> Using APIs that reduce development time, developers can implement their own APIs <a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Ftag%2Fmap%2F" rel="noopener" class="local-link">Google Maps</a> to provide the exact location of the store to website visitors.  In doing so, you won&#8217;t need to develop a GPS-based location tracking app from scratch.  This approach will be more efficient and cost effective to achieve the required functionality.</p>
<p>● <strong>Security:</strong> The API provides a secure communication gateway for various application components to interact and exchange data.</p>
<h2 id="ftoc-restful-api-va-rest-api-la-gi" class="ftwp-heading">What is RESTFUL API and REST API?</h2>
<h3 id="ftoc-rest-api-la-gi" class="ftwp-heading">What is REST API?</h3>
<p>REpresentational State Transfer is abbreviated as REST.  It is an API that follows a set of rules for applications and services to communicate with each other.</p>
<p>REST APIs work by making requests for a resource and returning all relevant information about the resource, translated into a format that can be easily understood by the client (this format is defined by API requests).  The client can also modify items on the server and even add new items to the server through the REST API.</p>
<h3 id="ftoc-restful-api-la-gi" class="ftwp-heading">What is RESTful API?</h3>
<p>RESTful API is an Application Programming Interface (API) that follows the constraints of the REST architecture and interacts with RESTful web services.  RESTful API also follows the principles of REST API.  RESTful APIs are more scalable and have a longer lifespan.  RESTful API uses the <a target="_blank" href="https://en.anonyviet.com/next-link/?url=https%3A%2F%2Fhoclaptrinh.vn%2Ftutorial%2Fhoc-http" rel="noopener external nofollow" class="ext-link" onclick="this.target='_blank';">HTTP request</a> to access and use data.  There are four basic HTTP requests that a client can make:</p>
<p>● GET – To retrieve resources.</p>
<p>● POST – To create a new resource.</p>
<p>● PUT – To edit or update an existing resource.</p>
<p>● DELETE – To delete the resource.</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-41952 size-full" src="https://anonyviet.com/wp-content/uploads/2022/06/1_DbOABxOgw_dieGcZRd3jeg.jpg" alt="Let's find out what is API, REST API and RESTful API?  4" width="393" height="219" srcset="https://anonyviet.com/wp-content/uploads/2022/06/1_DbOABxOgw_dieGcZRd3jeg.jpg 393w, https://anonyviet.com/wp-content/uploads/2022/06/1_DbOABxOgw_dieGcZRd3jeg-300x167.jpg 300w" sizes="auto, (max-width: 393px) 100vw, 393px" title="Let's find out what is API, REST API and RESTful API?  7"/></p>
<h3 id="ftoc-endpoints-rest-api-va-restful-api" class="ftwp-heading">Endpoints REST API and RESTful API</h3>
<p>When a user uses the API to send &#8220;request&#8221; information from a web application or web server, it receives a &#8220;response&#8221;.  Where APIs send requests or contain resources directly are endpoints.  With the REST API, the endpoint is one end of the communication channel.</p>
<h3 id="ftoc-su-khac-nhau-giua-rest-api-va-restful-api" class="ftwp-heading">Difference between REST API and RESTful API</h3>
<p>Although the architectures of both REST and RESTful APIs are similar, they are a bit different.  REST API follows all the rules of REST architecture.  It has a cached, stateless, client-server layer system with a uniform interface, while RESTful web applications have all the features of the REST architecture with additional features. unique fig.</p>
<p>This REST protocol is very powerful and it inherits many security measures, which are built-in architectural layers.  In RESTful APIs there are many layers and there is a transport protocol which makes the system less secure when compared to REST.</p>
<p>REST API web services work on request and response.  RESTful operation is completely based on REST applications.</p>
<p>It is highly adaptable and friendly to all business and IT enterprises using REST API.  RESTful APIs are more flexible when compared to RESTLESS web services.</p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;41950&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/lets-find-out-what-is-api-rest-api-and-restful-api/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2022/06/1_VtzBqZ-yYr_c6DpJsQkiyA.jpg" medium="image"></media:content>
	</item>
		<item>
		<title>Create a simple RESTful API in 5 minutes</title>
		<link>https://en.anonyviet.com/create-a-simple-restful-api-in-5-minutes/</link>
					<comments>https://en.anonyviet.com/create-a-simple-restful-api-in-5-minutes/#respond</comments>
		
		<dc:creator><![CDATA[AnonyViet]]></dc:creator>
		<pubDate>Tue, 24 Jan 2023 18:11:19 +0000</pubDate>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[create]]></category>
		<category><![CDATA[minutes]]></category>
		<category><![CDATA[RESTful]]></category>
		<category><![CDATA[simple]]></category>
		<guid isPermaLink="false">https://en.anonyviet.com/?p=2063</guid>

					<description><![CDATA[Before we start, we must know What is API?As you all probably know API stands for Application Programming Interface. So what is it? Join the channel Telegram of the AnonyViet 👉 Link 👈 According to Wikipedia, Application Programming Interface (API) is a connection between computers or between computer programs. It is a type of software [&#8230;]]]></description>
										<content:encoded><![CDATA[<p></p>
<div id="ftwp-postcontent">
<p>Before we start, we must know <a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Fanonyviet.com%2Fcung-tim-hieu-api-rest-api-va-restful-api-la-gi%2F" rel="noopener" class="local-link">What is API?</a>As you all probably know API stands for <em class="lz">Application Programming Interface</em>.  So what is it?</p>
<div class="code-block code-block-16" style="margin: 8px 0; clear: both;">
<div align="center">
<table class=" aligncenter" style="background-color: #c0c0c0; border-collapse: collapse; width: 59.9985%;">
<tbody>
<tr>
<td style="width: 100%; text-align: center;"><span style="font-size: 12pt;"><strong>Join the channel <span style="color: #0000ff;">Telegram</span> of the <span style="color: #008080;">AnonyViet </span> 👉 <span style="text-decoration: underline;"><a target="_blank" href="https://en.anonyviet.com/next-link?url=https%3A%2F%2Ft.me%2Fanonyvietchat" class="local-link" rel="noopener">Link</a></span>  👈</strong></span></td>
</tr>
</tbody>
</table>
</div>
</div>
<p><img decoding="async" class="aligncenter wp-image-42590 size-full" src="https://anonyviet.com/wp-content/uploads/2022/07/1_Vx2N9cwDMOxTX51FllBusg.jpg" alt="Create a simple RESTful API in 5 minutes" width="585" height="330" srcset="https://anonyviet.com/wp-content/uploads/2022/07/1_Vx2N9cwDMOxTX51FllBusg.jpg 585w, https://anonyviet.com/wp-content/uploads/2022/07/1_Vx2N9cwDMOxTX51FllBusg-300x169.jpg 300w" sizes="(max-width: 585px) 100vw, 585px" title="Create a simple RESTful API in 5 minutes 9"/></p>
<p>According to Wikipedia, <em class="lz">Application Programming Interface</em> (API) is a connection between computers or between computer programs.  It is a type of software interface that provides a service to other software.</p>
<p>If that sounds confusing, here is a simplified version of the above definition – an API is the medium through which two computer programs can “talk” to each other.  Here, “chat” refers to the exchange of data.</p>
<p>There are many APIs in the world.  Today we will talk about RESTful APIs.</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-42589 aligncenter" src="https://anonyviet.com/wp-content/uploads/2022/07/1_LLHUkLWg4uots5_sl5LGgQ.jpg" alt="Create a simple RESTful API in 5 minutes 5" width="1050" height="590" srcset="https://anonyviet.com/wp-content/uploads/2022/07/1_LLHUkLWg4uots5_sl5LGgQ.jpg 1050w, https://anonyviet.com/wp-content/uploads/2022/07/1_LLHUkLWg4uots5_sl5LGgQ-300x169.jpg 300w, https://anonyviet.com/wp-content/uploads/2022/07/1_LLHUkLWg4uots5_sl5LGgQ-1024x575.jpg 1024w, https://anonyviet.com/wp-content/uploads/2022/07/1_LLHUkLWg4uots5_sl5LGgQ-768x432.jpg 768w, https://anonyviet.com/wp-content/uploads/2022/07/1_LLHUkLWg4uots5_sl5LGgQ-750x421.jpg 750w" sizes="auto, (max-width: 1050px) 100vw, 1050px" title="Create a simple RESTful API in 5 minutes 10"/></p>
<p>We will create a RESTful API.  RESTful APIs are one of many possible ways that programs, servers, and websites can share data.  The RESTful API organizes data into a series of unique URLs (URIs).  The data can be anything (e.g. form data, weather data, product details).</p>
<p>Let&#8217;s see an example to understand better:</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-42591 aligncenter" src="https://anonyviet.com/wp-content/uploads/2022/07/1_nQfoFQyuJsaCpnoMzsDkfA.jpeg" alt="Create a simple RESTful API in 5 minutes 6" width="736" height="217" srcset="https://anonyviet.com/wp-content/uploads/2022/07/1_nQfoFQyuJsaCpnoMzsDkfA.jpeg 736w, https://anonyviet.com/wp-content/uploads/2022/07/1_nQfoFQyuJsaCpnoMzsDkfA-300x88.jpeg 300w" sizes="auto, (max-width: 736px) 100vw, 736px" title="Create a simple RESTful API in 5 minutes 11"/></p>
<p>The URL above (the API endpoint) gets the data of all <em class="lz">burgers</em>.  If <em class="lz">sandwiches </em>also available in the store, then by changing the endpoint we can get the desired result.</p>
<p>Now you have a clear understanding of what RESTful API is.</p>
<p>Next, we&#8217;ll build our REST API in Python using the FAST API.  FastAPI is a modern Web framework for developing RESTful APIs in Python.</p>
<p>Request:</p>
<h2 id="ftoc-tao-restful-api-don-gian-trong-5-phut" class="ftwp-heading">Create a simple RESTful API in 5 minutes</h2>
<h3 id="ftoc-1-cai-dat-fast-api-va-uvicorn" class="ftwp-heading">1. Install FAST API and Uvicorn</h3>
<p>Create a new project.</p>
<p>As I said earlier, we will use the FAST API framework to build the API.  So install it in the project using the following command:</p>
<p><code>pip install fastapi</code></p>
<p>Once it is installed, we need to install Uvicorn – A web server implementation for python.</p>
<p><code>pip install uvicorn</code></p>
<h3 id="ftoc-2-tao-va-khoi-tao-tep" class="ftwp-heading">2. File creation and initialization</h3>
<p>Create a new file api.py in your project.  Include the following code to initialize the file.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="generic">from fastapi import FastAPI&#13;
&#13;
# Tạo API&#13;
app = FastAPI()</pre>
<p>We have now initialized the API we need to create routes.  We will create 3 routes as follows</p>
<ol class="">
<li id="ee9a" class="mh mi jj ld b le lf li lj lm mj lq mk lu ml ly ng mn mo mp hk" data-selectable-paragraph="">Default route</li>
<li id="2d7d" class="mh mi jj ld b le mq li mr lm ms lq mt lu mu ly ng mn mo mp hk" data-selectable-paragraph="">Burgers route</li>
<li id="d112" class="mh mi jj ld b le mq li mr lm ms lq mt lu mu ly ng mn mo mp hk" data-selectable-paragraph="">Sandwiches route</li>
</ol>
<pre class="EnlighterJSRAW" data-enlighter-language="generic"># default route&#13;
@app.get("/")&#13;
async def root():&#13;
    return {&#13;
            "welcome_message": "Hello hungry Zucky, welcome!",&#13;
            "menu": [&#13;
                {&#13;
                    "burgers": "http://localhost:8000/api/v1/menu/burgers"&#13;
                },&#13;
                {&#13;
                    "sandwiches": "http://localhost:8000/api/v1/menu/sandwiches"&#13;
                }&#13;
            ]&#13;
    };&#13;
&#13;
# burgers route&#13;
@app.get("/api/v1/menu/burgers")&#13;
async def burgers():&#13;
    return {&#13;
        "spicy burger": "10$",&#13;
        "cheesy burger": "12$",&#13;
        "Extra cheesy spicy burger": "18$"&#13;
    }&#13;
&#13;
# sandwiches route&#13;
@app.get("/api/v1/menu/sandwiches")&#13;
async def burgers():&#13;
    return {&#13;
        "Egg sandwich": "10$",&#13;
        "cheesy sandwich": "11$",&#13;
        "Chicken sandwich": "13$"&#13;
    }</pre>
<p>So you have successfully created REST API.</p>
<h3 id="ftoc-4-dua-len-may-chu" class="ftwp-heading">4. Upload to the server</h3>
<p>To check the results, enter the following command.</p>
<p><code>uvicorn api:app --reload</code></p>
<p>This command starts the server.  With the use of the –reload flag, the server will restart when it observes any new changes in your file i.e. api.py file</p>
<p>Enter the URL in your browser: http://127.0.0.1:8000</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-42592 aligncenter" src="https://anonyviet.com/wp-content/uploads/2022/07/1_pI2xUs2Q04XVFo-51lOkqA.jpg" alt="Create a simple RESTful API in 5 minutes 7" width="1050" height="590" srcset="https://anonyviet.com/wp-content/uploads/2022/07/1_pI2xUs2Q04XVFo-51lOkqA.jpg 1050w, https://anonyviet.com/wp-content/uploads/2022/07/1_pI2xUs2Q04XVFo-51lOkqA-300x169.jpg 300w, https://anonyviet.com/wp-content/uploads/2022/07/1_pI2xUs2Q04XVFo-51lOkqA-1024x575.jpg 1024w, https://anonyviet.com/wp-content/uploads/2022/07/1_pI2xUs2Q04XVFo-51lOkqA-768x432.jpg 768w, https://anonyviet.com/wp-content/uploads/2022/07/1_pI2xUs2Q04XVFo-51lOkqA-750x421.jpg 750w" sizes="auto, (max-width: 1050px) 100vw, 1050px" title="Create a simple RESTful API in 5 minutes 12"/></p>
<h2 id="ftoc-ket-luan" class="ftwp-heading">Conclusion</h2>
<p>In this article, we created a simple REST API in Python using the FAST API framework.  It has three routes and each returns JSON data.  Furthermore, We can send JSON data to front-end as HTTP response.</p>
<div class="kk-star-ratings kksr-auto kksr-align-right kksr-valign-bottom" data-payload="{&quot;align&quot;:&quot;right&quot;,&quot;id&quot;:&quot;42588&quot;,&quot;slug&quot;:&quot;default&quot;,&quot;valign&quot;:&quot;bottom&quot;,&quot;ignore&quot;:&quot;&quot;,&quot;reference&quot;:&quot;auto&quot;,&quot;class&quot;:&quot;&quot;,&quot;count&quot;:&quot;100&quot;,&quot;legendonly&quot;:&quot;&quot;,&quot;readonly&quot;:&quot;&quot;,&quot;score&quot;:&quot;5&quot;,&quot;starsonly&quot;:&quot;&quot;,&quot;best&quot;:&quot;5&quot;,&quot;gap&quot;:&quot;5&quot;,&quot;greet&quot;:&quot;\u0110\u00e1nh gi\u00e1 b\u00e0i vi\u1ebft post&quot;,&quot;legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: 5\/5 - (100 b\u00ecnh ch\u1ecdn)&quot;,&quot;size&quot;:&quot;24&quot;,&quot;width&quot;:&quot;142.5&quot;,&quot;_legend&quot;:&quot;B\u00e0i vi\u1ebft \u0111\u1ea1t: {score}\/{best} - ({count} {votes})&quot;,&quot;font_factor&quot;:&quot;1.25&quot;}">
<p>            The article achieved: 5/5 &#8211; (100 votes)    </p>
</p></div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://en.anonyviet.com/create-a-simple-restful-api-in-5-minutes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<media:content url="https://anonyviet.com/wp-content/uploads/2022/07/1_Vx2N9cwDMOxTX51FllBusg.jpg" medium="image"></media:content>
	</item>
	</channel>
</rss>
