<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chandan Kumar Roy on Medium]]></title>
        <description><![CDATA[Stories by Chandan Kumar Roy on Medium]]></description>
        <link>https://medium.com/@chandanrjit?source=rss-9e55d287edd6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5rNjTYfVGpSkxr0kGsnzJQ.png</url>
            <title>Stories by Chandan Kumar Roy on Medium</title>
            <link>https://medium.com/@chandanrjit?source=rss-9e55d287edd6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 23:01:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chandanrjit/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LWC Component — Salesforce Knowledge + API]]></title>
            <link>https://medium.com/@chandanrjit/lwc-component-salesforce-knowledge-api-018b9d1ecfe3?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/018b9d1ecfe3</guid>
            <category><![CDATA[salesforce]]></category>
            <category><![CDATA[salesforce-development]]></category>
            <category><![CDATA[salesforce-knowledge]]></category>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 11:13:37 GMT</pubDate>
            <atom:updated>2024-10-29T21:14:12.812Z</atom:updated>
            <content:encoded><![CDATA[<h3>LWC Component — Salesforce Knowledge + API</h3><p>Enhancing Salesforce Knowledge with Lightning Web Components (LWCs) can significantly boost user engagement and accessibility. From interactive feedback and in-article search to content aggregation, LWCs provide innovative ways to make information more useful and streamlined, empowering both users and support teams. In my example ,I will be calling the prodcut third party api to bind the product details associated with the article .</p><p>Here is the repo link to start with</p><p><a href="https://github.com/chandanrjit/productInfo-lwc-component">GitHub - chandanrjit/productInfo-lwc-component: Get the Product Details from third party API based on SKU or Title or any other attributes</a></p><p>Below is the steps in high level</p><pre>- Build the LWC components<br>- Integrate the Poduct API<br>- Apex : Pass the knowledge attribute to get the data api</pre><p>Output will be as below ..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*li8xuCpXWbgN6TxhJXZ2lg.png" /><figcaption>Salesforce Knowledge</figcaption></figure><p><em>Note*:</em> I completed this proof of concept (POC) two years ago. I hope it’s still relevant and helpful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=018b9d1ecfe3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[b2c-crm-sync on Existing Sandbox: Salesforce]]></title>
            <link>https://medium.com/@chandanrjit/b2c-crm-sync-on-existing-sandbox-salesforce-5849f14bb9e1?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5849f14bb9e1</guid>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Mon, 09 Aug 2021 20:20:48 GMT</pubDate>
            <atom:updated>2021-09-01T06:07:28.246Z</atom:updated>
            <content:encoded><![CDATA[<p>While implementing the b2c-crm-sync, I faced some challenges or issues that I thought to document and share for other references, which will save time.</p><p>The topic may be a little off for the non-Salesforce group, but still, it can be easily understood if you know Nodejs and played with API. So let us start with the definition, <strong>What is this “b2c-crm-sync”</strong></p><p>As per the official <a href="https://github.com/SalesforceCommerceCloud/b2c-crm-sync">GitHub</a> below is the definition</p><blockquote>“b2c-crm-sync includes a framework for integrating these clouds (ex. B2C Commerce and Service Cloud) — leveraging REST APIs and the declarative capabilities of the Salesforce Platform”.</blockquote><p>The application is Node.js based and works mostly on the API level. so if Salesforce core wants to update or communicate to SFCC it will do via API.</p><p><strong>Github Project: </strong><a href="https://github.com/SalesforceCommerceCloud/b2c-crm-sync"><strong>b2c-crm-sync</strong></a></p><p>There are a few differences in steps execution with Scratch org vs existing Sandbox.</p><p><strong>Steps for execution</strong></p><ul><li>Nodejs and SFDX Setup: Same for both</li><li>B2C Commerce Setup Instructions: execute all the steps mention in Github. One thing to keep in mind is keeping the OCAPI access key saved somewhere which you will need for successful execution of the below command</li></ul><p>Please validate your B2C Commerce Agent credentials by executing the following CLI command: Replace the B2C_ACCESSKEY key with OCAPI one and run the below step.</p><p>npm run crm-sync:b2c:auth:bmuser</p><ul><li>For existing <strong>Sandbox</strong>, Below is the reference .env settings and instructions</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ob6V-cvsrNshHwpSy0CzNA.png" /></figure><ul><li>Run the deploy command and continue with the rest of the steps till JWT where I got stuck.</li></ul><p>npm run crm-sync:sf:org:deploy</p><ul><li>On JWT step: My authentication was failing due to the incorrect certificate developer name. Below error will come to incase in correct developername (SF_CERTDEVELOPERNAME)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z-gmf2_7xc5JqyMGq8ojog.png" /></figure><p>I am still exploring the GitHub project and will update this space once this is in production. Till that time, continue learning.</p><p>Cheers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5849f14bb9e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ES6 — Array Helper Methods]]></title>
            <link>https://medium.com/@chandanrjit/es6-array-helper-methods-ec357d3270d3?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec357d3270d3</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[array-methods]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Sun, 02 Dec 2018 11:48:43 GMT</pubDate>
            <atom:updated>2019-03-15T08:30:43.718Z</atom:updated>
            <content:encoded><![CDATA[<h3>ES6 — Array Helper Methods</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*_tc2tXfUOPcI2jGqCDzhPw.png" /><figcaption>list of array helpers methods</figcaption></figure><p><strong>ECMAScript v5.1 </strong>standards came in year 2011 and these helper methods were drafted as part of that .Finally, these helper methods were codify in ECMAScript 6 (ES6). These helper methods are around for a while and used as part of other modules i.e. lodash.</p><p>Let’s start with one by one and try to see the usage of each.To illustrate the difference , sample are written using “For loop” then using the helper methods with anonymous functions and helper methods with fat arrow function.</p><h3><strong>forEach</strong></h3><p>It performs the specified action for each element in an array. It accepts iteration function that iterate through each items in array. Let’s take an array and write using basic for loop and rewrite it using anonymous and at arrow function. Check out the below code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d08c605de78a55392a8985e414afe85/href">https://medium.com/media/9d08c605de78a55392a8985e414afe85/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*VlsCUr06YtMAjwG09JMnLQ.png" /></figure><h3>map</h3><p>This is most widely used helper method .It will loop through the each item of array ,process and return new set of array .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b4eb6ebb950d8b979e3205f98e7be52/href">https://medium.com/media/6b4eb6ebb950d8b979e3205f98e7be52/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*5N8vtwse4JxdqAMfD6b7LA.png" /></figure><h3>filter</h3><p>Returns the elements of an array that meet the condition specified in a callback function.In the below example we are filtering out the data which match out condition i.e. direction name here .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e23720669f07c13f67d724ddee21390/href">https://medium.com/media/7e23720669f07c13f67d724ddee21390/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*-qwE76ytwRGVOcDPbK2frw.png" /></figure><h3>find</h3><p>Returns the value of the first element in the array where predicate is true, and undefined .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7ca5fe3b0d3f77e244941d58509a06d/href">https://medium.com/media/e7ca5fe3b0d3f77e244941d58509a06d/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*eg95gO2RLgbYlc4aKyMGSA.png" /></figure><h3>some</h3><p>Performs the specified action for each element in an array. It iterator through items of array ,check if “any of item” fulfils the condition specified and return Boolean value .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6cf9ef16fdaea0a1f3f545baf5e3a517/href">https://medium.com/media/6cf9ef16fdaea0a1f3f545baf5e3a517/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*A8VhhPEVH-lwZaUv4DxwmA.png" /></figure><h3>every</h3><p>It is similar to the “some ” helper method but it validate that condition is fulfil by each item of the array.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/021c6d88965ce935c0e3ae0809a8b86c/href">https://medium.com/media/021c6d88965ce935c0e3ae0809a8b86c/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*yubyvT_2FA1SCXJkhBbLDw.png" /></figure><h3>reduce</h3><p>It is most flexible helper and other helpers method can be implemented using “reduce” helper .</p><blockquote>Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.</blockquote><p>In “reduce” , we need pass initial values for the functions.</p><p>Below is simple example we are doing sum and as initial value “0” is passed .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/84245e97cc8cc25d90a3a46bcaa3f308/href">https://medium.com/media/84245e97cc8cc25d90a3a46bcaa3f308/href</a></iframe><p>Result sum is 60 here .</p><p>Now let’s take a real practical example where we want to get all the email id from a “users”array .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/29772f898615eb95a9edcad7f028eb34/href">https://medium.com/media/29772f898615eb95a9edcad7f028eb34/href</a></iframe><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*26j8RI9eP21A4qcfRRUK5A.png" /></figure><blockquote>With these helpers now we can write better “Clean Code” and probability of introducing the error will also be less .</blockquote><p>Try out helper method and share with others . Cheers !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec357d3270d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visual Studio Code and Docker Extensions — Run your application using Docker]]></title>
            <link>https://medium.com/@chandanrjit/visual-studio-code-and-docker-extensions-run-your-application-using-docker-6958e2f721a?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6958e2f721a</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Thu, 21 Jun 2018 18:11:35 GMT</pubDate>
            <atom:updated>2018-06-22T03:35:43.665Z</atom:updated>
            <content:encoded><![CDATA[<p>Visual Studio Code as IDE is a choice for many developer as it is faster and having other good features related to debugging and testing. In this article, I would like to point out the easiness it give to the developer to configure Docker for the application in few click.</p><h4><strong>Let’s start</strong></h4><p>We will use Node.js &amp; express generator for the sample application.Run the below command to install express-generator to create an application skeleton</p><blockquote>npm install express-generator -g</blockquote><p>Step 1: Install the <a href="https://marketplace.visualstudio.com/items?itemName=PeterJausovec.vscode-docker">Docker Extension plugin</a> to the workspace</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*rp5IuAHmyYuv6sitGDnd3Q.png" /></figure><p>Step 2: Open the folder where you want to create the application skeleton and run the below command .It will create the basic express based application.</p><blockquote>express</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*Cjd6AsfPHV_PdhannO10mQ.png" /></figure><p>Step 3 : Run yarn install or npm install</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*NEVfxyai56qZ6WwOrxQjGg.png" /></figure><p>Step 4: Add Docker file to the application. Press F1 or Ctlr + Shift + P .It will open the window to select the command .Select the below steps</p><p>1. Select “Docker: Add Docker files to the Workspace “</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwH2DVo34QCY2VfC3tjA3g.png" /></figure><p>2. Select Node.js as platform</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Jj9yJyNWWxFLt_9co8Ffg.png" /></figure><p>3. Enter port no i.e. 3000 on which application will run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YzdHfzBKA946Ut8PzA5yfw.png" /></figure><p>It will add “Dockerfile “, “docker-compose.debug.yml” , “docker-compose.yml” to the Workspace.</p><p>Step 5: Now the next step is to prepare the build image which will have Node.js Docker base image and application code .</p><ol><li>Press F1 or Ctrl + Shift + P to open command window –Select Docker :Build Image</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*6gsO-SXvuesNcCN0ho1Y2Q.png" /></figure><p>2. Select the Docker file which will be used for build</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*NNdgkOc81L6XcayR_xlQXw.png" /></figure><p>3. Tag the build image i.e. docker-setup/latest in our example case</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*uww6U3VRBa4VTWmJYLRhcw.png" /></figure><p>Build preparation :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*FVgSrJEHMp6gPVaR_iFdng.png" /></figure><p>After the build is prepare ,Press F1 or Ctrl + Alt + P to select the command <strong>Docker run</strong> .Below command get executed .</p><blockquote>docker run — rm -d -p 3000:3000 docker-setup:latest</blockquote><blockquote>You can see the container status and on which port it is running .In our sample it is on <a href="http://localhost:3000/">http://localhost:3000</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-mGrPXypcJYvxLXNgPBLg.png" /></figure><p>Browse the URL to validate . Repository link <a href="https://github.com/chandanrjit/docker-setup">github</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUI2-xVoFIrQOkvl06cwig.png" /></figure><p>Hurray !! Application is up and running on Docker — Happy learning</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6958e2f721a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RESTful API design : Microservices — Continued .. Guideline /Documentation]]></title>
            <link>https://medium.com/@chandanrjit/restful-api-design-microservices-continue-guideline-documentation-8ee7c39161af?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ee7c39161af</guid>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[learning-microservices]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Fri, 02 Feb 2018 15:58:32 GMT</pubDate>
            <atom:updated>2018-07-23T15:24:52.457Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>RESTful API design : Microservices — Continued .. Guideline /Documentation</blockquote><h3><strong>General Guidelines for API</strong></h3><p>As such there is no industry standard, but below is the case preferred to use.</p><p><strong>In case of property name</strong></p><p>· Use camelCase and keep consistent across all API’s</p><p>· Array name should be plural</p><p>· Reserved keywords should be avoided</p><p><strong>For property value</strong></p><p>· Empty array should be represented by []</p><p>· Boolean properties must be null</p><p>· Null value should have their field</p><h3><strong>Naming</strong></h3><p>· URL contains long path url : Path segment must be lowercase and separated by hypens</p><p>e.g. /customer-details/{customer-id}</p><p>· Query parameter must be in lower case and separated by hypers in case of long</p><p>e.g. api/customer-details?customer-number=007&amp;order-id=007</p><p>· Prefer Hyphenated-Pasacal-Case for HTTP header fields</p><p>· First path segment should be /api</p><p>· Avoid trailing slashes</p><p>· Use conventional Query string for limit(no of entries,offset (numeric pffset page start) ,and sort</p><p>· Always use pluralized resource name</p><h3><strong>Documenting API</strong></h3><p>In Restful API, It is very important to document the implementation .It make easy to understand and use . There are many tools available .Below is the list having few of them</p><p>· Swagger : <a href="https://swagger.io/">https://swagger.io</a>/ — Open source tool <a href="https://swagger.io/specification/">https://swagger.io/specification/</a></p><p>· Spring Rest Docs : <a href="http://docs.spring.io/spring-restdocs/docs/1.0.0.M1/reference/html5">http://docs.spring.io/spring-restdocs/docs/1.0.0.M1/reference/html5</a></p><p>· RAML: <a href="http://raml.org/">http://raml.org</a></p><p>· ApiDocJS : <a href="http://apidocjs.com/">http://apidocjs.com</a></p><p>· SpringRestDoc : <a href="https://bitbucket.org/tritales/springrestdoc/overview">https://bitbucket.org/tritales/springrestdoc/overview</a></p><p>Happy learning …<br>If this post was helpful, please click the clap 👏button below a few times to show your support</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ee7c39161af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RESTful API design : Microservices]]></title>
            <link>https://medium.com/@chandanrjit/restful-api-design-microservices-f983e3ea3563?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f983e3ea3563</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[restful-api]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[restful]]></category>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Fri, 05 Jan 2018 15:00:11 GMT</pubDate>
            <atom:updated>2018-06-21T18:27:47.114Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>RESTful API design : Microservices</strong></blockquote><p>In the era of Microservices, it is essential to understand the basic of RESTful API design .REST stands for Representational state transfer .It is one of the software architectural style. In current IT industry there is no consensus on the correct way to designing the RESTful API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*znssV__5XouC71KuZcrGUA.png" /></figure><p>We can follow some of basic principle which will bring uniformity in the API development Key Requirement for REST API .Below is the some of the requirement that a successful API should be able to address</p><p>· It uses web standards(HTTP)</p><p>· Simple and consistent to make adaptation easy</p><p>· Friendly to developer</p><p>· Flexible</p><p>· Efficient and maintain the balance with functional requirement</p><p>· Well documented</p><p><strong>Maturity Model </strong><br><a href="https://www.crummy.com/writing/speaking/2008-QCon/act3.html">Leonard Richardson</a> has developed one modal called Richardson Maturity Modal which provides the way of using some of the REST design technique.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*DyK2Sic5SCTim7V7t9I33Q.png" /></figure><p>· Level 1 tackles the question of handling complexity by using divide and conquer, breaking a large service endpoint down into multiple resources.</p><p>· Level 2 introduces a standard set of verbs so that we handle similar situations in the same way, removing unnecessary variation.</p><p>· Level 3 introduces discoverability, providing a way of making a protocol more self-documenting.</p><p>The key principle of REST involves separating our API into logical resources. These resources are manipulated using HTTP requests where<br>each method (GET, POST, PUT, PATCH, DELETE) has specific meaning</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/194/1*meslBZROVc5DVWxV9PPvPA.png" /></figure><p>Now, let’s take the topic one by one to understand RESTful API</p><p>· What are resources</p><p>· Resources content representations</p><p>· Resources singularity</p><p>· Resource relations</p><p>· HTTP Verbs</p><p>· Resource Caching</p><p><strong>Resources: </strong>The core concept in any RESTful API is the resource. A resource is an object with a type, associated data, relationships to other resources, and a set of methods that operate on it. It is a noun that makes sense to the API consumer. After the resource identification we need to apply action to them and map to our API .For example</p><p>GET /orders — Retrieves a list of orders</p><p>GET / orders /11 — Retrieves a specific order</p><p>POST / orders — Creates a new order</p><p>PUT / orders /11– Updates order with id 11</p><p>PATCH / orders /11– Partially updates order with id 11</p><p>DELETE / orders /11– Deletes order with id 11</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*rd5fjy4qAnt0bg1TMFfihg.png" /></figure><p><strong>Resources content representations</strong></p><p>We have defined resources, and defined the data associated with them in terms of the JSON data model. However, these resources are still abstract entities. Before they can be communicated to a client over an HTTP connection, they need to be serialized to a textual representation. This representation can then be included as an entity in an HTTP message body</p><p><strong>Below is the list of Content-type:</strong></p><p>· JSON à application/x-resource+json application/x-collection+json</p><p>· YAML à application/x-resource+yaml application/x-collection+yaml</p><p>· XML à application/x-resource+xml application/x-collection+xml</p><p>· HTML à text/html</p><p><strong>Resource singularity</strong></p><p>It is pragmatic to keep the URL format consistent and to achieve that resource names should always use plural. This brings in uniformity from the API provider and consumer’s perspective.</p><p>GET / orders — Retrieves all the orders</p><p>GET / orders /11 — Retrieves order #11</p><p>Using the plural scheme will make the life of API consumer easy</p><p><strong>Resource Relations</strong></p><p>If a relation exists between two resources, it can represented using nested URL .Below is the example where orders and comments are two resources and how they can be represented</p><p>· GET /orders/12/comments — Retrieves a list of comments for order #12</p><p>· GET /orders/12/comments/5 — Retrieves comment #5 for order #12</p><p>· POST /orders/12/comments — Creates a new comment for order #12</p><p>· PUT /orders/12/comments/5 — Updates comment #5 for order #12</p><p>· PATCH /orders/12/comments/5 — Partially updates comment #5 for order #12</p><p>· DELETE /orders/12/comments/5 — Deletes comment #5 for order #12</p><p><strong>Filtering and Sorting</strong></p><p>This can be achieve using query parameters.</p><p><strong>Filtering: </strong>GET /tickets?sort=-priority — Retrieves a list of tickets in descending order of priority</p><p><strong>With Sorting:</strong> GET /tickets?sort=-priority,created_at — Retrieves a list of tickets in descending order of priority. Within a specific priority, older tickets are ordered first</p><p><strong>HTTP Verbs</strong></p><p>Following HTTP verbs are</p><p>GET — maps to a read operation. (GET /orders) Retrieves the details of a resource from the server</p><p>POST — maps to a create operation. (POST /orders) Creates a new instance of the resource on the server and returns the newly created resource. Actual contents of the resource to be created are sent as part of the request body.</p><p>PUT — maps to an update operation. (PUT /orders/{id})Updates the existing resource on the server and returns the updated version of the resource in the response. New representation of the resource is sent as part of the request body.</p><p>PATCH — maps to an update operation. This can be used when only a few fields of the resource need to be updated. (PATCH /orders/{id}). Works exactly like PUT but updates only part of a resource instead of complete overwrite.</p><p>DELETE — maps to a delete operation. (DELETE /orders/{id}). Deletes a resource from the server.</p><p><strong>Resource Caching</strong></p><p>It will help to reduce the round trip to the server when the response does not change It boost up the performance and reduce the load to the server .It can be acheive using API gateway or reverse proxy</p><p>Over the time API evolve and changes and expanse happens .There are several way to maintain the version</p><p><strong>API and Resource Version</strong></p><ol><li>Url version</li></ol><p><a href="http://host/v1/users">http://host/v1/users</a></p><p><a href="http://host/v2/users">http://host/v2/users</a></p><p>2. Version Number in HTTP request headers</p><p>GET /users/3 HTTP/1.1</p><p>Accept: application/vnd.users.v1+json</p><p>Trying to avoid long scroll on this, we still need to cover few more topics on Restful API e.g. JSON guideline, Security, documentation. I will cover it in part 2.</p><p>Happy learning …</p><p>If this post was helpful, please click the clap 👏button below a few times to show your support</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f983e3ea3563" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power of JS & CSS Bundler and minifier]]></title>
            <link>https://medium.com/@chandanrjit/power-of-js-css-bundler-and-minifier-f4c67a9f585e?source=rss-9e55d287edd6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4c67a9f585e</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[rollup]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Chandan Kumar Roy]]></dc:creator>
            <pubDate>Sat, 23 Sep 2017 14:46:25 GMT</pubDate>
            <atom:updated>2017-09-23T14:46:25.281Z</atom:updated>
            <content:encoded><![CDATA[<p>When we build any website or app, our objective is to give the user a smooth experience and keep user active. To achieve the objective we should make sure that assets (i.e. CSS, JS) are loaded quickly. Assets are bundled and minified to improve the load request time.</p><p>Let’s go through the bundling &amp; manification process one by one.</p><p><strong>Bundling</strong>: Yes, you are thinking correctly “tie or roll up together”. Here, we roll up JS /CSS to make one JS /CSS file. This means fewer http request and better page load performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*YH_-iDlvq4Lm7ONSrlBzPQ.png" /></figure><p><strong>Sample</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*aF1-gbuHN2u_6nSRgomrlQ.png" /></figure><p><strong>Minification </strong>: it means reduce the total file size .In this various optimisation is performed, such as removing comments ,white space and shorting the variable name .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*EhbuKQu8vT-iha11j0XNxg.png" /><figcaption>JavaScript is minified</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*AjL-QphUPs7lhxCe2bdu8w.png" /><figcaption>Sampled minified file</figcaption></figure><blockquote>Impact on Load time when CSS is minified in below sample application: Load time is reduced nearly by 50% .</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*1GW2nOwB73lKgjI62EybZw.png" /><figcaption>Page without minification</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*S4Wuk-eoxyXFZKy1YLYClw.png" /><figcaption><strong>Page with minification</strong></figcaption></figure><p>There are many libraries available for bundling and minifcation .</p><p><a href="https://www.slant.co/topics/3900/~frontend-javascript-module-bundlers">Slant - 11 best frontend JavaScript module bundlers as of 2017</a></p><p>Let’s explore more .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4c67a9f585e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>