background preloader

API

Facebook Twitter

REST assured with… by Abhishek Gupta. Why Your Colleagues Still Don’t Understand Hypermedia APIs — The RESTful Web. Why Your Colleagues Still Don’t Understand Hypermedia APIs THIS POST HAS BEEN ORIGINALLY WRITTEN BY LUKE STOKES AND IS AVAILABLE HERE (for a bunch of reasons and how Medium is currently handling URLs, we had to repost it) We’re telling everyone to do it wrong.

Why Your Colleagues Still Don’t Understand Hypermedia APIs — The RESTful Web

At the end of 2011, I set out to build a new API for FoxyCart. A couple months of research led me to drink the Hypermedia All The Things! Kool-Aid. Here’s something you might notice right away: the documentation is not standard. Notice anything? They all encourage client developers and API consumers to code directly to URLs. Hypermedia isn’t complicated. So what do we do about it? So back to our hAPI (my smile-inducing name for our Hypermedia API): we ended up building our own documentation from scratch.

But here’s the rub… Our documentation isn’t that great. So how do we find a balance between idealism about what Hypermedia API documentation systems “should” be and what they practically are? I don’t really have the answers. P.S. JSON-LD 1.0. 5.

JSON-LD 1.0

Basic Concepts This section is non-normative. JSON [RFC4627] is a lightweight, language-independent data interchange format. It is easy to parse and easy to generate. However, it is difficult to integrate JSON from different sources as the data may contain keys that conflict with other data sources. Example 1: Sample JSON document It's obvious to humans that the data is about a person whose name is "Manu Sporny" and that the homepage property contains the URL of that person's homepage. Linked Data, and the Web in general, uses IRIs (Internationalized Resource Identifiers as described in [RFC3987]) for unambiguous identification. Leveraging the popular schema.org vocabulary, the example above could be unambiguously expressed as follows: Example 2: Sample JSON-LD document using full IRIs instead of terms In the example above, every property is unambiguously identified by an IRI and all values representing IRIs are explicitly marked as such by the @id keyword. 5.1 The Context context .

Programmable Web API Developer Documentation. ProgrammableWeb - APIs, Mashups and the Web as Platform. Swagger: A simple, open standard for describing REST APIs with JSON. Document your API with style Swagger™ is a specification and complete framework implementation for describing, producing, consuming, and visualizing RESTful web services.

Swagger: A simple, open standard for describing REST APIs with JSON

The overarching goal of Swagger is to enable client and documentation systems to update at the same pace as the server. The documentation of methods, parameters, and models are tightly integrated into the server code, allowing APIs to always stay in sync. With Swagger, deploying managing, and using powerful APIs has never been easier. Who is responsible for Swagger™? Both the specification and framework implementation are initiatives from Wordnik. Why is Swagger™ useful? The Swagger framework simultaneously solves server, client, and documentation/sandbox needs. With Swagger's declarative resource specification, clients can understand and consume services without knowledge of server implementation or access to the server code. Swagger happily speaks both JSON and XML, with additional formats in the works. RESTful API modeling language.

REST API Examples - Current Mule Documentation. This page provides three examples of consuming REST APIs: a simple example that simply details how to retrieve data from a REST API, and two examples – one for XML and one for JSON – showing how to consume a REST API and insert selected data into an external database.

REST API Examples - Current Mule Documentation

Simple Example: Consuming a REST API Skip to the code This is a humorous but fully functional example designed for quick and effortless setup and testing. It queries the Bacon Ipsum REST API, which generates lorem ipsum text, and is convenient because it does not require HTTPS or setting up an account to use. The example consists of only one flow, shown below.

The first element, an HTTP inbound endpoint, listens on localhost port 8081 (the default) for incoming GET requests. The <query> part of the request consists of the parameters accepted by the REST API. For example, if you hit the HTTP inbound endpoint with the application will query The full configuration for this example is detailed below. API Design: Do You Swagger, Blueprint or RAML? I’m spending the next couple weeks going through each of the leading API design approaches: API Blueprint, RAML and Swagger.

API Design: Do You Swagger, Blueprint or RAML?

Even though I still personally use Swagger in my own work, I’m pushing myself to learn API Blueprint and RAML to better understand the landscape, as well as the pros and cons of each approach. If you aren’t familiar with this emerging trends in API design, they are approaches to defining your APIs either using JSON or a markdown language, which allows you to quantify and describe the API interfaces and underlying data models in a way that allows you to communicate with others, generate mock or production APIs, interactive documentation, code samples and potentially other tooling that will help you be successful in your API initiatives.

While there are other approaches, I’m focusing on what I consider to be the three leading approaches right now: