<?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: daspecialman</title>
    <description>The latest articles on DEV Community by daspecialman (@daspecialman).</description>
    <link>https://dev.to/daspecialman</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%2F451313%2Fa5000e88-3803-434f-a7f9-bd1c221bf49d.png</url>
      <title>DEV Community: daspecialman</title>
      <link>https://dev.to/daspecialman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daspecialman"/>
    <language>en</language>
    <item>
      <title>How to setup and test Postman API Collection</title>
      <dc:creator>daspecialman</dc:creator>
      <pubDate>Thu, 14 Oct 2021 13:58:59 +0000</pubDate>
      <link>https://dev.to/daspecialman/how-to-setup-and-test-postman-api-collection-j1k</link>
      <guid>https://dev.to/daspecialman/how-to-setup-and-test-postman-api-collection-j1k</guid>
      <description>&lt;p&gt;If you are a web frontend developer or mobile app developer, you have likely encountered the need to test your API before integration. For experienced developers, this is not an issue, but for the newbies, it could get confusing. &lt;/p&gt;

&lt;p&gt;Whenever we onboard new interns in the dev department of &lt;a href="https://specialmansolution.com" rel="noopener noreferrer"&gt;Special Man Global Solution LTD&lt;/a&gt; and they are assigned a task, especially a frontend task, the first challenge is how to test the API, and I am always happy to guide them through it. &lt;/p&gt;

&lt;p&gt;In this article, I will share a brief on how you can test API endpoints using &lt;a href="https://www.postman.com/" rel="noopener noreferrer"&gt;Postman&lt;/a&gt; to help you consume &lt;a href="https://www.infoworld.com/article/3269878/what-is-an-api-application-programming-interfaces-explained.html" rel="noopener noreferrer"&gt;API&lt;/a&gt; appropriately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Accessing the collection
&lt;/h2&gt;

&lt;p&gt;First, you are giving a collection URL for the Postman. When you open it, you will see something like this.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff123di9czptmmsrhkxjn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff123di9czptmmsrhkxjn.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1 and 2. The Request Endpoint and Folder
&lt;/h3&gt;

&lt;p&gt;This section shows the arrangement of the API endpoints. Here they are grouped in folders. Inside the folder, there is the actual endpoint. Showing the endpoint name and the request method. &lt;/p&gt;

&lt;h3&gt;
  
  
  3. The Environment
&lt;/h3&gt;

&lt;p&gt;This shows any environment setup that contains all variables the Postman collection is set up with. &lt;/p&gt;

&lt;h3&gt;
  
  
  4. Specification
&lt;/h3&gt;

&lt;p&gt;This allows you to select the preferred pattern or specification you want to view the endpoint request with.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Documentation Body
&lt;/h3&gt;

&lt;p&gt;This is the documentation body that describes guides you need to know to be able to consume the request.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Run in Postman
&lt;/h3&gt;

&lt;p&gt;This allows you to test the API on the web or your local PC.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Request Definition
&lt;/h3&gt;

&lt;p&gt;This shows you the request definition depending on the pattern or specification you selected above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the endpoint
&lt;/h2&gt;

&lt;p&gt;Click on run in Postman, then Postman for the web.&lt;br&gt;
Select your preferred workspace&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffq9cpmznbom1jyt7ocki.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffq9cpmznbom1jyt7ocki.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click on the endpoint you want to test, make sure the method, body and data type are correct, then click on send, you will see the data show.&lt;/p&gt;

&lt;h2&gt;
  
  
  Request with JWT Authentication
&lt;/h2&gt;

&lt;p&gt;If your endpoint is protected using JWT; you will need to set the auth on Postman else you will be getting unauthorized error.&lt;br&gt;
Login using the login endpoint, copy the JSON Web Token, then click on the collection, under Authorization tab, sent:&lt;br&gt;
&lt;strong&gt;Type&lt;/strong&gt; = Bearer Token&lt;br&gt;
&lt;strong&gt;Token&lt;/strong&gt; = The JWT token you copied.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feuklaxin4vbne4dsq0b9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feuklaxin4vbne4dsq0b9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this you can access all the endpoints, if you encounter more issues, you inform the backend team to get them fixed.&lt;/p&gt;

&lt;p&gt;I hope this article can help you set up and test API endpoints before integration on your frontend project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The API documentation used here is from &lt;a href="https://thestartupintern.com" rel="noopener noreferrer"&gt;The StartUp Intern's Refinery Program&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>postman</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
