<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ar-ruk Kachen</title>
    <description>The latest articles on DEV Community by Ar-ruk Kachen (@goodgodth).</description>
    <link>https://dev.to/goodgodth</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F189772%2Ff7f6b2ba-da0c-4b22-9a53-a1df7849254a.jpeg</url>
      <title>DEV Community: Ar-ruk Kachen</title>
      <link>https://dev.to/goodgodth</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/goodgodth"/>
    <language>en</language>
    <item>
      <title>Curl Command for Developer</title>
      <dc:creator>Ar-ruk Kachen</dc:creator>
      <pubDate>Sun, 23 Jan 2022 16:16:26 +0000</pubDate>
      <link>https://dev.to/goodgodth/curl-command-for-developer-466e</link>
      <guid>https://dev.to/goodgodth/curl-command-for-developer-466e</guid>
      <description>&lt;p&gt;This cheatsheet was collected famous CURL command for Software Developer. Exactly it's easy for checking and testing communicate between frontend and backend &lt;/p&gt;

&lt;p&gt;if you want to see more information or option. Please see in : &lt;a href="https://www.mit.edu/afs.new/sipb/user/ssen/src/curl-7.11.1/docs/curl.html"&gt;Curl man page&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1.Request with set value specific header
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --header "X-MyHeader: 123" URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2.Request with using cookie
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -v --cookie "COOKIEKEY=VALUE" URL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3.Request with method and body
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X HTTPMETHOD -H "Content-Type: application/json" -d '{"key1":"value"}' URL

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4.Request with Form-data
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST -H "Content-Type: multipart/form-data;" -F "key1=val1" URL

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5.Request with Post File
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X POST -F 'file=@/file-path.csv' URL

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6.Get HTTP Status Only
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -s -o /dev/null -w "%{http_code}" URL

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  7.Get Response Header only
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -I https://www.google.com

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8.Get Response value of specific header
&lt;/h2&gt;

&lt;p&gt;(Example: for get content-type header)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -sI URL | tr -d '\r' | sed -En 's/^&amp;lt;u&amp;gt;content-type&amp;lt;/u&amp;gt;: (.*)/\1/p'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>curl</category>
      <category>cheatsheet</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
