<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>API on DecipherMiddleware</title><link>https://blog.deciphermiddleware.in/tags/api/</link><description>Recent content in API on DecipherMiddleware</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 24 Mar 2024 18:27:00 +0000</lastBuildDate><atom:link href="https://blog.deciphermiddleware.in/tags/api/index.xml" rel="self" type="application/rss+xml"/><item><title>Racer API | AnyPoint Speedway</title><link>https://blog.deciphermiddleware.in/posts/racer-api-anypoint-speedway/</link><pubDate>Sun, 24 Mar 2024 18:27:00 +0000</pubDate><guid>https://blog.deciphermiddleware.in/posts/racer-api-anypoint-speedway/</guid><description>&lt;p&gt;&lt;a href="https://www.anypointspeedway.com/"&gt;Anypoint Speedway &lt;/a&gt;(&lt;em&gt;The MuleSoft API Race Where Acceleration Meets Integration&lt;/em&gt;) is launched with Season 3. So, &lt;strong&gt;Muleys&lt;/strong&gt; all around the world get ready to &lt;strong&gt;RACE&lt;/strong&gt;. Once we scroll through the &lt;a href="https://www.anypointspeedway.com/instructions"&gt;instructions&lt;/a&gt;, we see a need for Racer API, which will be used to compete in the race. Currently, Racer API can be built in any of the platforms, all it needs is a public endpoint with implementation as per &lt;a href="https://anypoint.mulesoft.com/exchange/portals/anypoint-speedway/ae6d7954-6fc2-4f3e-8777-80ff8aabd859/racer-api/minor/2.0/pages/home/"&gt;specification&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/63e810df81.jpg"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/63e810df81.jpg" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But, we are the MuleSoft developers, so let&amp;rsquo;s build the API in MuleSoft. If you are a beginner or professional Muley, this article will help you implement the Racer API and participate in the race. Let&amp;rsquo;s fasten up the seatbelt and start developing the &lt;strong&gt;Racer API&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/33190abc91.gif"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/33190abc91.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Anypoint Speedway has made our lives easier by providing the readily available &lt;a href="https://anypoint.mulesoft.com/exchange/portals/anypoint-speedway/ae6d7954-6fc2-4f3e-8777-80ff8aabd859/racer-api/minor/2.0/pages/home/"&gt;specification &lt;/a&gt;file.&lt;/p&gt;
&lt;h2 id="pre-requisite"&gt;Pre-requisite &lt;a href="#pre-requisite" class="anchor"&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;h3 id="racerid"&gt;racerId &lt;a href="#racerid" class="anchor"&gt;🔗&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;To enter the race, the RACER is required to register for the race and get a racerId.&lt;/p&gt;
&lt;p&gt;1. Go to &lt;a href="https://anypoint.mulesoft.com/exchange/portals/anypoint-speedway/ae6d7954-6fc2-4f3e-8777-80ff8aabd859/anypoint-race-api/minor/3.2/pages/home/"&gt;Anypoint Race API,&lt;/a&gt; and Click on Request Access. Log in with AnyPoint Platform credentials.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/ef0e5db25a.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/ef0e5db25a.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. Fill in the details as shown below. If an application is not seen, create a new application by providing the name. Click on Request access. For initial access use the &lt;strong&gt;Basic SLA tier&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/82af5a9555.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/82af5a9555.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3. This will generate/show the client-id and client-secret which will be used to authenticate the requests to Anypoint Race API.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/80c7611e60.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/80c7611e60.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;4. Go to&lt;a href="https://anypoint.mulesoft.com/exchange/portals/anypoint-speedway/ae6d7954-6fc2-4f3e-8777-80ff8aabd859/anypoint-race-api/minor/3.2/console/method/%2342/"&gt; POST /register&lt;/a&gt; resource. Follow the instructions to generate a racerId. You may use the portal to send a request or any rest client(e.g. Postman) to send a request and get a racerId for your racer.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;displayName&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Sylvester the Cat&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;email&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;sylvester@wb.com&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;racerId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;racer-id-value&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;clientId&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;clientId&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Highlighted &lt;strong&gt;racerId&lt;/strong&gt; will be used in building the &lt;strong&gt;RACER API&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id="racer-api"&gt;RACER API &lt;a href="#racer-api" class="anchor"&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;1. Download the RAML specification file from the Anypoint Speedway &lt;a href="https://anypoint.mulesoft.com/exchange/portals/anypoint-speedway/ae6d7954-6fc2-4f3e-8777-80ff8aabd859/racer-api/minor/2.0/pages/home/"&gt;portal&lt;/a&gt;. Click on Download and then as RAML. RAML file will be downloaded to the system.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/7c606ee3c8.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/7c606ee3c8.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;2. Open AnyPoint Studio. Click on file, then New and then Click on Mule Project.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/cfc65c880a.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/cfc65c880a.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;3. Enter the project/racer name, specify the downloaded file&amp;rsquo;s location, and click on finish.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/b4aa4f8cce.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/b4aa4f8cce.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A project will be created with scaffold flows as per the specification file.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/d31e13d2a8.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/d31e13d2a8.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Let&amp;rsquo;s build the flows for&lt;strong&gt;Tier I&lt;/strong&gt;. For &lt;strong&gt;Tier I&lt;/strong&gt; , the token is required to be used in further requests. For this, an object store can be used.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;4. Add the &lt;strong&gt;ObjectStore&lt;/strong&gt; module in Mule Palette. Click on Global Elements, then click on Create.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/1a020e54d9.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/1a020e54d9.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/1bd3884817.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/1bd3884817.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;5. Select ObjectStore Config under Connector configurations. Click on OK.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/ff57ba3115.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/ff57ba3115.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;6. Check the Connection checkbox and click on OK. A connection configuration will be created.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/35bf9a2747.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/35bf9a2747.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;7. Click on Create again to add another global configuration for ObjectStore. Select ObjectStore under Component Configuration and click OK.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/bf81d7351d.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/bf81d7351d.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;8. Specify the connection reference for ObjectStore created in the previous step. Click OK.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/cf97b7edc1.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/cf97b7edc1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;9. Click on Message flow to go back to flows. Go to &amp;ldquo;&lt;strong&gt;post:\races:application\json:racer-api-config&lt;/strong&gt; &amp;quot; flow configuration.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/733b7f587f.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/733b7f587f.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;10. Drag and drop the &lt;strong&gt;Store&lt;/strong&gt; connector from the Mule Palette. Specify the details as mentioned in the below screenshot.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/b56b5c02f1.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/b56b5c02f1.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;11. Drag a set variable and set the &lt;strong&gt;name&lt;/strong&gt; as &lt;strong&gt;raceId&lt;/strong&gt; and &lt;strong&gt;value&lt;/strong&gt; as &lt;strong&gt;uuid().&lt;/strong&gt; Configuration should look like as below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/841483629a.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/841483629a.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;12. Drag a transform message and set the values as shown below. Replace the &amp;ldquo;&lt;strong&gt;race-id-value&lt;/strong&gt; &amp;quot; with the value, received from the &lt;strong&gt;Anypoint Race API POST /register.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/3e92586c6c.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/3e92586c6c.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;13. The overall flow will look like below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/4c399c4a03.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/4c399c4a03.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;To pass&lt;strong&gt;Tier I&lt;/strong&gt; , at least &lt;strong&gt;1 lap&lt;/strong&gt; needs to be completed. Let&amp;rsquo;s update the &amp;ldquo;post:\races\(id)\laps:text\plain:racer-api-config&amp;rdquo;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;14. Drag the &lt;strong&gt;Retrieve&lt;/strong&gt; connector under ObjectStore from Mule Palette, and place it after the transform message. Specify the values as shown below. Token value will be retrieved from the Object store.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/4da6c3839e.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/4da6c3839e.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;15. Drag the transform connector. And update the transform connector with values as below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/e633aba2ca.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/e633aba2ca.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The flow will look as below.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/9330107269.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/9330107269.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;16. Save and export the API. Right-click &lt;strong&gt;racer&lt;/strong&gt; project -&amp;gt; Export. Under Mule, select Anypoint Studio Project to Mule deployable archive. Click Next.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/f4dc1aaf64.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/f4dc1aaf64.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;17. Specify the export jar location and click on Finish.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/c09867d13b.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/c09867d13b.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;_Now the **RACER API **is ready to race for &lt;strong&gt;Tier I&lt;/strong&gt;. Let&amp;rsquo;s deploy to the AnyPoint platform and start the race. _&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/c528afff99.gif"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/c528afff99.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;18. Go to the AnyPoint platform, then to Runtime Manager, select the environment where you want to deploy. Click on &lt;strong&gt;Deploy application&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;19. Specify the application name, and upload the jar file created in the previous step. Tick the checkbox to use ObjectStore V2 and click on Deploy.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/9c8aa7890c.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/9c8aa7890c.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/87dfd87b20.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/87dfd87b20.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After deployment, a public URL similar to &amp;ldquo;&lt;a href="https://deciphermiddleware-racer-syivqn.5sc6y6-4.usa-e2.cloudhub.io"&gt;https://deciphermiddleware-racer-syivqn.5sc6y6-4.usa-e2.cloudhub.io&lt;/a&gt;&amp;rdquo; will be generated. This will be used to enter the race and compete with other racers.&lt;/p&gt;
&lt;h2 id="enter-the-race"&gt;Enter the Race &lt;a href="#enter-the-race" class="anchor"&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/eddf148fae.gif"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/eddf148fae.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;1. To make an entry in the race, trigger a request to Anypoint Race API &lt;a href="https://anypoint.mulesoft.com/exchange/portals/anypoint-speedway/ae6d7954-6fc2-4f3e-8777-80ff8aabd859/anypoint-race-api/minor/3.2/console/method/%2382/"&gt;POST /racers/{racerId}/entry&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;2. Provide the public endpoint along with &lt;strong&gt;/api&lt;/strong&gt; &amp;ldquo;&lt;strong&gt;API kit is used /api is added before every resource&lt;/strong&gt; &amp;ldquo;. Any REST client can be used to trigger the request by providing details as mentioned in the API documentation.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/dbed3aced4.png"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/dbed3aced4.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The RACER has started RACING. Go to the &lt;a href="https://www.anypointspeedway.com/leaderboard"&gt;Leaderboard &lt;/a&gt;and see your racer name coming up.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/cfd707255c.gif"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/cfd707255c.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Oh wait there are a total of 5 Tiers&lt;/strong&gt;! So, wear your &lt;strong&gt;developer&lt;/strong&gt; hats and enhance the &lt;strong&gt;Rookie Racer&lt;/strong&gt; to level up to &lt;strong&gt;Tier V&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/955bcc363e.gif"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/955bcc363e.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="all-the-best-racers-lets-race"&gt;All the best Racers, Let&amp;rsquo;s Race!!! &lt;a href="#all-the-best-racers-lets-race" class="anchor"&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;&lt;a href="https://blog.deciphermiddleware.in/images/blogger/91fef0e7bd.gif"&gt;&lt;img src="https://blog.deciphermiddleware.in/images/blogger/91fef0e7bd.gif" alt=""&gt;&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>