<?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: Davor Kolenc</title>
    <description>The latest articles on DEV Community by Davor Kolenc (@davorkolenc).</description>
    <link>https://dev.to/davorkolenc</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%2F1084408%2F2b970bb5-238a-480d-ad1a-23ca9e678ba7.jpg</url>
      <title>DEV Community: Davor Kolenc</title>
      <link>https://dev.to/davorkolenc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davorkolenc"/>
    <language>en</language>
    <item>
      <title>Treblle Hacktoberfest: A Nightmare on Coding Street</title>
      <dc:creator>Davor Kolenc</dc:creator>
      <pubDate>Thu, 28 Sep 2023 13:50:07 +0000</pubDate>
      <link>https://dev.to/davorkolenc/treblle-hacktoberfest-a-nightmare-on-coding-street-6f</link>
      <guid>https://dev.to/davorkolenc/treblle-hacktoberfest-a-nightmare-on-coding-street-6f</guid>
      <description>&lt;p&gt;&lt;code&gt;Treblle Hacktoberfest! A Nightmare on Coding Street: Conquer Github's Dark Dungeons. Cash prize pool: $6,600.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;"In the dark heart of GitHub, where code nightmares come to life, Treblle's Hackathon for Hacktoberfest awaits! 👻💻&lt;/p&gt;

&lt;p&gt;Developers, heed this call dread! Venture forth and craft your sinister SDKs to win favor with the ancient forgotten gods of the Treblle Community Repo. But beware, for GitHub's haunted halls hold merge conflicts and unresolved issues that can ensnare the unwary. 😈🔗&lt;/p&gt;

&lt;p&gt;However, amid the terror, there's still room for laughter. This hackathon unleashes your coding creativity, forging tools that'll haunt the digital realm. Will you be a coding champion, or just another forgotten line of code? The choice is yours. Github repositories beckon! 🌑💀👹🔥🎃&lt;/p&gt;

&lt;p&gt;To enter, submit your soul—I mean, application—via the dreaded Google Form. Once accepted, form alliances with fellow developers to navigate this digital labyrinth and await your judgement day. 🌐🔮&lt;/p&gt;

&lt;p&gt;The sands of time are running out for you, so make haste. Adventurers set off on their dreaded journey on the 15th October 2023. Anyone left behind, will be lunch. ⏳ 🍽️"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sincerely, Count Codeula&lt;/li&gt;
&lt;/ul&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%2Ft2zhgsqz7mrn8ytpy8f6.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%2Ft2zhgsqz7mrn8ytpy8f6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;=&amp;gt; &lt;a href="https://docs.google.com/forms/d/1DhMqlN1_HyhrU279ZihGhhN-K555_VBg1OZ_2sQQhxI/edit?ref=blog.treblle.com" rel="noopener noreferrer"&gt;APPLY HERE&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  SCHEDULE
&lt;/h2&gt;

&lt;p&gt;The Treblle Hactoberfest will be divided into 2 weeks. The first week will be a great opportunity to learn about APIs, SDKs, Versoninig and other API-related topics from industry leaders.&lt;/p&gt;

&lt;p&gt;The second week is the week where you will be tasked to build an SDK for Treblle.&lt;/p&gt;

&lt;p&gt;The schedule will be updated as the week of the Hacktoberfest approaches. Join our Discord Community to stay updated!&lt;/p&gt;

&lt;p&gt;Check out the official &lt;a href="https://hacked.treblle.com/" rel="noopener noreferrer"&gt;Treblle hacked website here.&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;WEEK1 (Oct 9 - Oct 13, 2023)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Monday, October 9, speakers:&lt;/p&gt;

&lt;p&gt;Kick-off Livestream&lt;br&gt;
Andrew Schemelyun&lt;br&gt;
Stephen Rees-Carter&lt;br&gt;
Tuesday, October 10, speakers:&lt;/p&gt;

&lt;p&gt;Phil Sturgeon&lt;br&gt;
Wendell Adriel&lt;br&gt;
Sam Carré&lt;br&gt;
Wednesday, October 11, speakers:&lt;/p&gt;

&lt;p&gt;Rob Allen&lt;br&gt;
Zuzana Kunchova&lt;br&gt;
Lorna Mitchell&lt;br&gt;
Thursday, October 12, speakers:&lt;/p&gt;

&lt;p&gt;Jim Seconde&lt;br&gt;
Ahmed Shamim Hassan&lt;br&gt;
Daniel Roe&lt;br&gt;
Friday, October 13, Livestream:&lt;/p&gt;

&lt;p&gt;Steve McDougall (10:30 BST) - 45 mins&lt;br&gt;
Chris Miller (13:30 BST) - 45 mins&lt;br&gt;
Mike Elsmore (16:00 BST) - 45 mins&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;WEEK 2 (Oct 15 - Oct 20, 2023)&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Treblle hacktoberfest hackathon, all day, every day!&lt;/p&gt;

&lt;h2&gt;
  
  
  🎃 TREBLLE HACKTOBERFEST RULES 🎃
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What will you exactly be building? 🛠&lt;/strong&gt;&lt;br&gt;
You will be building an SDK for our platform, Treblle. Your SDK can be built with any language or framework of your choosing. If our judges find that you have copied from an existing official or community SDK then your SDK will not be taken into consideration, and you will be disqualified from the Hackathon. If you need help in building the SDK here is the link to our &lt;a href="https://docs.treblle.com/en/sdk-development?ref=blog.treblle.com" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;, otherwise our judges will be available during office hours in our community Discord.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When can you enter? 🏟&lt;/strong&gt;&lt;br&gt;
You have until the 15th of October 2023 to submit your entry via the &lt;a href="https://docs.google.com/forms/d/1DhMqlN1_HyhrU279ZihGhhN-K555_VBg1OZ_2sQQhxI/edit?ref=blog.treblle.com" rel="noopener noreferrer"&gt;Google Form&lt;/a&gt;, any entries from the 15th onwards will not be taken into consideration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How big can the teams be, and can you participate as a solo developer? 🏋️⛹️‍♀️🤾‍♂️🏌️‍♂️&lt;/strong&gt;&lt;br&gt;
Each team can have a maximum of four members, where one has to be named the team captain. You are able to enter as a solo developer, however you are not allowed to participate in more than one team, or as a team and a solo entry. If you are participating as a member of multiple teams, or as a solo developer and a team, both the teams that you are a member of and yourself will be disqualified from further competition.&lt;/p&gt;

&lt;h2&gt;
  
  
  Team names 🍻
&lt;/h2&gt;

&lt;p&gt;Does your monster squad have a team name? You can be “scary”, but be respectful with your naming. Even vampires and zombies have feelings. Our board of vampires and zombies reserve the right to change your team name if it does not comply with our &lt;a href="https://github.com/Treblle/community/blob/main/CODE_OF_CONDUCT.md?ref=blog.treblle.com" rel="noopener noreferrer"&gt;Community guidelines&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Every team consisting of 2 - 4 members must have a name, and if you are competing as an individual, a “team” name is optional - you can simply use your name or use an alias if you wish.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is going to be judged (SDK requirements)? 🎃&lt;/strong&gt;&lt;br&gt;
Our judges will rise from the dead to go through your code and your SDKs will be fairly judged. After they have a fresh brain for breakfast, the things they will be looking at are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Masking&lt;/li&gt;
&lt;li&gt;Load Balancing&lt;/li&gt;
&lt;li&gt;JSON Schema (80% covered at least)&lt;/li&gt;
&lt;li&gt;Securing API Keys&lt;/li&gt;
&lt;li&gt;Example project using your SDK&lt;/li&gt;
&lt;li&gt;Use our SDK template (insert link here)&lt;/li&gt;
&lt;li&gt;Updated README with complete instructions on how to setup said SDK&lt;/li&gt;
&lt;li&gt;Setup SDK debugging logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To see in detail how Treblle SDKs are built, please reference the &lt;strong&gt;&lt;em&gt;&lt;a href="https://docs.treblle.com/en/sdk-development?ref=blog.treblle.com" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens to my SDK when published? 🦾&lt;/strong&gt;&lt;br&gt;
When you have finished with your Hackathon submission, you still own the code on your GitHub repository. We will publish a link to this in the Treblle Community repository as well as in our official documentation.&lt;/p&gt;

&lt;p&gt;What do I need to do after the SDK has been built? 👀&lt;br&gt;
Once you have finished with your submission, you need to invite the judges to a Treblle project so they are able to see a working example. They will also need to be given access to the GitHub repository so they can review the code, and test it themselves. Once these steps have been completed, simply signal us on Discord so that we know you are ready for judgment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Hackathon IS NOT open to: 💙&lt;/strong&gt;&lt;br&gt;
Individuals who are residents of, or Organizations domiciled in, a country, state, province or territory where the laws of the United States or local law prohibits participating or receiving a prize in the Hackathon (including, but not limited to, Quebec, Russia, Crimea, Cuba, Iran, North Korea, Syria and any other country designated by the United States Treasury's Office of Foreign Assets Control)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Complaints: ⚠️&lt;/strong&gt;&lt;br&gt;
If you have an issue, or find something unfair - please use the following &lt;strong&gt;&lt;a href="https://docs.google.com/forms/d/e/1FAIpQLSftMuX12JEPB89aTpq-SNZCUR-hl2RHuS-4u5TJ1ULnm_A55A/viewform?ref=blog.treblle.com" rel="noopener noreferrer"&gt;Google form&lt;/a&gt;&lt;/strong&gt; to log a complaint. Complaints sent through the Google form will go through a review process, and action will be decided. Any complaint not sent through this form, will not be answered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prizes 🎁🎁🎁
&lt;/h2&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%2F33cn20w8lpjw2qfphvhu.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%2F33cn20w8lpjw2qfphvhu.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With a total cash prize pool of around $6,660, prizes are available for the top ten entries.&lt;/p&gt;

&lt;p&gt;Cash prizes will be in the form of a digital Visa card sent to team captains, and the lead participant in the case of a solo entry. It is then down to the team captain to distribute the prize in their own agreed way. We are not responsible for how you handle the distribution of prizes.&lt;/p&gt;

&lt;p&gt;Physical prizes will be in the form of a digital redemption code, that you are able to use once on our swag portal. If you are lucky enough to be in the top five, you and each member of your team will receive an annual &lt;strong&gt;&lt;a href="https://www.treblle.com/pricing?ref=blog.treblle.com" rel="noopener noreferrer"&gt;Team Plan&lt;/a&gt;&lt;/strong&gt; for Treblle. If you are in the top ten, but not the top five, then you and your team members will each receive an annual Starter Plan.&lt;/p&gt;

&lt;p&gt;With a total cash prize pool of around $6,660, prizes are available for the top ten entries.&lt;/p&gt;

&lt;p&gt;Cash prizes will be in the form of a digital Visa card sent to team captains, and the lead participant in the case of a solo entry. It is then down to the team captain to distribute the prize in their own agreed way. We are not responsible for how you handle the distribution of prizes.&lt;/p&gt;

&lt;p&gt;Physical prizes will be in the form of a digital redemption code, that you are able to use once on our swag portal. If you are lucky enough to be in the top five, you and each member of your team will receive an annual Team Plan for Treblle. If you are in the top ten, but not the top five, then you and your team members will each receive an annual Starter Plan.&lt;/p&gt;

&lt;p&gt;Here is the complete list of prizes for the teams that end up in the first 10:&lt;/p&gt;

&lt;p&gt;🥇 1st Place: $2666 + Special edition Hoodies, T-Shirts and Socks for every team member&lt;br&gt;
🥈 2nd Place: $1666 + Special edition Hoodies, T-Shirts and Socks for every team member&lt;br&gt;
🥈 3rd Place: $666 + Special edition Hoodies, T-Shirts and Socks for every team member&lt;/p&gt;

&lt;p&gt;4th Place: $500 + T-Shirts and Socks for every team member&lt;br&gt;
5th Place: $400 + T-Shirts and Socks for every team member&lt;br&gt;
6th Place: $200 + Socks for every team member&lt;br&gt;
7th Place: $200 + Socks for every team member&lt;/p&gt;

&lt;p&gt;8th Place: $162 + Socks for every team member&lt;br&gt;
9th Place: $100 + Socks for every team member&lt;br&gt;
10th Place: $100 + Socks for every team member&lt;br&gt;
See you all there and good luck!&lt;/p&gt;

</description>
      <category>hacktoberfest23</category>
      <category>hackathon</category>
      <category>api</category>
      <category>sdk</category>
    </item>
    <item>
      <title>Building Alfred, our AI-powered API assistant</title>
      <dc:creator>Davor Kolenc</dc:creator>
      <pubDate>Thu, 20 Jul 2023 13:09:45 +0000</pubDate>
      <link>https://dev.to/davorkolenc/building-alfred-our-ai-powered-api-assistant-4chn</link>
      <guid>https://dev.to/davorkolenc/building-alfred-our-ai-powered-api-assistant-4chn</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RUEAueFe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ko05guhgzd7fm3t8u8ac.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RUEAueFe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ko05guhgzd7fm3t8u8ac.png" alt="Image description" width="800" height="418"&gt;&lt;/a&gt;&lt;em&gt;&lt;a href="https://blog.treblle.com/building-alfred-our-ai-powered-api-assistant/"&gt;Written by Vedran&lt;/a&gt;, Founder of Treblle&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I’m a big fan of Batman, always have been and always will be. Dark Knight is one of my all time favorite movies. Have I imagined being Bruce Wayne more times that I should have - why yes I have. What’s stopping me, you ask? Well, theoretically I could get lean, learn MMA (or Jiu-Jitsu like Zuck) and stop being, ever so slightly, afraid of heights. But, but, but…I am missing about $100B in my bank account that would allow me to have all the cool toys, cars, caves as well as a butler. So being the grown up that I am (😉) I decided to put that dream aside and focus on the next best thing: building my own personal Alfred. Except my Alfred helps fight the injustices in the API world and not bad the guys of Gotham City.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two things before we continue:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First - just realized that Zuck could actually be The Batman 👀😱. He’s worth $103B, is fit and, like I mentioned, knows Jiu-Jitsu… 🤔&lt;/p&gt;

&lt;h2&gt;
  
  
  The year of the AI
&lt;/h2&gt;

&lt;p&gt;The Chinese Zodiac says that 2023. is the year of the Rabbit. Numerology says it’s the year of Spiritual Reflection. VCs have it pinned down as the year of the AI 🙃. Basically, everyone is all-in on AI.&lt;/p&gt;

&lt;p&gt;Don’t get me wrong I have nothing against AI. Personally, I think it’s one of those evolutionary things. It’s inevitable, it was bound to happen and I’m really excited to see where it goes next. But the hype around it is something I’ve never seen before. The crypto bubble seems like a little baby compared to this. Everyone is building AI tools, assistants or baking it into their product in one or the other way.&lt;/p&gt;

&lt;p&gt;On the surface all of those seem groundbreaking, 10x time saving, revolutionary and will eventually leave us without a job type of products. Well, at least that’s how they’re marketed. The reality, however, is a bit different. In most cases, these tools are just a handful of API calls to a few core services like OpenAI, Bard, AWS, Azure and others. Yes, there’s a lot of innovation happening on an ML/LLM level and there are folks who are doing some really interesting stuff but AI powered Kombucha isn’t one of them.&lt;/p&gt;

&lt;p&gt;The good thing, for us at Treblle, is that all of this AI action equals more API calls. That, of course, is good for business 🤑. What makes these AI API calls special is that you need to actually see the inputs and outputs in order to understand the outcomes. What do I mean by that? Let’s say you have an API that simply creates a new account for the user. The outcome of that API call can only be one of two:&lt;/p&gt;

&lt;p&gt;0 =&amp;gt; it didn’t work and the user account wasn’t created&lt;br&gt;
1 =&amp;gt; it did work and the user account was created.&lt;/p&gt;

&lt;p&gt;With these &lt;a href="https://www.treblle.com/features/api-assistant"&gt;AI tools&lt;/a&gt;, however, outcomes can be a lot of things in between. It can be a bad answer, a good one or a horrible one. It really depends on the prompt, the LLM, the training set and a lot of other things…the point is you need observability and understanding in order to figure this out. Coincidentally Treblle is amazing at this 😛.&lt;/p&gt;

&lt;p&gt;But being amazing at observability doesn’t mean we’re immune to market trends. Every VC, industry analyst, and random engineering manager I’ve spoken to asked about AI in one way, shape or form. It reminded me of my high school days where if you didn’t listen to Eminen when he released The Eminem Show album in ‘02, simply put - you weren’t cool. I wanted Treblle to be at the cool kids table but at the same time I didn’t want to build yet another useless, bullshit AI product. So I got to thinking.&lt;/p&gt;
&lt;h2&gt;
  
  
  Hello Alfred;
&lt;/h2&gt;

&lt;p&gt;One of the earliest feature requests that Tea, our Head of native apps, had was the &lt;a href="https://www.treblle.com/features/api-assistant"&gt;ability to generate code for SwiftUI&lt;/a&gt; models based on the API docs. When you’re developing an API it’s quite prone to changes on multiple fronts - from naming conventions, endpoints to the documentation. It’s a lot of manual and boring work to keep these things in sync without going crazy. I told her I’d look into it. And I really did. There were some code generation tools that looked like they could do the job but they all seemed cumbersome and very limited. In classic engineer fashion I whispered to myself: “Vedran, you can do this better yourself - probably in a weekend or less!”. Two years passed and that weekend never came 😅The idea always stuck with me though.&lt;/p&gt;

&lt;p&gt;When all the generative AI hype started I wanted to actually see how it renders code. Mostly because I was a bit worried about it replacing me as an engineer 😁. This is one of those primal fears that every engineer has in the back of their mind. If you’re an engineer - you know! Anyhow, my go to test for all these generators is always PHP. It’s probably the most underrated language out there and also the one that I’ve been working with for the past 15 years. So I asked ChatGPT the following: “Show me how to create a POST request using the Laravel HTTP Facade”. Note: See how I wanted to trick it by being super specific with the HTTP Facade. It, however, returned the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
use Illuminate\Support\Facades\Http;

$response = Http::post('https://api.example.com/endpoint', [
    'param1' =&amp;gt; 'value1',
    'param2' =&amp;gt; 'value2',
]);

if ($response-&amp;gt;successful()) {
    $responseData = $response-&amp;gt;json();
} else {
    $statusCode = $response-&amp;gt;status();
    $errorData = $response-&amp;gt;json();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wiped the smirking smile off my face and realized that this is quite close to what I would have written myself. After taking a breather and examining my life choices for a moment I realized that we need to somehow put this to work in the context of Treblle.&lt;/p&gt;

&lt;p&gt;My next thought was let’s see how much it understands about APIs and OpenAPI Spec. Turns out - a lot. It answered all my questions, no matter how I asked them. I realized that it fully understood OpenAPI Spec and that OpenAI probably trained the model to perfection so it could help them generate connections and integrations faster. (I don’t have any proof of this, it's just a theory. Well, actually, I’m quite convinced at this point because I’ve compared some other LLMs and their understanding of OpenAPI Spec doesn’t come close).&lt;/p&gt;

&lt;p&gt;Now, you’re wondering why am I talking about OpenAPI Spec so much? Well, see, APIs are mostly a mess. But one thing that a lot of people have learned not to hate is OpenAPI Spec. It’s the way engineers generally document their APIs. They just do it manually, like cavemen. One of the things that Treblle does is it generates documentation for your API automatically 🤷‍♂️. You add our SDK, make a request and we figure out what endpoint that is, generate docs for it, build you a developer portal and keep the docs updated as new requests come in. Wham! Bam! Thank You Ma'am.&lt;/p&gt;

&lt;p&gt;Given that we already had documentation in OpenAPI Spec format for every API using Treblle I wanted to combine it with the power of OpenAI code generation and natural language understanding. The idea was: you land on our auto-generated developer portal, you can read the docs or you can use the generative, open-ended chat interface to get answers, get code samples, models or tests. The possibilities were endless but the only way it’s actually useful and cool is to understand that exact API documentation.&lt;/p&gt;

&lt;p&gt;I knew I had to send the documentation as part of the prompt. Somehow. I first tried this prompt: Give me all the endpoints from this OpenAPI Spec file: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json"&gt;https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;It worked like a charm, it read the JSON from that link, understood the documentation and could do anything with it now. But note the link to a file on Github. Turns out that’s a problem. OpenAI won’t read external links except for a select few like Github, Microsoft and a few others. If you’ve ever wondered what $10B gets you - now you know.&lt;/p&gt;

&lt;p&gt;After the disappointment with the links I gave up for a few hours until I learned about system messages in the OpenAI API. System messages allow you to basically tell the AI to pretend to be someone or something. For an example “Pretend to be Indiana Jones” or “Pretend to be British and answer only with a British accent” 😆. I realized I could tell it to pretend to be an OpenAPI Spec parser and send the entire OpenAPI Spec as a JSON blog in the first prompt. So when a user asks a question I basically fire of an API call to OpenAI that looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
use OpenAI\Laravel\Facades\OpenAI;

$response = OpenAI::chat()-&amp;gt;create([
    'model' =&amp;gt; 'gpt-3.5-turbo',
    'messages' =&amp;gt; [
        ['role' =&amp;gt; 'system', 'content' =&amp;gt; 'You are an OpenAPI Spec parser reading this documentation: $this-&amp;gt;oas($project-&amp;gt;uuid)],
        ['role' =&amp;gt; 'user', 'content' =&amp;gt; $request-&amp;gt;message],
     ],
]);
foreach ($response-&amp;gt;choices as $choice) {
    array_push($messages, $choice-&amp;gt;message-&amp;gt;content);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that the first message is actually that pre-prompt with the system role where I send the entire JSON of the OpenAPI Spec for that API. And guess what - it works. With that system message and the raw JSON it can answer any question you ask about that specific API as well as generate any imaginable code with that understanding.&lt;/p&gt;

&lt;p&gt;It worked like a charm but it was quite slow. It’s fascinating how we’re super sensitive to the slowness of API calls. I knew the amount of work it was doing in the background, the amount of computational power it was using but waiting 20-30 seconds to get a code example wasn’t sexy. I started testing ways of improving it. The UI was my starting point. I added a bunch of niceties to keep you entertained but that only made it slightly better. I compared Google Bard, OpenAI and a few other specific code generation AIs. I then discovered that Microsoft has its own version of the OpenAI API and for some reason it’s simply faster to respond. I assume it’s because Microsoft is giving it all the power it's got to generate the response and that they don’t have to do a network hop from one server to another like OpenAI has to them. So I ended up using the Microsoft version of OpenAI.&lt;/p&gt;

&lt;p&gt;The final piece of resistance was actually implementing streaming. OpenAI allows streaming responses which essentially means that as the AI is returning generated content (letters, code, sentences…) you can get them letter by letter instead of waiting for the entire response. This meant that I could drastically reduce the amount of wait for the user and he would start seeing content appear within 4-5 seconds. Which is amazing. Implementing this in a Laravel running on top of Vapor turned out to be a bit of a hassle. The back-end side of things looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

use OpenAI\Laravel\Facades\OpenAI;

return response()-&amp;gt;stream(function () use ($question, $project) {
            $stream = OpenAI::chat()-&amp;gt;createStreamed([
                'model' =&amp;gt; 'gpt-3.5-turbo',
                'messages' =&amp;gt; [
                    ['role' =&amp;gt; 'system', 'content' =&amp;gt; $this-&amp;gt;oas($project-&amp;gt;uuid)],
                    ['role' =&amp;gt; 'user', 'content' =&amp;gt; $question],
                ]
            ]);


            foreach ($stream as $response) {

                $text = $response-&amp;gt;choices[0]-&amp;gt;delta-&amp;gt;content;

               if (connection_aborted()) {
                    break;
                }

                echo "event: update\n";
                echo 'data: ' . $text;
                echo "\n\n";
                ob_flush();
                flush();
            }

            echo "event: update\n";
            echo 'data: &amp;lt;END_STREAMING_SSE&amp;gt;';
            echo "\n\n";
            ob_flush();
            flush();
        }, 200, [
            'Cache-Control' =&amp;gt; 'no-cache',
            'X-Accel-Buffering' =&amp;gt; 'no',
            'Content-Type' =&amp;gt; 'text/event-stream',
        ]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The front-end part is using a technique called Server-sent Events and looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Empty string where we keep the streamed markdown as it comes in
var markdown_string = '';

/*
    We need to convert markdown to HTML using: https://github.com/showdownjs/showdown 
*/
var converter = new showdown.Converter({
    flavor: 'github',
    smoothLivePreview: true,
});

// Open a stream to our Laravel OpenAI Controller
const stream = new EventSource('your-url.com/stream?count=' + $('.sender-bot').length + '&amp;amp;question=' + encodeURI(user_message));

// Catch update events returned by our OpenAI Contoller
stream.addEventListener('update', function (event) {

    // Stop streaming if we get a specific message text
    if (JSON.parse(event.data).text === "_STOP_STREAMING_") {
        stream.close();
        return;
    }

    markdown_string = markdown_string + JSON.parse(event.data).text;

    $('#your-message-element')
        .html(converter.makeHtml(markdown_string));

    /*
        We are expecting a lot of code and need highlighting using: https://github.com/highlightjs/highlight.js
    */
    document.querySelectorAll('.copilot-chat code').forEach(el =&amp;gt; {
        hljs.highlightElement(el);
    });


});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s all it took to build this whole thing. A couple of APIs, some HTML/CSS/JS and good old PHP. Now let’s see what the thing can actually do for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Alfred help you?
&lt;/h2&gt;

&lt;p&gt;Watch 5 minute Product Video: &lt;a href="https://www.youtube.com/watch?v=JovDFDh_ZMY"&gt;Meet Alfred - Your personal AI-powered API assistant &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the most beautiful things about generative AI and the way we’ve implemented it to Treblle is that it can help you solve actual API problems. Not only that but you’re not limited to a language or a question or a construct. Given that it literally understands the OpenAPI spec as you and I understand English you can have a conversation with it about your API. Let’s take a look at some API specific prompts.&lt;/p&gt;

&lt;p&gt;💡&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; Before we dive deep into the examples here is the API in question and the auto-generated documentation Treblle did in OpenAI Spec format: &lt;a href="https://pastebin.com/V3JBdyPM"&gt;https://pastebin.com/V3JBdyPM&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic API understanding
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;What’s the base URL for this API?&lt;/em&gt; (it returns the exact base URL of your API)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C_xxN5yY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5837sdq7kc214ox3fctj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C_xxN5yY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5837sdq7kc214ox3fctj.png" alt="Image description" width="800" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How many endpoints does this API have?&lt;/em&gt; (it counts all the endpoints and tell you exactly how many you have in your API)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6NAVIVLB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m36kj0wofqbcsz9ak8zb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6NAVIVLB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m36kj0wofqbcsz9ak8zb.png" alt="Image description" width="800" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;How do I authenticate on this API?&lt;/em&gt; (it tells you what type of authentication the API uses and gives you an example on how to use it)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FILXSGem--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/waoeez52368zut29n3tm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FILXSGem--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/waoeez52368zut29n3tm.png" alt="Image description" width="800" height="298"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Give me a summary of all the API endpoints in table format&lt;/em&gt; (it shows you a table list with all the endpoints and their methods)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aQeEib6M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zoxko66xpo5uc6emcbmo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aQeEib6M--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zoxko66xpo5uc6emcbmo.png" alt="Image description" width="800" height="326"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Show me all the endpoints for working with Articles&lt;/em&gt; (it will actually list all the endpoints in that endpoint group and their mandatory parameters)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NNml_9q6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q93cz154obis5324xh9z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NNml_9q6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q93cz154obis5324xh9z.png" alt="Image description" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Is this API following REST guidelines?&lt;/em&gt; (it will check to see if the API is following industry standards and best practices when designing and building this API)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--eI5-hkJ2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umacqv5u4w37vsl1gqj9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eI5-hkJ2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umacqv5u4w37vsl1gqj9.png" alt="Image description" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  API specific code generation
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Generate the User model in SwiftUI&lt;/em&gt; (it generates the actually model that you can copy/paste to your SwiftUI project and it takes into account all the fields returned by your API)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jMYKk_dp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uei5s6ef44agvvif4lvf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jMYKk_dp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uei5s6ef44agvvif4lvf.png" alt="Image description" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Give me an example request for auth/register in GO&lt;/em&gt; (it shows you the exact code that you need to make a POST request in this case, and it includes all the payload data it sees it needs in order to create a user)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nziV1_-A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sgob5760a7v6uhybuqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nziV1_-A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0sgob5760a7v6uhybuqw.png" alt="Image description" width="800" height="1822"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Show me how to create an Article using Laravel HTTP Client&lt;/em&gt; (it understands natural language and knows I want to do a POST request to articles so it shows me the exact code and all the payload details i need to send)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zr1SfL4R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m1n7a8md9y9qbkw1oj02.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zr1SfL4R--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m1n7a8md9y9qbkw1oj02.png" alt="Image description" width="800" height="1028"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Generate a test in PHP for the auth/login endpoint&lt;/em&gt; (it actually generates a test that checks to see if the response schema matches the one that should be returned by the API)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YIjhHH__--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uz7pf85m42vdsqls91gi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YIjhHH__--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uz7pf85m42vdsqls91gi.png" alt="Image description" width="800" height="1138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;_Make a POST request to articles using Guzzle, then take the article object and get the uuid value and make another GET request to articles/:uuid _(it will make the POST request, take the given returned uuid and pass it to the GET request all in PHP)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dc-9zkcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5avi4bk6lkwmgmnwmfh7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dc-9zkcf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5avi4bk6lkwmgmnwmfh7.png" alt="Image description" width="800" height="1416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I could go on and on with examples but I think you get the point. You can use Alfred to basically never have to read a line of documentation ever again and generate all the boilerplate code you need to use this API. Just think about it: your mobile engineering teams can generate models and code to make requests, your partners can build SDKs and integrations to your API faster, you can improve the developer experience for your internal teams, you can reduce time to first call and integration by 10x. All you have to do is build the API and we’ll document it and allow others to get started using it much faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To wrap things up:&lt;/strong&gt; AI is here and it’s not going anywhere, anytime soon. The beauty of services like OpenAI and Bard is that they allow everyone to build new experiences on top of them. What makes Alfred special and why it’s so magical is the combination of your data and generative AI. So the future will be kind to folks who hold the data or the ones who build the services.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>API Security - A New Treblle Product</title>
      <dc:creator>Davor Kolenc</dc:creator>
      <pubDate>Wed, 17 May 2023 11:29:07 +0000</pubDate>
      <link>https://dev.to/davorkolenc/api-security-a-new-treblle-product-4njk</link>
      <guid>https://dev.to/davorkolenc/api-security-a-new-treblle-product-4njk</guid>
      <description>&lt;p&gt;When building or maintaining your API, there comes a point when your focus turns toward security. How can you secure your API, or how can you ensure the security of your API?&lt;/p&gt;

&lt;p&gt;At Treblle, we have been working hard to answer these questions for you. With our upcoming API Security functionality, you can see a more detailed API Security score, from SQL injection to header inspection and IP reputation. All of these factors contribute to how secure your API is. Let's dive into how we can achieve this.&lt;/p&gt;

&lt;p&gt;Your API score is evaluated constantly as more requests come through, so you get your security insights in real-time as and when it changes. It ranges from default, which means that there is no threat level, all the way up to high, which means you really should pay attention to this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KTh7OcNA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p38tjga85jjcgq0jrxkr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KTh7OcNA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p38tjga85jjcgq0jrxkr.png" alt="Image description" width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Treblle API Security
&lt;/h2&gt;

&lt;p&gt;With all things security, we can only advise you on our findings and assessments. By default, all requests that come into your projects in Treblle start at a level of default, which means that you are good to go. However, we begin analyzing this request, and this level can increase. Even if your request is ranked at default or low, you should still ensure security from your side. We only assess specific criteria. Always remember that attackers will try things nobody thinks of to gain access to your systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;h3&gt;
  
  
  SQL Injection
&lt;/h3&gt;

&lt;p&gt;Let's start by talking about SQL Injection, which used to be the most common form of attack - but modern frameworks have begun adding built-in tools to help prevent this. However, it doesn't mean that, as developers, we should rely on these without taking measures ourselves. Attackers will look to gain access or retrieve data from your system using SQL Injection to access your database directly. As you can imagine, even a low threat level here is something to worry about.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2z6FNenS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzxkngb1bqeklkgn4ey3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2z6FNenS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kzxkngb1bqeklkgn4ey3.png" alt="Image description" width="800" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  IP Reputation
&lt;/h3&gt;

&lt;p&gt;IP Reputation is an interesting metric, as a potential attacker will likely use a proxy or tor network to mask their actual location. However, there is a database that we have access to that is used around the world where these proxies and tor networks are reported, which means that we can spot potential attackers based on commonly used IPs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Header Authorization
&lt;/h3&gt;

&lt;p&gt;API requests can be protected using an Authorization header so only authorised users can request certain areas of your application. This is a common practice in the development world. However, only some use this. Even public API endpoints should have authorization so that you can identify potential issues with users gaining access or attempting to gain access to places they shouldn't. We can be more confident in the users accessing your API by checking if an Authorization header is available.&lt;/p&gt;

&lt;h3&gt;
  
  
  SSL
&lt;/h3&gt;

&lt;p&gt;Using an SSL certificate on your API ensures an encrypted network connection between your API and your users. There are many benefits to using an SSL certificate on your API beyond simply encrypting the network traffic, so we recommend using one. From self-signed certificates to purchased certificates, each has different benefits and signing algorithms to ensure the encryption of your network traffic. As well as using an SSL certificate, you can use the Strict Transport Security header to ensure that potential attackers do not attempt to spoof certificates or try and force a HTTP connection to your API.&lt;/p&gt;

&lt;h3&gt;
  
  
  IDs
&lt;/h3&gt;

&lt;p&gt;One potential place often overlooked by developers is exposing your database IDs in your URLs. While this is a relatively low-level threat, it exposes your resource identification approach, enabling potential attackers to try auto-incrementing the identifier to access resources they should not have access to.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some Best Practices
&lt;/h3&gt;

&lt;p&gt;One great way to prevent DDoS attacks is to enable rate limiting on your endpoints by using the X-RATELIMIT-LIMIT header, which will stop potential attackers from making persistent requests and block them from fulfilling their requests earlier on in the lifecycle.&lt;/p&gt;

&lt;p&gt;Having a consistent content-type header will enable you to ensure that the requests coming into your API are protected against things such as remote code execution and cross-site request attacks. Additionally, using the X-CONTENT-TYPE-OPTIONS header will prevent potential attackers from performing MIME sniffing attacks. Pairing this with the accept header will help ensure no possible mime-type tampering attacks.&lt;/p&gt;

&lt;p&gt;Sometimes attackers will attempt to perform a drag-and-drop style clickjacking attack. To protect against this, you can set the X-FRAME-OPTIONS to "deny".&lt;/p&gt;

&lt;p&gt;A great and simple way to ensure attackers use the correct HTTP verbs for your endpoints is to lean on the Allow header. This will stop anyone from sending a POST request to your GET endpoint, which can cause challenging issues if you are not careful.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Proactive Approach to API Security
&lt;/h3&gt;

&lt;p&gt;This is not an exhaustive list of things you can do to ensure your API security. However, it is a handful of things that we at Treblle will be checking for you on each request to ensure that you are as protected as you can be. We always recommend going that extra mile when it comes to security on your APIs - and we will be expanding our new API security functionality to start detecting anomalies for you so that you can take a more proactive approach to security.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
