<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Himanshu's Dev Blog]]></title><description><![CDATA[Himanshu's Dev Blog]]></description><link>https://himanshuji.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6a24a04985227ad88016da31/07bf95e5-311e-4d9f-89a6-0842371c02aa.svg</url><title>Himanshu&apos;s Dev Blog</title><link>https://himanshuji.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 07:43:49 GMT</lastBuildDate><atom:link href="https://himanshuji.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[# Working with APIs — A Beginner's Guide (using `requests`)
]]></title><description><![CDATA[Jab maine pehli baar "API" word suna tha, mujhe laga ye kuch alien technology hai. Lekin actual mein, API utna hi simple concept hai jitna ek waiter ko order dena. Is blog mein main API ka pura flow —]]></description><link>https://himanshuji.hashnode.dev/working-with-apis-a-beginner-s-guide-using-requests</link><guid isPermaLink="true">https://himanshuji.hashnode.dev/working-with-apis-a-beginner-s-guide-using-requests</guid><dc:creator><![CDATA[himanshu Yadav]]></dc:creator><pubDate>Sun, 21 Jun 2026 05:57:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a24a04985227ad88016da31/896835dc-e8da-4fd9-8815-8575949f4a31.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Jab maine pehli baar "API" word suna tha, mujhe laga ye kuch alien technology hai. Lekin actual mein, API utna hi simple concept hai jitna ek waiter ko order dena. Is blog mein main API ka pura flow — Request se lekar Response tak — beginner-friendly tareeke se samjhaunga.</p>
<h2>API Kya Hai?</h2>
<p><strong>API (Application Programming Interface)</strong> ek tarika hai jisse do software ek dusre se baat kar paate hain.</p>
<p>Socho tum ek restaurant mein ho. Tum (Client) waiter ko order dete ho. Waiter kitchen (Server) mein jaake order deta hai, khana ban'ne ke baad waapas tumhare table par le aata hai.</p>
<ul>
<li><p><strong>Tum</strong> = Dev/Client (jo request bhejta hai)</p>
</li>
<li><p><strong>Waiter</strong> = API (jo request le jaata hai aur response wapas laata hai)</p>
</li>
<li><p><strong>Kitchen</strong> = Server (jo actually data process karta hai)</p>
</li>
</ul>
<p>Yehi pura flow hai jo har API call mein hota hai.</p>
<h2>The Flow: Client → Request → API → Server → Response</h2>
<pre><code class="language-plaintext">DEv (Client)
     |
     v
  Request
     |
     v
working with APIs
     |
     v
Server Processes
     |
     v
Response (status-code)
</code></pre>
<ol>
<li><p><strong>Client</strong> kuch chahta hai — data fetch karna ho, ya naya data save karna ho.</p>
</li>
<li><p>Wo ek <strong>Request</strong> banata hai aur API (URL) ko bhejta hai.</p>
</li>
<li><p><strong>API</strong> us request ko server tak le jaata hai.</p>
</li>
<li><p><strong>Server</strong> request ko process karta hai — database check karta hai, calculation karta hai, ya jo bhi zaroori ho.</p>
</li>
<li><p>Server ek <strong>Response</strong> wapas bhejta hai, jisme data aur ek <strong>status code</strong> hota hai jo batata hai ki request successful thi ya nahi.</p>
</li>
</ol>
<h2>Types of Requests (HTTP Methods)</h2>
<p>Har request ka ek "type" hota hai, jo batata hai client kya karna chahta hai:</p>
<table>
<thead>
<tr>
<th>Method</th>
<th>Kaam</th>
<th>Example</th>
</tr>
</thead>
<tbody><tr>
<td><strong>GET</strong></td>
<td>Data <strong>lena</strong> (read)</td>
<td>List of users dekhna</td>
</tr>
<tr>
<td><strong>POST</strong></td>
<td>Naya data <strong>bhejna/create</strong> karna</td>
<td>Naya user banana</td>
</tr>
<tr>
<td><strong>PUT/PATCH</strong></td>
<td>Existing data <strong>update</strong> karna</td>
<td>User ka naam change karna</td>
</tr>
<tr>
<td><strong>DELETE</strong></td>
<td>Data <strong>delete</strong> karna</td>
<td>User account delete karna</td>
</tr>
</tbody></table>
<p>Simple yaad rakhne ka tarika — ye CRUD operations (Create, Read, Update, Delete) ka API version hai.</p>
<h2>Status Codes — Response ka Result</h2>
<p>Jab server response bhejta hai, uske saath ek <strong>status code</strong> aata hai jo batata hai kya hua:</p>
<ul>
<li><p><strong>200</strong> → OK, sab kuch sahi gaya ✅</p>
</li>
<li><p><strong>201</strong> → Created, naya data successfully ban gaya</p>
</li>
<li><p><strong>400</strong> → Bad Request, tumne galat data bheja</p>
</li>
<li><p><strong>401</strong> → Unauthorized, login/token chahiye</p>
</li>
<li><p><strong>403</strong> → Forbidden, permission nahi hai</p>
</li>
<li><p><strong>404</strong> → Not Found, jo URL maanga wo exist nahi karta</p>
</li>
<li><p><strong>500</strong> → Internal Server Error, server side mein kuch galat hua</p>
</li>
</ul>
<p>Yaad rakhne ki trick:</p>
<ul>
<li><p><strong>2xx</strong> = sab theek</p>
</li>
<li><p><strong>4xx</strong> = client ne galti ki</p>
</li>
<li><p><strong>5xx</strong> = server ne galti ki</p>
</li>
</ul>
<h2>Python mein APIs ke saath kaam karna (<code>requests</code> library)</h2>
<p>Ab thoda code dekhte hain. Python mein <code>requests</code> library APIs ke saath kaam karna bohot easy bana deti hai.</p>
<pre><code class="language-python">import requests

# GET request - data fetch karna
response = requests.get("https://api.example.com/users")
print(response.status_code)   # e.g. 200
print(response.json())        # response body as Python dict/list
</code></pre>
<pre><code class="language-python"># POST request - naya data bhejna
data = {"name": "Himanshu", "age": 19}
response = requests.post("https://api.example.com/users", json=data)
print(response.status_code)   # e.g. 201 (Created)
</code></pre>
<h3>Headers — extra info bhejna</h3>
<p>Kabhi kabhi request ke saath authentication ya extra metadata bhejna padta hai:</p>
<pre><code class="language-python">headers = {"Authorization": "Bearer &lt;token&gt;"}
requests.get(url, headers=headers)
</code></pre>
<h3>Query Parameters — filter/search bhejna</h3>
<pre><code class="language-python">params = {"search": "python"}
requests.get(url, params=params)
# Final URL: https://api.example.com/users?search=python
</code></pre>
<h3>JSON — APIs ki common language</h3>
<p>Most APIs data ko <strong>JSON format</strong> mein bhejte/lete hain — jo basically Python ke dictionary jaisa hi structure hai (key-value pairs). Isi liye <code>requests</code> library mein <code>.json()</code> method itna handy hai.</p>
<h2>Quick Recap</h2>
<ul>
<li><p>API = do software ke beech baat-cheet karne ka tarika</p>
</li>
<li><p>Client request bhejta hai → API server tak le jaata hai → Server process karta hai → Response wapas aata hai</p>
</li>
<li><p>GET, POST, PUT/PATCH, DELETE — yehi 4 main request types hain</p>
</li>
<li><p>Status code batata hai request successful thi ya nahi (2xx success, 4xx client error, 5xx server error)</p>
</li>
<li><p>Python mein <code>requests</code> library se APIs use karna kaafi straightforward hai</p>
</li>
</ul>
<p>Agli baar jab koi app data fetch karte dekho — chahe wo weather app ho ya social media feed — ab tumhe pata hai background mein exactly kya ho raha hai!</p>
<hr />
<p><em>Agar ye post helpful laga, toh share karna mat bhoolna. Next post mein hum ek real API use karke ek mini-project banayenge.</em></p>
]]></content:encoded></item><item><title><![CDATA[DOM Manipulation in JavaScript — A Beginner's Cheatsheet]]></title><description><![CDATA[If you are just getting started with javascript,DOM Manipulation is one of the first places where things start to feel real - you write code and something actually changes on the screen.
But it also h]]></description><link>https://himanshuji.hashnode.dev/dom-manipulation-in-javascript-a-beginner-s-cheatsheet</link><guid isPermaLink="true">https://himanshuji.hashnode.dev/dom-manipulation-in-javascript-a-beginner-s-cheatsheet</guid><dc:creator><![CDATA[himanshu Yadav]]></dc:creator><pubDate>Sat, 06 Jun 2026 23:12:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a24a04985227ad88016da31/58a9e464-5585-415f-bcc6-e8d67f19e180.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<hr />
<p>If you are just getting started with javascript,DOM Manipulation is one of the first places where things start to feel real - you write code and something actually changes on the screen.</p>
<p>But it also has a surprising number of small traps that are not obvious until you hit them.</p>
<p>Here's everything I learned today , organized so you don't have to make the same mistake I did.</p>
<hr />
<h3>What is DOM ?</h3>
<p>DOM stands for "Document Object Model" . it's basically how Javascript sees your HTML page- as a tree of elements that you can select, change,and interact with using code.</p>
<hr />
<h3>1.Selecting Elements</h3>
<p>Before you can change anything, you need to grab the element first.</p>
<pre><code class="language-javascript">// By ID — returns a single element
document.getElementById('title')

// By class name — returns an HTMLCollection (NOT one element!)
document.getElementsByClassName('card')

// By CSS selector — cleanest option, returns first match
document.querySelector('.card')
document.querySelector('#title')
</code></pre>
<hr />
<h3>2.Changing Styles</h3>
<p>Once you have the elements, you can change its CSS directly from JavaScript:</p>
<pre><code class="language-javascript">const title = document.getElementById('title')

title.style.backgroundColor = 'green'
title.style.padding = '15px'
title.style.borderRadius = '15px'
</code></pre>
<hr />
<h3>3.Reading Elements properties</h3>
<pre><code class="language-javascript">const title = document.getElementById('title')

title.id          // returns the id value
title.className   // returns class name(s) as a string
</code></pre>
<hr />
<h3>4.Reading Content</h3>
<pre><code class="language-javascript">title.textContent   // all text including hidden elements, no HTML tags
title.innerText     // only visible text (layout-aware)
title.innerHTML     // full HTML content inside the element (includes tags)
</code></pre>
<hr />
<p><strong>use case</strong></p>
<ul>
<li><p>use <code>.textContent</code> when you just want the raw text</p>
</li>
<li><p>use<code>.innerText</code> when you care about what the user actually sees</p>
</li>
<li><p>use <code>.innerHTML</code> when you need to read or write HTMK tags inside an element</p>
</li>
</ul>
<hr />
<img src="https://cdn.hashnode.com/uploads/covers/6a24a04985227ad88016da31/f7c1ad52-b1be-4b03-ab3d-9e53a5982de2.png" alt="" style="display:block;margin:0 auto" />

<p>If you're also learning JavaScript, I hope this saves you some debugging time. These are small things but they add up fast when you're just starting out.</p>
<p>Let's keep building 🚀</p>
]]></content:encoded></item></channel></rss>