<?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[API Gateway Guide - Medium]]></title>
        <description><![CDATA[API Gateway and API Management articles, focused on guidance, comparisons and performance - Medium]]></description>
        <link>https://medium.com/api-gateway-guide?source=rss----f32278884e10---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>API Gateway Guide - Medium</title>
            <link>https://medium.com/api-gateway-guide?source=rss----f32278884e10---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:45:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/api-gateway-guide" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Taking REST beyond CRUD]]></title>
            <link>https://medium.com/api-gateway-guide/taking-rest-beyond-crud-ce0d68d31b7d?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/ce0d68d31b7d</guid>
            <category><![CDATA[uncategorised]]></category>
            <category><![CDATA[white-papers]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Fri, 09 Feb 2018 06:03:46 GMT</pubDate>
            <atom:updated>2018-03-02T15:01:57.260Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><p>Today’s REST-based APIs have had a positive impact on both developers and business. We have moved beyond complex, expensive stacks of middleware and to a lightweight, easier to integrate approach using REST and CRUD-based patterns.</p><p>On the surface, it appears that CRUD and RESTful architecture styles map well together. But is this always true? As you dig further, you’ll find that by only using CRUD-based patterns with your REST APIs, you are limiting your use of REST to a very narrow scope.Let’s examine the “rest” of what REST APIs have to offer for our API toolbelt.</p><h4>In the beginning, there was RESTful CRUD</h4><p>CRUD stands for Create, Read, Update, and Delete, which are four primitive database operations. At first glance, these operations map well to the HTTP verbs most frequently used in REST:</p><pre>Create (SQL INSERT)  : POST - Used to support the creation of a child resource, but can also modify the underlying state of a system.<br>Read (SQL SELECT)    : GET - Retrieve a representation of a resource, but with additional semantics available.<br>Update (SQL UPDATE)  : PUT - Update a resource using a full representation. Can also be used to create a resource. The full representation requirement is a large caveat, see the following.<br>Update (again)       : PATCH - Update a resource using a partial representation.<br>Delete (SQL DELETE)  : DELETE -  Delete a resource. This is the best matched mapping.</pre><p>If we stopped the discussion here, you would be able to build an API that allows common operations (Create, Read, Update, and Delete) on single resources or a list of resources. Advanced operations or processes are not yet possible, except as constructed by the consumer of the API.</p><p>So when is a CRUD-style approach sufficient? One example would be the case of an API that only operates on a single type of resource, or disparate resources which do not relate. Simple data-driven operations, such as the creation of logs, which are only read and may never be updated or deleted, are one such instance. The fear, however, is that the API may grow in scope. When that happens, heavy lifting, such as relationship management between objects, or transactions, are placed outside the system and under the responsibility of the API user.</p><p>Don’t feel discouraged, though. A narrowly-scoped API is sufficient for a large number of projects and products. Many software projects actually exist to enable this exact style of architecture. Examples include <a href="https://github.com/QBisConsult/psql-api">psql-api</a> and <a href="https://github.com/begriffs/postgrest">PostgREST</a>. But, as mentioned before, we can do better for our APIs!</p><h4>Using the “rest” of what REST has to offer</h4><p>As mentioned before, we could limit an API exclusively to CRUD operations and be happy with our results a fair amount of the time. So what are we missing, or leaving on the table, when we do this? Here is a short list of considerations that a full-featured REST API can encompass:</p><ul><li>Processes</li><li>Relationships between resources</li><li>Side-effects</li><li>Changes of state</li></ul><p>If instead we treat resources as complex abstractions of business objects, we can open up the capabilities of our REST API to a much wider world.</p><h4>Processes</h4><p>Consider the process of ordering a meal at a restaurant. What may seem like a simple, step-based process (order, wait, receive, pay), is actually composed of many micro-steps and processes under the covers. The order process alone consists of waiting for the server to take your order while the initial pleasantries, bread, and water are handled, followed by returning to kitchen, communicating the order to the kitchen staff, and then entering the order into the order management system for later payment.</p><p>All of these order-placing details are otherwise hidden under an innocuous-looking POST:</p><pre>curl -X POST -d &#39;{&quot;entree&quot;: &quot;pepperoni_pizza&quot;, &quot;drink&quot;: &quot;diet_coke&quot;, &quot;sides&quot;: [&quot;french_fries&quot;]}&#39; <a href="http://localhost/guest/1/orders">http://localhost/guest/1/orders</a></pre><p>Many of these business processes could have dependencies that need to be checked and met before a step can process. Even with all of actions completed, we haven’t even reached the point of preparing ingredients and cooking your food! When we take a resource-focused approach to API development, processes and the business objects that they involve are baked into the design.</p><h4>Relationships between resources</h4><p>The spirit of REST’s resources mirror the spirit of the web. Specifically, they should express relationships between objects, and provide the means to traverse them by hyperlink. <a href="https://en.wikipedia.org/wiki/HATEOAS">HATEOAS</a> explains further the ways that one can leverage this design to provide navigation guidance for a client through a system’s workflow. Ideally, hypermedia, not arbitrary URL schemes, would represent these relationships.</p><p>An example of managing resource relationships using hypermedia, in the context of our earlier restaurant example, featuring an order and items that make up that order:</p><pre>{<br>    &quot;id&quot;: &quot;d359bd67-8ca4-43f8-87cb-4baa2d806ea8&quot;,<br>    &quot;links&quot;: [<br>        {<br>            &quot;href&quot;: &quot;/orders/d359bd67-8ca4-43f8-87cb-4baa2d806ea8&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        },<br>        {<br>            &quot;href&quot;: &quot;/orders/d359bd67-8ca4-43f8-87cb-4baa2d806ea8/items&quot;,<br>            &quot;rel&quot;: &quot;items&quot;<br>        }<br>    ]<br>}</pre><p>From the order URL, a client can nagivate to a list of menu items making up that order. Each item would include links to the ingredients needed to create the item, along with a process description for preparation and cooking.</p><h4>Side-effects</h4><p>Another advantage we gain by treating resources as business objects is handling side-effects on behalf of, and unseen by, the client. In REST, POST is used for an action which results in a resource creation or side-effect, and can be repeated with the intent of the creation or side-effect happening again. A CRUD Create, on the other hand, explicitly creates a new resource, and cannot be executed a second time without error or data inconsistency.</p><p>If a restaurant guest wants to place the same order multiple times, it is not a problem:</p><pre>curl -X POST -d &#39;{&quot;entree&quot;: &quot;pepperoni_pizza&quot;, &quot;drink&quot;: &quot;diet_coke&quot;, &quot;sides&quot;: [&quot;french_fries&quot;]}&#39; http://localhost/guest/1/orders<br>{<br>    &quot;id&quot;: &quot;d359bd67-8ca4-43f8-87cb-4baa2d806ea8&quot;,<br>    ...<br>}</pre><pre>curl -X POST -d &#39;{&quot;entree&quot;: &quot;pepperoni_pizza&quot;, &quot;drink&quot;: &quot;diet_coke&quot;, &quot;sides&quot;: [&quot;french_fries&quot;]}&#39; http://localhost/guest/1/orders<br>{<br>    &quot;id&quot;: &quot;43e10b3b-c1f8-4336-a2f2-a70193fd10a9&quot;,<br>    ...<br>}</pre><pre>curl -X POST -d &#39;{&quot;entree&quot;: &quot;pepperoni_pizza&quot;, &quot;drink&quot;: &quot;diet_coke&quot;, &quot;sides&quot;: [&quot;french_fries&quot;]}&#39; http://localhost/guest/1/orders<br>{<br>    &quot;id&quot;: &quot;43e10b3b-c1f8-4336-a2f2-a70193fd10a9&quot;,<br>    ...<br>}<br><br>While it may seem simpler at first to model an API using CRUD-style data objects, rather than domain or business objects, the drawback is that these considerations are pushed into the hands of the API consumer to manage. This can lead to bugs, or worse, security flaws. From the business perspective, by not abstracting these details away from the user of the API, many customers will be repeating the same work. This could potentially result in increasing the support load of the API owner, as users hit similar obstacles during their course of development.</pre><pre>Changes of state</pre><pre>The biggest advantage to choosing REST over a limited CRUD-driven design is an architectural one. REST gives us the ability to implement a state machine using hypermedia, including contextual capabilities. REST makes the states of a state machine both explicit and addressable - by URIs (Uniform Resource Identifiers). At any time during a workflow, the current state is represented by a.) the URI you just visited and b.) the resource representation you received. The machine’s state can be changed by performing an operation on either the current URI, or a previously linked URI (see hypermedia above), turning either of these URIs into your new state.</pre><pre>Continuing our restaurant analogy, let’s look at the states of operating an internet-connected pizza oven, with resources shortened for brevity:</pre><pre>curl -X GET http://localhost/oven/1<br>{<br>    &quot;id&quot;: 1,<br>    &quot;status&quot;: &quot;off&quot;,<br>    &quot;time_cook&quot;: 0,<br>    &quot;temperature&quot;: 70,<br>    &quot;rack_height&quot;: 2,<br>    &quot;links&quot;: [<br>        {<br>            &quot;href&quot;: &quot;/oven/1&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        }<br>    ]<br>}</pre><pre>The pizza oven is off by default, let’s utilize hypermedia and turn it on:</pre><pre>curl -X PATCH -d &#39;{&quot;status&quot;: &quot;on&quot;}&#39; http://localhost/oven/1<br>{<br>    &quot;id&quot;: 1,<br>    &quot;status&quot;: &quot;preheating&quot;,<br>    &quot;time_cook&quot;: 0,<br>    &quot;temperature&quot;: 210,<br>    &quot;rack_height&quot;: 2,<br>    &quot;links&quot;: [        <br>        {<br>            &quot;href&quot;: &quot;/oven/1&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        }<br>    ]<br>}</pre><pre>The oven is now preheating. Let’s check to see if it is ready:</pre><pre>curl -X GET http://localhost/oven/1<br>{<br>    &quot;id&quot;: 1,<br>    &quot;status&quot;: &quot;ready&quot;,<br>    &quot;time_cook&quot;: 0,<br>    &quot;temperature&quot;: 400,<br>    &quot;rack_height&quot;: 2,<br>    &quot;links&quot;: [<br>        {<br>            &quot;href&quot;: &quot;/oven/1&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        }<br>    ]<br>}</pre><pre>Great, we’re ready to cook! Without getting too deep in the weeds on cooking temperature, time, and rack height, let’s assume we proceeded through states “ready”, “cooking”, and “idle”, and we’re now ready to shut off the oven:</pre><pre>curl -X GET http://localhost/oven/1<br>{<br>    &quot;id&quot;: 1,<br>    &quot;status&quot;: &quot;idle&quot;,<br>    &quot;time_cook&quot;: 0,<br>    &quot;temperature&quot;: 400,<br>    &quot;rack_height&quot;: 2,<br>    &quot;links&quot;: [<br>        {<br>            &quot;href&quot;: &quot;/oven/1&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        }<br>    ]<br>}</pre><pre>curl -X PATCH -d &#39;{&quot;status&quot;: &quot;off&quot;}&#39; http://localhost/oven/1<br>{<br>    &quot;id&quot;: 1,<br>    &quot;status&quot;: &quot;shutting_down&quot;,<br>    &quot;time_cook&quot;: 0,<br>    &quot;temperature&quot;: 380,<br>    &quot;rack_height&quot;: 2,<br>    &quot;links&quot;: [<br>        {<br>            &quot;href&quot;: &quot;/oven/1&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        }<br>    ]<br>}</pre><pre>Let’s check one more time, just to make sure we don’t burn down the building:</pre><pre>curl -X GET http://localhost/oven/1<br>{<br>    &quot;id&quot;: 1,<br>    &quot;status&quot;: &quot;off&quot;,<br>    &quot;time_cook&quot;: 0,<br>    &quot;temperature&quot;: 275,<br>    &quot;rack_height&quot;: 2,<br>    &quot;links&quot;: [<br>        {<br>            &quot;href&quot;: &quot;/oven/1&quot;,<br>            &quot;rel&quot;: &quot;self&quot;<br>        }<br>    ]<br>}</pre><pre>Success! We have moved through all the states of cooking a pizza in our internet-connected pizza oven.</pre><pre>As demonstrated, a resource’s representation should include the steps from your current state to all other available states, like the edges and nodes in a graph. This is is the same heritage of using a web browser to navigate the web. REST architecture can work the same way and with the same advantages. This ability to drive a state machine is well beyond the capabilities of a CRUD-based API.</pre><pre>Enlightened REST</pre><pre>Taking a REST API beyond CRUD can yield a wealth of advantages and capabilities: mapping business processes, relationship modeling, side-effect handling, and maintaining a complex state machine. Rather than simply exposing internal database structure, we have the opportunity of modeling services and business logic, while at the same time abstracting away low-level details that can hinder the API consumer. By putting as much thought into your API consumers as your web interface users, you will be well on your way from CRUD interfaces to a more enlightened REST.</pre><p><em>*This article was originally posted on </em><a href="https://tyk.io/api-expertise/"><em>https://tyk.io/api-expertise/</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce0d68d31b7d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/taking-rest-beyond-crud-ce0d68d31b7d">Taking REST beyond CRUD</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your data model is not an API]]></title>
            <link>https://medium.com/api-gateway-guide/your-data-model-is-not-an-api-d1080b597064?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/d1080b597064</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[api-integration]]></category>
            <category><![CDATA[api-management]]></category>
            <category><![CDATA[tyk]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Sun, 21 Jan 2018 23:49:54 GMT</pubDate>
            <atom:updated>2018-08-03T12:36:37.291Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><ul><li><em>This article was originally posted on </em><a href="https://tyk.io/api-expertise/"><em>https://tyk.io/api-expertise/</em></a></li></ul><p>Just about every mobile and web application is backed by at least one database. These applications often require a web-based API to expose the database(s) for storing, querying, and retrieving necessary application data. But is exposing our data model directly to other developers the best approach to API design?</p><p>This article discusses the difference between data model design and API design, why we often use data models for our APIs, and whether this is the right approach to API design. We will also cover some techniques for ensuring that your API design hides your internal implementation details to ensure greater API longevity.</p><h4>Data models are an implementation detail</h4><p>Data models are a constant with web development. When new team members join, one of the first questions is, “Can I see the data model for the app?” A data model defines how information is stored and retrieved to support a solution. It reveals exactly what the app can (and cannot) offer to the end user.</p><p>Your data model is optimized for the internal details of our application — including the decisions we have made about our programming language, framework, and database vendor. If we design our API to directly map to our database, we risk exposing these internal implementation details to our API consumers.</p><p>Also, your API consumers don’t get the luxury of seeing the details your data model and code. They didn’t sit in on the endless meetings that resulted in the multitude of decisions that drove your data model design. They don’t have the context of why your data model was designed in a certain way. Yet, many teams have made the decision to expose an implementation decision — their data model — as an external API. Why?</p><h4>Why do we model our APIs from the data model?</h4><p>Teams often choose to model their API from data models for several reasons:</p><ol><li>It’s familiar — Developers building the API often modelled the data, so a bottom-up approach is often the most comfortable for developers</li><li>It’s faster — Directly mapping a data model to an API is the fastest route for the API provider, when time is limited (and when isn’t our time limited?)</li><li>It’s flexible — We often think that offering finer-grained access via your API allows consumers the greatest flexibility; however, this comes at the expense of slower application performance and more effort at integration time (as we will explore below)</li></ol><p>Before we make the leap directly from our data model into an API, we need to reconsider what problems data models solve:</p><ul><li>Transactional queries from end-users, via web, mobile, and API clients</li><li>Optimizing for read-based and/or write-based throughput, through data denormalization, physical storage optimizations, and caching strategies</li><li>Reporting and/or adhoc query support through star schemas, snowflake schemas, and other data warehousing strategies</li></ul><p>A data model doesn’t concern itself with solving the desired outcomes of our API consumers. Instead, it addresses the architectural and operational needs of the solution. It’s up to us to build APIs and applications on top of the data model to provide the capabilities and desired outcomes that our API consumers need. Simply mirroring the data model as an API typically isn’t enough to solve the problems that API consumers encounter.</p><h4>What happens when we expose our data model as an API?</h4><p>In the effort to deliver APIs that are familiar, fast, and flexible, we push much of the burden of the API on our consumers:</p><p><strong>Ever-changing APIs:</strong> Database schema changes will result in a constantly-changing API, as the API is forced to keep in lock-step with the underlying database. This change to the data model will force consumers to rewrite their API integration code every time the underlying data model changes, resulting in a change to the API definition.</p><p><strong>Network chattiness:</strong> Exposing link tables as separate API endpoints will cause API “chattiness”, similar to how an n+1 query problem degrades database performance. However, while an n+1 problem can be a performance bottleneck for databases, API chattiness will have a devastating impact on API consumption performance due to the many separate HTTP calls necessary to render a single UI screen.</p><p><strong>Confusing API details:</strong> Columns optimized for query performance, such as a CHAR(1) column that uses character codes to indicate status, become meaningless to your consumers without additional clarification.</p><p><strong>Exposing sensitive data:</strong> Tools that build APIs directly from databases often expose all columns with a table using SELECT * FROM [table name]. However, this can expose data that API consumers should never see, such as personally identifiable information (PII). It may also expose data that helps hackers compromise systems through a better understanding of the internal details of the API.</p><p><strong>Exposing implementation details:</strong> Our applications are designed and built on top of many decisions, constraints, and other internal details. Directly exposing our database pushes the results of these decisions directly to API consumers, without the benefit of the reasons why they exist.</p><p>Flexibility for the consumer comes at a price. Unless the vast majority of your API consumers want this level of control, it is best to focus on an API design that is separate from your data model, by hiding the implementation details of our app.</p><h4>Your API design should hide implementation details</h4><p>The technique of hiding internal implementation details and exposing an external API has been rooted in software design for decades. Terms such as modularization, loose coupling, and high cohesion are associated with great software design. Let’s review some of these concepts:</p><p><strong>Modules</strong> are the smallest atomic unit within a software program and may be composed of one or more source files. Modules have a public-facing API to expose the functionality that they offer. Modules are sometimes known as components.</p><p><strong>High cohesion</strong> is a term used when the code within a module is all closely related to the same functionality. A highly-cohesive module results in less “spaghetti code”, as method calls aren’t jumping all over the codebase. Instead, they are confined into one area, typically a code package or namespace.</p><p><strong>Loose coupling</strong> hides a module’s internal details away from other modules, restricting the knowledge between modules to a public interface, or API that other areas of the code can invoke.</p><figure><img alt="Your data model is not an API" src="https://cdn-images-1.medium.com/max/1024/0*hNQuH1AQuBoOr4Og.png" /></figure><p>When we apply these concepts into larger software solutions, we hide implementation details within a module from other modules. This results in some basic rules for modular software development that will benefit our API design:</p><ul><li>A module’s internal implementation details should be hidden (e.g. its data model, classes/objects/functions, and the events it emits to process internal logic)</li><li>A module’s API is a contract with other modules that should not change when internal implementation details change (e.g. data model changes or switching to a new framework)</li><li>A module may emit messages and/or business events related to its capabilities, but they should not expose the internal implementation details (e.g. moving from <a href="https://www.rabbitmq.com/">RabbitMQ</a> to <a href="https://kafka.apache.org/">Kafka</a> to achieve greater scale shouldn’t impact API consumers)</li></ul><p>By extending these rules to web-based APIs, we create modular APIs that focus on providing a set of capabilities to API consumers. These capabilities may be driven by a request/response HTTP API call or by subscribing to messages and events from the API through webhooks or websockets. As long as the capabilities that the API offers continues to adhere to the contract defined by the API, our API consumers can continue to use the API without fear of underlying implementation changes that could cause their integration code to stop functioning.</p><h4>Conclusion: Be an API consumer advocate</h4><p>As mentioned earlier, teams often default to directly exposing their data model as it is familiar, faster, and more flexible. Your API consumers care about these same attributes — but from their point of view, not yours:</p><ul><li>Your API consumers want an API that is familiar to them, not to your implementation team</li><li>Your API consumers want an API that is fast to integrate for them, not for your internal team to implement</li><li>Your API consumers want an API that is flexible by offering capabilities to get things done, without creating lots of HTTP calls and stitching data together to achieve their desired outcomes</li></ul><p>Finally, it is important to remember that 5 hours saved by your team may cost 10s to 100s of hours by your API consumers. This is because <strong>every consumer has to deal with the same API design flaws</strong> because of your exposed implementation details. A great API design makes it easy for API consumers by hiding internal implementation details, leading to faster integration and happy developers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1080b597064" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/your-data-model-is-not-an-api-d1080b597064">Your data model is not an API</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s the minimum documentation required for an API?]]></title>
            <link>https://medium.com/api-gateway-guide/whats-the-minimum-documentation-required-for-an-api-b757c87caff?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/b757c87caff</guid>
            <category><![CDATA[white-papers]]></category>
            <category><![CDATA[uncategorised]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Fri, 29 Dec 2017 17:03:52 GMT</pubDate>
            <atom:updated>2018-03-02T15:02:07.112Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><p><em>*This article was originally posted on the website </em><a href="https://tyk.io/api-expertise/"><em>https://tyk.io/</em></a></p><p>So you have an API, and it’s time to let the world know about it. You need API documentation! Or maybe your API and your first version of the documentation have been out there for a while, and now you finally have the time and resources to improve them. Where should you start? How can you prioritize and choose from all the possibilities?</p><p>We’ve covered <a href="https://tyk.io/blog/want-create-better-api-documentation-ask-questions/">how to optimise your API Documentation by asking key questions</a>, but what if you’re starting from zero? In this article, we will learn about the difference between reference documentation and a developer portal. We will then take a quick walk through the Minimum Viable Documentation (MVD) that any API provider should have if they want to encourage adoption of their API.</p><h4>Isn’t Swagger-UI enough?</h4><p>API reference documentation, typically rendered from the <a href="https://github.com/OAI/OpenAPI-Specification">OpenAPI Specification</a> using the <a href="https://swagger.io/swagger-ui/">Swagger UI</a> tool, helps developers understand how to use your API. It provides all of the necessary details about endpoints, input parameters, and output payloads. Without this documentation, developers are left scratching their heads on how to use your API.</p><p>But did you know that it takes more than just API reference documentation to encourage developer adoption of your API? There are 5 sections that your developer portal should have to drive greater API adoption. Let’s take a look at each section to better understand how a great developer portal can answer your developers’ questions.</p><h4>Section 1: Overview</h4><p><strong>Answers the question</strong>: “What type of API do you have?”</p><p>This section should include the following:</p><ul><li>Style of API (RESTful, SOAP, platform-based)</li><li>Brief use cases and examples (2 or 3 sentences)</li><li>Base URL of where your endpoints live</li><li>Subscription levels and pricing, including any rate limits enforced at each level</li></ul><h4>Section 2: Authentication</h4><p><strong>Answers the question</strong>: “How do I authenticate with your API?”</p><p>This section should include the following:</p><ul><li>Authentication method (e.g. token-based, OAuth 2.0 Bearer token)</li><li>Expiration intervals of your API token (if any)</li><li>Refreshing expired tokens/keys</li><li>Example of embedding the API token (e.g. parameter-based or authorization header)</li></ul><h4>Section 3: Workflows</h4><p><strong>Answers the question</strong>: “How do I successfully accomplish what I need with your API?”</p><p>This section should include the following:</p><ul><li>Common scenarios solved by other developers</li><li>A walkthrough on using the API to implement the common scenarios</li><li>Link to the reference for each endpoint mentioned in the workflow to guide developers on the specifics</li></ul><h4>Section 4: Code Samples and SDKs</h4><p><strong>Answers the question</strong>: “What does the code look like for common use cases?”</p><p>This section should include the following:</p><ul><li>Code snippets that developers can copy and paste</li><li>Complete code samples or demos, perhaps in a Github repo for easy cloning and experimentation</li><li>Code samples should address popular programming languages your consumers use</li></ul><h4>Section 5: API Reference</h4><p><strong>Answers the question</strong>: What endpoints are offered and how do I use them?</p><p>For each endpoint, you should document:</p><ul><li>The HTTP method (GET, PUT, POST, DELETE)</li><li>Complete request URL</li><li>Parameters (path and query): name, type, description, and whether the parameter is requred</li><li>Example request (including header and body)</li><li>List of each element in the example request, including the type, description, and whether the element is required</li><li>Example response</li><li>List of each element in the example response, including type and description</li><li>List of error and status codes, including the code, message, and meaning</li></ul><h4>How to Get Started</h4><p>While this list may look daunting, my recommendation is to add minimal content into each section to address the common needs of your target audience. Then, grow the content over time until your portal begins to address many of the questions and common use cases your API solves.</p><p>If you want to jumpstart your developer portal, check out the <a href="https://github.com/launchany/mvd-template">MVD Template</a> to help you create your minimum viable documentation (MVD) for your API using the <a href="https://jekyllrb.com/">Jekyll framework</a>. The MVD Template offers step-by-step guidance on what to fill in within an intuitive design and navigational structure. Simply fork the repository and start to make it your own. There are even links to how to get your portal deployed.</p><p>Finally, at any stage in your documentation development, you’ll get great ideas and insights from reading API docs that are widely praised. These companies are often mentioned for their great API documentation:</p><ul><li><a href="https://stripe.com/docs/api">Stripe</a></li><li><a href="https://www.twilio.com/docs/api/rest">Twilio</a></li><li><a href="https://developer.github.com/">GitHub</a></li><li><a href="https://sendgrid.com/docs">SendGrid</a></li></ul><p>See what other companies with successful APIs are doing with their docs. Then produce a plan for <a href="https://tyk.io/blog/api-developer-portals-2/">launching your own developer portal.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b757c87caff" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/whats-the-minimum-documentation-required-for-an-api-b757c87caff">What’s the minimum documentation required for an API?</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating API Management into your organisation: an introduction to Tyk Plugins]]></title>
            <link>https://medium.com/api-gateway-guide/integrating-api-management-into-your-organisation-an-introduction-to-tyk-plugins-d79f8380c3?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/d79f8380c3</guid>
            <category><![CDATA[uncategorised]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Thu, 21 Dec 2017 09:30:21 GMT</pubDate>
            <atom:updated>2018-03-02T15:02:17.123Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>Matias Insaurralde</strong></p><ul><li><em>For more information on API Gateway middleware — Tyk Plugins, you can visit </em><a href="https://tyk.io/features/extend-tyk/"><em>https://tyk.io/features/extend-tyk/</em></a></li></ul><p>A common requirement for enterprise API Management is integration. It’s rare that Tyk is installed into a complete green-field (wouldn’t that be nice). Instead, our users typically need to deploy Tyk into a busy and complex mesh of existing platforms and services.</p><p>Tyk has a whole array of functionality out of the box to make this simple, but sometimes you just have to authenticate against Lotus Notes, or pipe some custom log data into an excel model. Fun times ahead!</p><p>We can’t kick Lotus Notes out of your org (though we’d be happy to help — <a href="https://media.giphy.com/media/PqSbSRO7n97na/giphy.gif">just ask</a>) but we do have you covered with <a href="https://tyk.io/docs/customise-tyk/plugins/">Tyk Plugins</a> to make your life easier.</p><h4>What are Tyk Plugins?</h4><p><a href="https://tyk.io/docs/customise-tyk/plugins/">Tyk Plugins</a> make it simple to extend Tyk and integrate as you require, without forking the gateway. The flexibility Plugins allow mean you can get started immediately, and with no need to wait for changes elsewhere. Instead, you can simply hook Tyk into what you have right now.</p><h4>OK but <em>really</em>. What are Tyk Plugins?</h4><p><a href="https://tyk.io/features/extend-tyk/">Tyk Plugins </a>provide a way of modifying the Tyk Gateway behaviour using your favourite languages. A Tyk Plugin contains your own implementation of a HTTP middleware.</p><p>Typical use cases for plugins include implementing your own authentication mechanisms instead of using the default ones, integrating with legacy systems or performing additional operations like injecting a header before the request reaches your upstream API.</p><h4>What type of Plugins do we support?</h4><p>Tyk supports two types of plugins: gRPC-based plugins and native/built-in ones.</p><h4><strong>gRPC-based plugins</strong></h4><p>gRPC is a very powerful RPC protocol created by Google. In simple terms it allows you to perform calls between different programs by using a common protocol called Protocol Buffers, even if these two programs are written in different languages.</p><p>The way this fits into the Tyk Infrastructure is that with <a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/grpc/">Tyk gRPC plugins</a> you can implement a gRPC server containing your middleware logic and configure the Tyk Gateway to call it every time a request is proxied. In this scenario, the gRPC server receives the request, runs the middleware code and sends the request back to Tyk where it gets proxied upstream.</p><p>This communication occurs over a TCP socket and the user has the flexibility of deploying it in different ways, e.g. using multiple gRPC servers with a load balancer.</p><p>To see a list of supported gRPC languages see the official page: <a href="https://grpc.io/docs/">https://grpc.io/docs/</a></p><h4><strong>Native/built-in plugins</strong></h4><p>Native plugins run as part of the Tyk Gateway process. Tyk supports <a href="https://tyk.io/docs/customise-tyk/plugins/javascript-middleware/">JavaScript plugins</a> by default.</p><p>We also provide alternative Tyk builds with Python and Lua support, so now you can get your <a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/python/">API Management with Python</a>, or if you prefer, you can <a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/luajit/">manage your API with Lua</a>.</p><p>The way this works is by using embedded interpreters. The middleware code contained in your Tyk Plugin is loaded by the interpreter and Tyk performs the appropriate calls to your code when the requests are proxied through the system.</p><p>The performance is limited by each language runtime, at the time of writing, we support Python 3.4 and LuaJIT5.1.</p><p>JavaScript support is limited to vanilla JavaScript which doesn’t provide the same capabilities as NodeJS. However, if you’re interested in <a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/grpc/custom-auth-nodejs/">NodeJS API management</a> it’s possible to create a gRPC-based plugin using it.</p><h4>Building Infrastructure with Tyk</h4><p>Tyk Plugins are already being taken advantage of by many different teams, used for a whole host of integrations ranging in type and complexity. Two recent examples:</p><ul><li>A global media brand writing middleware that delivers a bespoke logging function to couple API transactions with a legacy billing platform</li><li>An Enterprise organisation using <a href="https://tyk.io/docs/transform-traffic/">custom middleware to transform XML to REST</a>.</li></ul><p>If you’d like to discuss your own integration requirements, our consulting engineers are ready and waiting to help — just <a href="https://tyk.io/api-gateway/enterprise/">drop us a message via our Enterprise page</a>. We’ll be happy to discuss your unique requirements and advise on the most appropriate way forward.</p><h4>A few guides for getting started with Tyk Plugins:</h4><p>And, if you’re ready to get started now, a good place to begin is with one of our examples:</p><ul><li><a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/grpc/custom-auth-dot-net/"><strong>Creating a custom authentication plugin using .NET framework</strong></a></li><li><a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/grpc/custom-auth-nodejs"><strong>Creating a custom authentication plugin using NodeJS</strong></a></li><li><a href="https://tyk.io/docs/customise-tyk/plugins/rich-plugins/grpc/request-transformation-java/"><strong>Implementing a request transformation plugin using Java</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d79f8380c3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/integrating-api-management-into-your-organisation-an-introduction-to-tyk-plugins-d79f8380c3">Integrating API Management into your organisation: an introduction to Tyk Plugins</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A guide for when (and how) to version your API]]></title>
            <link>https://medium.com/api-gateway-guide/a-guide-for-when-and-how-to-version-your-api-fac112b565cc?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/fac112b565cc</guid>
            <category><![CDATA[api-integration]]></category>
            <category><![CDATA[tyk]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[api-gateway]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Wed, 06 Dec 2017 02:21:10 GMT</pubDate>
            <atom:updated>2018-08-03T12:35:55.671Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><p>Whether you have a single API product or you manage multiple APIs across business lines, one thing is common: having an API versioning strategy is important.</p><p><a href="https://tyk.io/blog/when-and-how-do-you-version-your-api/">In a previous API Expertise article</a>, I outlined common strategies available to API providers. But a common question remains — how do I know when I need to release a new version of my API?</p><p>In this follow-up article I will answer this question by discussing the differences between API versions and revisions, including how understanding the difference guides provide on when and how to version their API.</p><h4>API Versioning: From negative impact to consumer churn</h4><p>Before we deep dive into this discussion, it is important to recognise the negative impact that a new API version can have on your consumers. When you create a new version of an API, you are telling your API consumers that they have to do some work. Code needs to be changed, and integrations need to be retested. Your API re-design becomes the consumer’s problem.</p><p>When the number of API consumers are small (or zero), or when the consumers are internal and you are able to coordinate the API changes easily, then the impact can be minimized. Yet, any change required by an API consumer costs time and effort. As a result, creating a new version of your API should be a last resort.</p><p>API versioning has an even greater impact to your business. When customers are integrated with your API, the likelihood of churn is reduced as the perceived value and sunk cost concerns increase. When you version your API, customers must once again make a commitment to your product. Code changes are required to keep up with the latest version. Bottom line: <em>you are creating an opportunity for your customers to move their business elsewhere</em>.</p><h4>Versions vs. Revisions</h4><p>Darrel Miller recently presented on how to avoid breaking changes at the <a href="http://events.linuxfoundation.org/events/apistrat">2017 API Strategy and Practice Conference in Portland</a>. His talk demonstrated how Microsoft has chosen to approach the problem: differentiate between API versions that create breaking changes for your consumers, and revisions to your API that improve but don’t disrupt your existing consumers:</p><p><a href="https://apistrat17.sched.com/event/BiDT/never-make-another-breaking-change-believe-me-darrel-miller-microsoft">In his talk</a>, he outlined two definitions that are sometimes thought of as synonymous: Versions and Revisions. Let’s explore each one to better understand how we can better manage our API versioning strategy.</p><p><strong>API versions</strong> (consumers choose): Identifies a grouped set of API endpoints and definitions. Versions may be numbers or strings (e.g. v1 or 2017–01–14). Each version of an API is often treated as a separate product with differing behaviors and capabilities. API consumers opt into a specific version and write code against that version. They only migrate to a new version when they are ready, which may be a long time after the new version is released, or perhaps never.</p><p><strong>API revisions</strong> (providers choose): Identifies an internal change that should have no negative impact to your API consumers. Revisions should be transparent to the API consumer, as consumers should be subscribed to a specific version only. Internally, you may release “v1;rev 5”, but to your API consumers they are still using v1.</p><p>I found this approach refreshing, as it provides a more pragmatic approach to API versioning while steering clear of semantic versioning that doesn’t necessarily map directly to HTTP-based APIs. Some of <a href="https://launchany.com/">my clients</a> use this technique, using terms such as major and minor version in place of version and revision, respectively (e.g. v1.1, v1.2, v1.3, etc).</p><h4>Applying versions and revisions to your versioning strategy</h4><p>Let’s apply this understanding into three API versioning strategies that you can choose to put into practice.</p><p><strong>Option 1: Versions with many revisions</strong>: This is one of the most common options that I have seen put into practice, as it allows APIs to evolve over time without a breaking change. The API provider adds new fields to payload or even entirely new endpoints or resources to an existing API. Since these changes avoid a change that could disrupt existing API consumers, the API is given an internal revision number, e.g. v1.2. Consumers are upgraded to the latest revision once it is deemed stable. When breaking changes are required the version number is increased, resulting in a brand new API product that must be marketed to existing customers using the previous version.</p><p><strong>Option 2: Versions with only one revision</strong>: Perhaps less common, this option allows API providers to ship one version of an API, then immediately move to the next version. This strategy may be useful when you are early in your API design and need to make breaking changes more often. Placing more burden on your API consumers, this strategy is best used when your API consumers are either in-house or able to absorb constant rate of change. Some API providers start here, then move to the “Versions with many revisions” option as the API design starts to change less often.</p><p><strong>Option 3: One version, only revisions</strong>: For API providers that must assume that their API consumers will rarely or never change their code, e.g. <a href="https://stripe.com/blog/api-versioning">Stripe</a>, this is the wisest choice. The API versioning is handled transparently to the API consumer, with request/response payloads transformed to the current internal version and back again. More work is required by the API provider, but this work is seen as having a positive multiplying effect: API consumers never worry about needing to rework existing integration logic.</p><p>I believe that Option 3, “One version, only revisions”, is the best option for most API providers, but it comes with a high cost of maintenance. Many organizations are not ready to take on the burden of supporting and rigorously testing backwards compatibility of API versions that may date back several years. Instead, providers often choose Option 1, placing the burden of upgrading to a new version on the API consumers. The risk is that consumers may opt to move to a different API provider or solve the problem themselves than incur the cost of upgrading, resulting in consumer churn.</p><h4>In summary</h4><p>Selecting an API versioning strategy is important, not only for your internal development processes but also for your API consumers and the resulting developer experience.</p><p>Be thoughtful about how you plan to manage your API versions, including whether you will require API consumers to upgrade themselves or if you will support backward compatibility of your API changes transparently.</p><p>No matter which strategy you select, be sure to clearly document your strategy and the expectations you have of developers as they start to integrate with your API. They will thank you for it.</p><p><em>*This Article was originally published on https://tyk.io</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fac112b565cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/a-guide-for-when-and-how-to-version-your-api-fac112b565cc">A guide for when (and how) to version your API</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Which kind of API is the right one for your next project?]]></title>
            <link>https://medium.com/api-gateway-guide/which-kind-of-api-is-the-right-one-for-your-next-project-646d5654ee11?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/646d5654ee11</guid>
            <category><![CDATA[white-papers]]></category>
            <category><![CDATA[uncategorised]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Wed, 08 Nov 2017 07:12:31 GMT</pubDate>
            <atom:updated>2018-03-02T15:02:01.243Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><p>We use the term ‘web API’ to mean any kind of API exposed over the network, typically using HTTP. Not all APIs are the same, however. Each type of web API delivers different benefits to your business and your customers.</p><p>Let’s examine the five types of web APIs and how each one takes a different approach to successfully meet the needs of your API consumers.</p><p><em>*This guide to API Development was originally a featured blog post at: </em><a href="https://tyk.io/api-expertise/"><em>https://tyk.io/api-expertise/</em></a></p><h4>Utility APIs</h4><p>Utility APIs are the simplest to consume, as they focus on taking in request parameters and delivering a result. Some examples include:</p><ul><li><a href="https://www.usps.com/business/web-tools-apis/address-information-api.htm">USPS Postal Code and Postal Address Verification</a> — send a postal code or postal address and verify it exists, while correcting any errors in the process</li><li><a href="https://openweathermap.org/current">OpenWeatherMap API</a> — send a location and receive the current weather forecast</li><li><a href="https://openexchangerates.org/">Open Exchange Rates</a> — obtain the foreign exchange rates</li></ul><p>Utility APIs are meant to be quick and easy to consume. Some may require a free or paid subscription; however, developers see the API’s value quickly. Companies willing to open their API to public developers may choose to offer utility APIs, as they can be released much faster than more a more complex API.</p><h4>SaaS APIs</h4><p>Software-as-a-Service (SaaS) APIs allow customers to access their hosted data. Customers may choose to use the SaaS through the existing user interface, through the API, or a combination of both. While not all SaaS providers open their product with an API, those that do typically find that customer retention is increased as the API deeply integrates the customer with the provider. SaaS API examples include:</p><ul><li><a href="https://developer.github.com/v3/">Github</a> — REST and GraphQL APIs allow developers to automate nearly every feature available from the web interface. Github also offers webhooks that can perform a callback into a customer’s own API to notify when new code is pushed, helping to automate the continuous delivery pipeline without needing to install Github locally.</li><li><a href="https://www.freshbooks.com/developers">Freshbooks</a>, <a href="https://github.com/basecamp/bc3-api">Basecamp</a> — Examples of SaaS providers that are typically used through the user interface, while allowing developers to access the data directly via the API. I have used these and similar APIs to automate many of my back office tasks.</li><li><a href="https://stripe.com/docs/api">Stripe</a>, <a href="https://sendgrid.com/docs/API_Reference/Web_API_v3/index.html">Sendgrid</a> — SaaS providers that target developers directly by offering APIs as a subscription product.</li></ul><p>If you have a SaaS offering, you may be able to reduce customer churn by offering an API that helps your customers integrate your product into their daily workflow.</p><h4>Platform APIs</h4><p>While SaaS products are designed to be consumed directly, platform APIs extend the reach of a SaaS provider by bringing together multiple parties. By reaching beyond the typical provider-consumer relationship found in SaaS, platforms often provide increased value through innovation and a greater overall network. Examples include:</p><ul><li><a href="https://developer.salesforce.com/page/Salesforce_APIs">Salesforce Platform</a> and <a href="https://devcenter.heroku.com/articles/platform-api-reference">Heroku PaaS</a> — The Salesforce platform is one of the original Platform APIs, offering direct access to the many features available on the Salesforce and <a href="http://force.com/">Force.com</a> platforms. Heroku, owned by Salesforce, is a Platform-as-a-Service that enables developers to easily deploy their applications, as well as tap into a third-party add-on marketplace. Heroku’s marketplace has helped to grow several API products (in fact, <a href="https://tyk.io/blog/deploy-tyk-hybrid-one-click/">Tyk’s launching a one-click integration with Heroku</a>).</li><li><a href="https://www.api2cart.com/">API2Cart</a>, <a href="https://developers.shopify.com/">Shopify</a> — Automates the storefront and sales channel for ecommerce APIs through built-in and third-party solutions.</li><li><a href="https://dev.fitbit.com/">Fitbit</a> — Not only allows consumers to access their own data, but allows third-party solutions to build upon the data when shared by the consumer.</li></ul><p>Generally speaking, platform APIs can be tricky to grow successfully given that they need to connect two or more markets together (e.g. developers and third-party tool providers in the case of Heroku). Use caution when building a platform API before you have all sides of the market at hand.</p><h4>Partner APIs</h4><p>Unlike utility or SaaS APIs, partner APIs are restricted to a smaller set of development partners. By limiting an API to partners, companies can tightly control who and how an API is used. Often, these partner APIs require a more rigorous onboarding process than an API targeting public developers or customers. Some partner APIs offer sandboxes for experimenting with the API in limited form, prior to going into production with a more formal agreement. Some examples of partner APIs include:</p><ul><li><a href="https://developer.sabre.com/">Sabre</a> — Sabre, who powers many airlines, offers travel information and booking capabilities through their partner program</li><li><a href="https://developer.capitalone.com/">Capital One</a> — Since March 2016, Capital One has offered APIs that provide credit offers, savings accounts, bank grade two-factor authentication, and other capabilities. Developers can sign-up for a sandbox account to try out the APIs</li></ul><p>Some partner APIs are only offered to existing partners and excluded from public viewing. Some organizations are interested in offering an API, but are hesitant to opening it up to public developers. In this case, partner API programs are the best opportunity for organizations to extend their digital assets while still maintaining tighter control of who uses them.</p><h4>Private APIs</h4><p>Hidden behind the firewall of many companies are private APIs that power day-to-day operations. These private APIs may range from APIs that power mobile apps, to internal APIs used by development staff. Private APIs can be divided into three categories:</p><ul><li><strong>Capability APIs</strong> that deliver specific functionality to help the organization conduct business day-to-day. Examples include: managing inventory, booking hotel rooms, or account management.</li><li><strong>Infrastructure APIs</strong> ensure systems continue to function by automating tasks such as the code deployment pipeline, data center resource provisioning, and data gathering and alerting from sensors</li><li><strong>Integration APIs</strong> bridge the gap between existing systems (e.g. mobile-to-backend) and commercial of the shelf (COTS) solutions. These APIs may also act as an orchestration layer between internal systems and SaaS/platform providers</li></ul><p>It is sometimes estimated that there are 10x more private APIs than public APIs. From my experience, it is considerably more as many organizations prefer to start with private APIs before opening them up to partners and public developers. If you are in enterprise IT, your company most likely has private APIs and quite possibly a formal API program to manage them.</p><h4>What colour is your API parachute?</h4><p>Each of the types of APIs available offer different strengths and weaknesses. Some simply solve a simple problem in a simple way. Others extend the reach of existing applications through automation. Still others offer the capabilities of organisations to internal and partner developers.</p><p>Before you launch your next API, consider how your API will be used and what kinds of problems it needs to solve. This will help you better address the needs of your API consumers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=646d5654ee11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/which-kind-of-api-is-the-right-one-for-your-next-project-646d5654ee11">Which kind of API is the right one for your next project?</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 things to do before taking your private API public]]></title>
            <link>https://medium.com/api-gateway-guide/5-things-to-do-before-taking-your-private-api-public-70c772f7ebeb?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/70c772f7ebeb</guid>
            <category><![CDATA[tyk]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[api-security]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[api-management]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Mon, 23 Oct 2017 04:08:01 GMT</pubDate>
            <atom:updated>2018-08-03T12:37:58.931Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><p>Across my various clients, I see a common trend — private APIs outnumber public APIs at least 10-to-1. Some private APIs are for internal use within the corporate firewall. Others are exposed to the world but only for private use from mobile and web applications.</p><p>Over time, some of these APIs become candidates for partner or public APIs. But, we shouldn’t assume our private APIs are ready to be made public. Let’s explore the 5 key things we must do before taking our private APIs outside the firewall.</p><p>*This guidance was originally posted on <a href="https://tyk.io/">https://tyk.io</a> where we explained simple steps to securing, documenting and managing your API.</p><h4>1. Perform a thorough security review</h4><p>I get it. Time is limited. Designs for internal APIs have to be accelerated, often at the expense of a thorough design and security review. Once we go public, however, the absolute first thing we must do is to revisit our API designs and see where we need to make some key changes.</p><p>Tinder learned this the hard way. <a href="https://www.forbes.com/sites/anthonykosner/2014/02/18/tinder-dating-app-users-are-playing-with-privacy-fire/#2b96281d3dbd">Forbes provides a great overview</a> of what happened when Tinder made their private mobile API available for public developers:</p><blockquote>Unfortunately, two of the aspects responsible for the high quality of its user experience also potentially put its users at risk for stalking by predators with a modicum of hacking ability. First, the location processing takes place on the client side, so actual location data for matched users in a 25 mile radius is delivered directly to the user’s device, unmediated by the Tinder servers. Second, that data is incredibly accurate, within 100 ft. or less.</blockquote><p>In short, Tinder failed to review the data returned in their API payload. Instead of the API sending approximate location data to the front-end mobile app, the mobile app received exact latitude/longitude coordinates for matched users from the API. When the API was made public, this was never adjusted, thereby exposing matched users returned by the API to a multitude of risks. This security flaw has since been resolved.</p><p><strong>Summary:</strong> Don’t assume your API was designed to be used outside of the original use case. Take the time to review <strong>every endpoint</strong> to ensure that the data being returned is appropriate for developers outside of the organisation.</p><h4>2. Improve your API documentation</h4><p>When APIs are private, many of the details are transferred by word-of-mouth. Do you have a question about how one of your private APIs work? Just walk over and ask one of the team members. Developers are nearby, either in the same office or on the same internal message channels. When taking a private API public, this is no longer the case. Better API documentation is required.</p><p>A few of the <a href="http://launchany.com/10-questions-your-api-document-must-answer/">questions that your documentation needs to answer</a> include:</p><ul><li>What capabilities and features does your API offer?</li><li>How does your API’s authentication and authorization work?</li><li>What endpoints are offered and what are the request/response details?</li></ul><p><strong>Summary</strong>: Be sure to <a href="http://launchany.com/building-your-api-documentation-strategy-for-success/">revisit your API documentation strategy</a> to ensure that you are able to address these questions for API consumers just getting started with your public API.</p><h4>3. Write usage examples</h4><p>Private APIs are often consumed by applications for which you already have the source code. Therefore, examples of how the API is used exist already. Once your API goes public, your API consumers will need examples to understand how to use it.</p><p>Examples may use a combination of cURL and code snippets for the top 3–5 programming languages of your target audience. At a minimum, they should demonstrate how to accomplish simple tasks based on your API capabilities.</p><p>I also strongly recommend demonstrating more complex examples alongside the simple ones by building demo applications, allowing developers to gain a deeper understanding of how to connect API calls together to tackle larger solutions.</p><p><strong>Summary:</strong> Add code samples and demostration apps to help developers integrate your API faster. You can learn more about how to incorporate code examples into your documentation from our recent article, <a href="https://tyk.io/blog/great-api-documentation-requires-code-examples/"><em>Great API documentation requires code examples</em></a>.</p><h4>4. Install rate limiting and endpoint protection</h4><p>Mistakes happen. Developers may introduce a logic bug that causes their code to hit your API way too often. Or, perhaps a developer has some ideas on how to take down your API.</p><p>Before taking your API public, install an API gateway or management layer. This will ensure that rate limits are applied to incoming requests, protecting your endpoints from accidental or malicious spikes in usage that may result in poor performance and increased cloud infrastructure costs.</p><p><strong>Summary:</strong> API gateways and management layers protect each of your endpoints from unauthorized use and malicious attacks, allowing your API to offer tiered access on an authorisation or subscription basis. Whether you are taking your API public or maintaining a private API, <a href="https://www.tyk.io/docs/get-started/">installing an API gateway on-premise or in the cloud</a> should be one of your first steps.</p><h4>5. Define KPIs and usage reports to drive improvement</h4><p>Once you release your public API, you will need to ensure that your public API meets your business and technical goals. Many API gateways and management layers offer analytics support to track usage. These metrics can be used to assess your key performance indicators (KPIs) that business stakeholders use to measure success. They will also ensure your infrastructure is performing within expected parameters.</p><p><strong>Summary</strong>: Using your API product strategy as a guide, start by selecting a few key metrics to track. Then layer new or different kinds of metrics to assess the health of your business. Work with your product management and executives to identify both the business and technical metrics necessary to monitor the health of your new public API product.</p><h4>Taking your API public requires planning</h4><p>As these 5 items point out, taking your API public isn’t as easy as changing a firewall setting and allowing access to your internal APIs. It takes planning and consideration about security, developer experience, protection, and performance. Be sure to develop a plan for rolling your API out to partners or public developers, to reduce the risks associated with opening your API outside of your organisation.</p><p><strong>Ready to launch your API to the world? Tyk’s open source API gateway and management platform provides all the features you need, including API security, rate limiting, detailed API analytics, and a developer portal. </strong><a href="https://tyk.io/#get-started"><strong>Get started now</strong></a><strong> — you’ll be managing your APIs in minutes.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70c772f7ebeb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/5-things-to-do-before-taking-your-private-api-public-70c772f7ebeb">5 things to do before taking your private API public</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Tyk and Git to source-control your APIs]]></title>
            <link>https://medium.com/api-gateway-guide/using-tyk-and-git-to-source-control-your-apis-dfc4bc20f03c?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/dfc4bc20f03c</guid>
            <category><![CDATA[api-integration]]></category>
            <category><![CDATA[api-management]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[tyk]]></category>
            <category><![CDATA[api-development]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Wed, 11 Oct 2017 03:03:13 GMT</pubDate>
            <atom:updated>2018-08-03T12:37:24.610Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using Git to source-control your APIs</h3><p>Author : <strong>Martin Buhr</strong></p><figure><img alt="Using Tyk and Git to source control your APIs" src="https://cdn-images-1.medium.com/max/720/0*9LPHG60Sl1MbHiDQ.png" /></figure><p>We get asked, and quite often, how to transition an API configuration from one system to another, especially in the world of continuous deployment and integration. We’re finding more and more cases where APIs need to be migrated from a dev environment, through a test pipeline and into a pre-production or production environment.</p><p>The thing is, the further away you get from the dev environment, the less reliant you want to be on people to implement the thing that’s been built. It becomes a real pain to manage and you have to deal with human error.</p><p>We’ve experimented with improving this process by creating a Tyk integration with Git for a future release, and because we like to run proof of concepts before we actually build larger features, we created a small tool that integrates with the Tyk APIs and Git.</p><p>We gave this tool the extremely imaginative name: ‘<a href="https://github.com/TykTechnologies/tyk-git">Tyk-Git</a>’, and this article outlines how to use Tyk and Git to source control your APIs.</p><p>To follow this article you can get hold of Tyk for free at <a href="https://tyk.io/">https://tyk.io</a> , Tyk is a leading open source API management platform.</p><p><em>Warning: Tyk-Git is in an early stage of development; we know it works, but you use it at your own risk!</em></p><h4><strong>Source control: usually a bit of a PITA</strong></h4><p>Tyk has a really fancy dashboard, and a great API designer that lets you configure, tweak and model your services, but if you want to move your API from your Dev to QA environment, you need to export the API Definition, or use the Dashboard REST API to move things around.</p><p>Assuming you’ve pulled all the relevant data, you also need to store it and then deploy it to the next system. This is fine for new services, but what about modified ones? For example, what if your team has finished v3 of your API, and you’ve added it to your dev gateway, but you need to transfer that change across to the other environments? Doing it manually is possible, but <em>probably</em> not a great idea.</p><p>Again, you could export and import the data using the REST API (that’s what it’s there for after all), but there is still some massaging to do to the data to get things <em>just</em> right (like aligning API IDs, Organisation IDs and Policy IDs).</p><p>And throughout all this wrangling, you would be taking your configuration files and storing them in a version control system like Git, where you can move everything you need to, and with a single process.</p><p>So basically, in order for you to remove human error, store your API Gateway settings alongside your services and other infrastructure configs, and migrate configurations between environments, you need to jump through quite a few hoops…</p><h4><strong>Enter Tyk-Git</strong></h4><p><em>Reminder: Tyk-Git is in an early stage of development; we know it works, but you use it at your own risk!</em></p><p>The <a href="https://github.com/TykTechnologies/tyk-git"><strong>Tyk-Git tool</strong></a> is very simple to use — we’ll walk through a use case here. Let’s say you want to move your configuration from your dev environment to your integration environment. To do this, you would:</p><pre>martin@tyk-git&gt;./tyk-git dump --dashboard=&quot;http://localhost:3000&quot; --secret=&quot;b2d420ca5302442b6f20100f76de7d83&quot; --target=&quot;./tmp&quot;</pre><pre>Extracting APIs and Policies from <a href="http://localhost:3000/">http://localhost:3000</a></pre><pre>&gt; Fetching policies</pre><pre>--&gt; Identified 1 policies</pre><pre>--&gt; Fetching and cleaning policy objects</pre><pre>&gt; Fetching APIs</pre><pre>--&gt; Fetched 3 APIs</pre><pre>&gt; Creating spec file in: tmp/.tyk.json</pre><pre>Done.<br>Here we’ve told Tyk-Git to dump the API Definitions and the Policies from the dashboard located at <a href="http://localhost:3000/">http://localhost:3000</a> using our API Key (secret). We want this data to be dumped in the ./tmp directory.</pre><pre>If you look at the tmp directory, it will now look like this:</pre><pre>martin@tyk-git&gt; ls -al tmp</pre><pre>total 18592</pre><pre>drwxrwxrwx 0 root root  512 Aug 15 10:30 ./</pre><pre>drwxrwxrwx 0 root root  512 Aug 15 15:12 ../</pre><pre>-rwxrwxrwx 1 root root 4481 Aug 15 14:20 api-99991.json*</pre><pre>-rwxrwxrwx 1 root root 4481 Aug 15 14:20 api-99992.json*</pre><pre>-rwxrwxrwx 1 root root 4490 Aug 15 14:20 api-99993.json*</pre><pre>-rwxrwxrwx 1 root root  643 Aug 15 14:20 policy-5925078a97f43e086720ce38.json*</pre><pre>-rwxrwxrwx 1 root root  308 Aug 15 14:20 .tyk.json*<br>(ignore the file flags here, this demo was written on a windows box with the linux subsystem)</pre><pre>What you can see here are three APIs and one policy. You’ll notice that the APIs have odd ID’s, they are really short: 9991, 9992, and 9993.</pre><pre>The reason for this is because the Tyk Dashboard (On-Premises) actually supports arbitrary API IDs. If you look at the file contents for an API Definition, you will see a database ID *and* an API ID, it is the latter that is transportable:</pre><pre>martin@tyk-git&gt; head -10 tmp/api-99991.json</pre><pre>{</pre><pre>&quot;api_definition&quot;: {</pre><pre>&quot;id&quot;: &quot;<strong>598ec94f9695f201730d835b</strong>&quot;,</pre><pre>&quot;name&quot;: &quot;Dash 1&quot;,</pre><pre>&quot;slug&quot;: &quot;dash-1&quot;,</pre><pre>&quot;api_id&quot;: &quot;<strong>99991</strong>&quot;,</pre><pre>&quot;org_id&quot;: &quot;591ea6b10668f001852ae77a&quot;,</pre><pre>&quot;use_keyless&quot;: false,</pre><pre>&quot;use_oauth2&quot;: false,<br>The Tyk Gateway will operate only on the API ID, not the database ID. The same thing applies to policies, though it isn’t quite as clear cut.</pre><pre>With a policy, there are two ID objects:</pre><pre>martin@tyk-git&gt; head -3 tmp/policy-5925078a97f43e086720ce38.json</pre><pre>{</pre><pre>&quot;_id&quot;: &quot;5990cf459695f201730d836d&quot;,</pre><pre>&quot;id&quot;: &quot;5925078a97f43e086720ce38&quot;,<br>In Tyk, we call this ID masking, and it is a bit of a sleight of hand to make policy-IDs portable. Back when the portal and policies were first created, they were a dashboard-only construct, and so weren’t designed with immutable IDs in mind. So we introduced ID masking, where the masked id is replaced for the DB ID if it is present, but it is not always present.</pre><pre>However, with Tyk-Git, you don’t need to worry about that, because it will make your policy ID immutable by default (i.e. if the policy is dumped, and does not have a masked ID, Tyk-Git will make sure it does by copying the existing ID over).</pre><pre>This is important, because it means that once these files are created you can use them in other environments safely.</pre><pre>When I say safely, I mean that if you are modifying an existing, live policy, and then migrating it through the flow, you do not want the ID to vanish, because it could affect all keys that make use of it. The immutable ID enforcement mean that you can retain your configuration and make it fully portable between systems.</pre><pre><strong>Restoring and synchronising with your other dashboard</strong></pre><pre>So you now have your files, your tooling and your git repo, you are ready to deploy to your production environment. To go about doing that is surprisingly simple:</pre><pre>martin@tyk-git&gt; ./tyk-git sync --dashboard=&quot;http://localhost:3001&quot; --secret=&quot;b2d420ca5302442b6f20100f76de7d83&quot; --branch=&quot;refs/heads/prod&quot; <a href="https://github.com/myname/my-apis.git">https://github.com/myname/my-apis.git</a></pre><pre>Using publisher: Dashboard Publisher</pre><pre>Fetched 3 definitions</pre><pre>Fetched 1 policies</pre><pre>Processing APIs...</pre><pre>Deleting: 0</pre><pre>Updating: 3</pre><pre>Creating: 0</pre><pre>SYNC Updating: 598ec94f9695f201730d835b</pre><pre>SYNC Updating: 598ec9589695f201730d835c</pre><pre>SYNC Updating: 5990cfee9695f201730d836e</pre><pre>Processing Policies...</pre><pre>Deleting policies: 0</pre><pre>Updating policies: 1</pre><pre>Creating policies: 0</pre><pre>SYNC Updating Policy: Test policy 1<br>There’s quite a lot going on here, so let’s break it down step by step:</pre><pre><strong>./tyk-git sync</strong></pre><pre>This invokes the synchronisation mode. This is a one-way push from the repository to your dashboard, it will:</pre><ul><li>Remove APIs and Policies that are not in Git</li><li>Update APIs and Policies that are in Git</li><li>Create APIs and Policies that are in Git but not found in the dashboard</li></ul><pre><strong>--dashboard=&quot;</strong><a href="http://localhost:3001/"><strong>http://localhost:3001</strong></a><strong>&quot;</strong></pre><pre>Target a dashboard. You can also target a gateway, but this tool is probably most useful for dashboard users.</pre><pre><strong>--secret=&quot;b2d420ca5302442b6f20100f76de7d83&quot;</strong></pre><pre>The secret to use with your dashboard. If you do not want to use a flag, you can actually also set an environment variable: TYKGIT_DB_SECRET.</pre><pre><strong>--branch=&quot;refs/heads/prod&quot;</strong></pre><pre>If you are pipelining your builds, you might have release branches, with Tyk-Git you can target the specific branch using this flag.</pre><pre><a href="https://github.com/myname/my-apis.git"><strong>https://github.com/myname/my-apis.git</strong></a></pre><pre>Your repository address, pretty self explanatory stuff.</pre><pre>If we examine the output of the command, we can see a few things have happened:</pre><ul><li>It fetched 3 API Definitions from our git repo</li><li>It fetched 1 policy</li><li>When syncing with the dashboard, it actually updated 3 APIs, (i.e. they were already present on the system, and therefore needed updating, not creating)</li><li>It also only updated an existing policy, again, the policy was found, and changed as opposed to created</li><li>No policies or API Definitions on the dashboard needed to be deleted in order to satisfy the synchronisation process</li></ul><pre>This means that in our target environment, the APIs and the policy already existed and Tyk-Git just updated those, and it will have done this using masked IDs and the API ID matching so that it is completely transparent to any API user or UI user.</pre><h4><strong>How you can use this</strong></h4><pre>So now, if you ever end up in a dev cycle where you need to make changes to your API Gateway, you can make those interactively in the development environment. Then you can dump those into a branch, move that branch through your CI pipeline to QA and Testing, and once it has been validated, you can guarantee that those changes make it to production, the same way, every time.</pre><pre>Now that you can version control your API Definitions easily, you can also deploy those API Definitions selectively to environments that are not necessarily part of CI or CD systems.</pre><pre>We’ll be improving and tweaking Tyk-Git, and we expect this functionality to make it into the core applications in future. In the meantime, feel free to <a href="https://github.com/TykTechnologies/tyk-git"><strong>give Tyk-Git a go</strong></a> and let us know what you think.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfc4bc20f03c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/using-tyk-and-git-to-source-control-your-apis-dfc4bc20f03c">Using Tyk and Git to source-control your APIs</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST best practices 101]]></title>
            <link>https://medium.com/api-gateway-guide/rest-best-practices-101-3fd8db4d50e9?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/3fd8db4d50e9</guid>
            <category><![CDATA[white-papers]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Fri, 29 Sep 2017 07:59:49 GMT</pubDate>
            <atom:updated>2018-03-02T15:02:24.091Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Our latest edition of API Expertise features a special guest post on REST API Best Practice from Dasun Hegoda, Technical Lead at Information and Communication Technology Agency (ICTA), Sri Lanka. This blog was first published at </strong><a href="http://www.dasunhegoda.com/"><strong>www.dasunhegoda.com</strong></a><strong>.</strong></p><p>SOA (Service Oriented Architecture) has become a foundation for the most of the applications that are developed today. A service oriented architecture is an architectural pattern which enables a collection of services to communicate with external/internal parties to pass data or for coordinating services. Let’s start from the beginning…</p><h4>What’s a Service/API?</h4><blockquote>A service is a function that is well-defined, self-contained, and does not depend on the context or state of other services.</blockquote><p>In other words it’s an interface used by software components to communicate with each other. Let’s understand the difference between API and Web Services. A Web Service is a type of API, almost always one that operates over HTTP. In the modern world there are two types of web services that are used:</p><ul><li>SOAP</li><li>REST</li></ul><p>We can’t compare REST with SOAP since SOAP is a protocol and REST is an architectural pattern. People mostly get confused when selecting one for their application. If you are wondering what’s the difference between these two you can get a good start from <a href="https://stackoverflow.com/questions/19884295/soap-vs-rest-differences">this Stack Overflow article on SOAP vs REST</a>.</p><p>Our focus today is on REST. How we can implement a perfect REST API? What are the best practices? Let’s get down to business.</p><h4>1. Abstract vs Concrete</h4><p>When designing a REST API you should endeavour to make the API as concrete as possible. It will make the API less confusing to your consumers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/0*vvr6H6x4kBMUJ6qw.png" /></figure><h4>2. CRUD Operations</h4><p>There are four available methods when designing a REST API; GET, POST, PUT and DELETE. Below is a proposed methodology to implement CRUD operations in a REST API. <em>Note that this is suggested by me and you can alter this as per your requirement.</em><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>ResourcePOSTGETPUTDELETE/dogCreate a new dogList dogsReplace dogs with new dogs(Bulk update)Delete all dogs/dog/1234ErrorShow dogIf exist update dog else ERRORDelete dog<br>I know there is confusion surrounding PUT and DELETE. <a href="https://stackoverflow.com/questions/1828790/restful-put-and-delete-and-firewalls">Read more about RESTful PUT and DELETE functions</a>, and <a href="https://stackoverflow.com/questions/4573305/rest-api-why-use-put-delete-post-get">here for clarifications on why use PUT DELETE POST GET</a> from helpful Stack Overflow posts.</p><h4>3. Error Handling</h4><p>Error handling gets less attention but is the most important part of any REST API. You must give as many hints as possible to your API consumer about the error and why it has occurred. Also, make sure that throughout the API you provide granular level error messages. Below is an example:</p><pre>{<br> &quot;status&quot;: 401,<br> &quot;error_code&quot;: 2005,<br> &quot;error_message&quot;: &quot;Authentication token has expired&quot;,<br> &quot;more_info&quot;: &quot;http://dasunhegoda.com/api/doc/token_error&quot;<br> }</pre><p>You can <a href="https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">make use of HTTP status code</a> for this purpose.</p><h4>4. API Versioning</h4><p>In any API, versioning is important to maintain consistency. It can be done in many ways but below are my preferred methods:</p><p><strong>Method 1</strong><br>You can use the letter ‘v’ in the URL to denote the API version as below.</p><pre><a href="http://dasunhegoda.com/api/v2/dog/1234">http://dasunhegoda.com/api/v2/dog/1234</a></pre><p><strong>Method 2</strong><br>You can use the additional parameter at the end of the URL.</p><pre><a href="http://dasunhegoda.com/api/dog/1234?v=2.0">http://dasunhegoda.com/api/dog/1234?v=2.0</a></pre><p>There are various opinions on using API versioning. This <a href="https://stackoverflow.com/questions/389169/best-practices-for-api-versioning">Stack Overflow post on best practices for API Versioning</a> is useful.</p><h4>5. Filtering</h4><p>Don’t provide unnecessary data to your API consumers. It will clutter your REST API unnecessarily. Instead, let the developer choose what he needs.</p><p>For this we can use filtering methods in our APIs:</p><pre>/dogs/1234?value1,value2,value3,value4</pre><p>You can also use pagination for this purpose where you don’t have to return all the results at once. The query below is similar to MySQL:</p><pre>/dogs?limit=25&amp;offset=20</pre><p>You can read more on <a href="http://stackoverflow.com/questions/5020704/how-to-design-restful-search-filtering">how to design RESTful search filtering</a> in this helpful Stack Overflow post.</p><h4>6. Security</h4><p>Security is one of the major concerns when compared to SOAP because there are no standards such as ws-security defined for REST.</p><ul><li>You can use HTTPS across your APIs.</li><li>Don’t forget to include a timestamp in each API request and response. Make sure to log them all. In case of a dispute, you can refer to them.</li><li>Use an access_token to make sure that API is invoked by the trusted parties. You can supply the access_token so only API consumers with the access_token can invoke the API. Read more.</li></ul><h4>7. Analytics</h4><p>Once you start logging every API request and response you can build an analytical platform on top of that. If the number of records are high you might have to consider Big Data technologies. Having analytics in your REST API will give you a good insight of what’s happening your API.</p><h4>8. Documentation</h4><p>Proper Documentation is vital for the API. It doesn’t matter how great your API design is if your API consumers can’t use it properly. You can use tools such as <a href="http://apidocjs.com/">apidocjs</a> for this purpose. It’s really easy to get started with.</p><h4>9. Stability and Consistency</h4><p>Depending on your requirements you should consider a highly available architecture for your REST API. If you are wondering how to implement high availability in your REST API you can <a href="http://dasunhegoda.com/high-availability-deployment-architecture/1003/">read my article on high availability deployment architecture</a>.</p><h4>10. URL Structure</h4><p>You have to structure your API URL in an intuitive manner. Select a domain which is easy for marking as well. Eg:- api.yourdomain.com. When structuring your REST API you can use the following format:</p><ul><li>GET tasks/5/messages — Retrieves list of messages for task #5</li><li>GET tasks/5/messages/10 — Retrieves the 10th messages for task #5</li><li>POST tasks/5/messages — Create a new message for task #5</li><li>DELETE tasks/5/messages/10 — Delete the 10th messages of task #5</li><li>PUT tasks/5/messages/12 — Update the 12th messages of task #5</li></ul><p>If you have developed your REST API properly you should have the above features in it. You should keep these in mind when designing your REST API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/0*vlL-kDU0-LYWwQV4.jpeg" /></figure><p>So that’s it about REST API architecture. If you have any questions or would like to read more about some of my projects, visit <a href="http://dasunhegoda.com/">www.dasunhegoda.com</a>. Your feedback is highly appreciated.</p><p><em>Dasun Hegoda is a Technical Lead at the Information and Communication Technology Agency (ICTA), for the Government of Sri Lanka. He specialises in Enterprise Application Development (EAD) with more than 6 years of industry experience in the field of IT &amp; Digital Arena.</em></p><p><strong>Got some API Expertise you think the Tyk community would benefit from? We’d love to see it! </strong><a href="https://tyk.io/about/contact/"><strong>Get in touch</strong></a><strong> — the most relevant or insightful pieces will be considered for our blog.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fd8db4d50e9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/rest-best-practices-101-3fd8db4d50e9">REST best practices 101</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are your web and mobile APIs putting your business at risk?]]></title>
            <link>https://medium.com/api-gateway-guide/are-your-web-and-mobile-apis-putting-your-business-at-risk-854345533af5?source=rss----f32278884e10---4</link>
            <guid isPermaLink="false">https://medium.com/p/854345533af5</guid>
            <category><![CDATA[white-papers]]></category>
            <dc:creator><![CDATA[James Hirst]]></dc:creator>
            <pubDate>Tue, 05 Sep 2017 07:16:13 GMT</pubDate>
            <atom:updated>2018-03-02T15:02:16.914Z</atom:updated>
            <content:encoded><![CDATA[<p>Author : <strong>James Higginbotham</strong></p><p>Do you have an unprotected web or mobile API? You might, whether you realise it or not. Web APIs are often used to connect mobile and web application to a backend database from a JavaScript front-end. These APIs, while not published on your website, still need to be protected from malicious attacks.</p><p>Let’s examine the five common risks encountered as a result of publishing unprotected APIs, and then identify how to mitigate them. (for further API Security guidance, visit the original home of this post <a href="http://tyk.io/">http://tyk.io</a> )</p><h4>Risk #1: Uncontrolled API Access</h4><p>Did you know that private, hidden APIs aren’t really hidden? Any developer can often reverse-engineer APIs used by web and mobile applications to understand how they work. Then they can simply use them for their own purpose, often unbeknownst to your business. When this happens, you:</p><p><strong>Inability revoke API access:</strong> Since these ‘Accidental APIs’ often don’t require authentication tokens (or use shared tokens), there is no way to shutdown access for a specific application without disrupting all other web and mobile applications. Mobile apps will likely need to be updated to use a new key, and it may take some time before all installed versions are updated, causing downtime and loss of revenue.</p><p><strong>Unlimited data/application usage:</strong> In addition, lack of proper authentication mechanisms allow developers to easily access any/all available data without restriction. Your valuable data is then exposed, without limitation, to anyone and without proper logging and auditing.</p><p><strong>Mitigation:</strong> Implement API security to restrict access to the API, using standards such as OAuth 2.</p><h4>Risk #2: Inability to Monitor, Monetize, and Scale</h4><p>Accidental APIs lack monitoring capabilities, preventing any insight from who, and how, an API is used.</p><p><strong>Lack of Usage Metrics/Insights:</strong> Lack of insight into what partners/applications are using the API, how they are using it, and where revenue opportunities may exist. This is most important for integration partners, as contract renewals may allow for an increase in revenue for partners that more heavily depend upon the API.</p><p><strong>Lack of Consumption Awareness:</strong> APIs will change and without monitoring, you will have no idea which partners, internal departments, or integration partners use a particular part of the API that is being changed.</p><p><strong>Lack of scalability:</strong> Lack of proper management prevent the ability to monitor and scale APIs. Often, APIs are co-deployed with other applications, which may limit the ability to easily deploy and scale quickly. This lack of rate limiting can overwhelm servers and reduce the performance of your application, or even render it unavailable.</p><p><strong>Mitigation:</strong> Select and install an API management layer.</p><h4>Risk #3 Added Maintenance Costs</h4><p>Accidental APIs are often developed in a hurry, many times with little or no time spent to ensure that they have been designed to last. Issues often encountered as a result include:</p><p><strong>Bad design:</strong> This results in slower development, hard-to-understand design, cryptic error messages (or none at all), and longer development time when debugging integration with mobile or web applications</p><p><strong>Versioning issues:</strong> Lack of thoughtful design requires versioning an API, which will require dedicated time from mobile developers to fix and push one or more updates to mobile applications. This often requires maintaining multiple versions of the API for a longer period of time, costing the company 2–5x that of a well-designed product API</p><p><strong>Lack of business value:</strong> Accidental APIs aren’t designed to deliver complete business value. Partner APIs will likely result in multiple, one-off partner or platform APIs for successful integration</p><p><strong>Mitigation:</strong> Invest in a proper API design by applying practical design principles that will deliver high business value, reduce costs, and encourage reuse.</p><h4>Risk #4: Lack of API Security</h4><p>Until now, we have focused on risks that are related more to the business and daily operations. Now we enter the last two risks, where we see a more severe impact. These risks can not only affect business operations, they can also affect the longevity of the business and your customers. Accidental APIs open up a variety of security-related issues, including:</p><p><strong>Insecure communications:</strong> Accidental APIs may be deployed without SSL, either if the primary application doesn’t require it or if the API is deployed haphazardly. This means that logins, passwords, and other sensitive data are sent in plain text and easily obtained.</p><p><strong>Industry or business compliance failures:</strong> Lack of proper security precautions can often expose holes in the company’s PCI compliance, or other industry regulations.</p><p><strong>Mitigation:</strong> Conduct a security audit of the API, implement the appropriate measures, and ensure TLS is used to encrypt API communication channels. You may wish to also consider an API management layer that implements authentication standards such as OAuth 2.</p><h4>Risk #5: Malicious API Attacks and Compromised Data</h4><p>The final risk is related to API attack vectors with the intent of compromising the system and its data. Accidental APIs tend to expose systems to the following vulnerabilities:</p><p><strong>Denial of Service (DoS) attacks:</strong> Attackers can try to reduce or completely eliminate the system’s ability to service incoming calls by overwhelming the system with API calls, rendering the system unusable by internal, partner, and potentially public consumers of the API.</p><p><strong>SQL injection attacks:</strong> SQL injection is a technique uses to try to access or modify data by attempting to alter SQL statements executed by the API endpoints, exposing data that was previously not available.</p><p><strong>XML attacks:</strong> An XML attack is designed to compromise servers by sending large, invalid, or malformed XML content. Servers are often made unavailable due to memory leaks or high CPU usage when trying to process large or malformed content.</p><p><strong>Mitigation:</strong> Conduct an operations audit of the API environment, a code review to prevent various attack vectors, and a thorough review of all data sent and received by the API.</p><h4>How Protected Is Your API?</h4><p>Without API protection, your API is vulnerable. It is time to install an API management layer in front of your API to protect your business and your digital assets. You can find out more about the various API attack vectors and how Tyk can protect your API in our previous article, <a href="https://tyk.io/blog/how-secure-is-your-api/">“How Secure Is Your API?”</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=854345533af5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/api-gateway-guide/are-your-web-and-mobile-apis-putting-your-business-at-risk-854345533af5">Are your web and mobile APIs putting your business at risk?</a> was originally published in <a href="https://medium.com/api-gateway-guide">API Gateway Guide</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>