Although I don’t work in road ecology or traffic engineering, the author somehow pulled me through 300 pages on this topic. He managed this not just through vivid language and diction, but by personally visiting places and telling stories about the specific challenges that animals, “carers,” forest service workers, and others faced as freeways and highways bisected and dissected their environments.
To use an analogy, suppose you’re a barista making espresso coffee. An AGI-capable robot trained as a barista is able to make all the coffee that a regular barista can make but twice as fast. Further, the Android barista can create exquisite espresso art in any shape that humans request, wowing them and making the experience novel. Soon the human barista is replaced. After all, the paying customer would rather pay $2.50 for a robot to make a latte instead of $5.00, especially when it tastes the same.
Most code samples in documentation are fairly basic, which is by design. Documentation tries to show the most common use of the API, not advanced scenarios for an enterprise-grade app whose complexity would easily overwhelm developers. (At that point, you end up with a sample app.)
With AI tools built directly into your authoring tool or IDE (such as VS Code), fixing simple doc bugs can become a mechanical, click-button task. Here’s the approach to fixing simple doc bugs:
(Note: The fact that I’m writing a book review on this topic might seem odd given that I usually focus on tech comm topics. However, I document APIs for getting map data into cars, so I sometimes read books related to the automotive and transportation domain. I also run a book club at work focused on these books.)
During the past few weeks, I’ve felt like my brain’s RPMs have been in the red zone. Granted, the constant stream of chaotic political news hasn’t helped—but regardless of current political events, I’m frequently checking the news, my email, and chat messages and operating in a mode that isn’t great. Reading long-form books has proven to be difficult. I run a book club at work focused on automotive and transportation books, and it took me two months to make it through a single book (granted, it was a 300-page historically dense book, but still).
“Biohacking” might be a pretentious cyber term for what is otherwise a straightforward experiment. For 10 days, I tracked my food and exercise levels while also wearing a continuous glucose monitor (CGM) to track my glucose levels. I then used AI to pair up the food + exercise with the glucose readings and perform an analysis about triggers for glucose spikes and recommendations to avoid them.
I want you to act as my AI stream journal (similar to a bullet journal), for the day. In this chat session, I’ll log 3 kinds of notes: tasks, thoughts, and events. Tasks are to-do list items. Thoughts are random ideas or notes I have. Events consist of food eaten, exercise, or descriptions of my internal states. The point is to have an easy way to dump all the scattered information in my head into a central log that you organize and analyze on my behalf.
RAML stands for REST API Modeling Language and is similar to the OpenAPI specification. RAML is backed by Mulesoft, a full-service, end-to-end API company.
Note that unless you’re publishing your docs with Mulesoft or another platform that specifically requires RAML, I recommend using the OpenAPI specification instead. However, Mulesoft offers enterprise-grade API design, management, and deployment capabilities. If you’re using Mulesoft for your API, you probably want to use RAML for your documentation specification.
Similar to OpenAPI, after you create a RAML file that describes your API, it can be consumed by different platforms to parse and display the information in interactive outputs. The RAML format, which uses YML syntax, is human-readable, efficient, and simple. Here’s what the RAML output looks like in API Console (which is similar to Swagger UI):
It’s important to note that with these REST API specifications (as with the OpenAPI spec), you’re not just describing an API to generate a nifty doc output with an interactive console. There are tools that can also generate client SDKs and other code from the spec into a library that you can integrate into your project. These tools can make it easier for developers to make requests to your API and receive responses.
Additionally, the interactive console can provide a way to prototype and beta test your API before developers even start coding. Mulesoft offers a “mocking service” for your API that simulates calls and responses. The idea of the mocking service is to design your API the right way from the start, without iterating with different versions as you try to get the endpoints right.
Sample spec for OpenWeatherMap API
To understand the proper syntax and format for RAML, you need to read the RAML spec and look at some examples. See this RAML tutorial to get started.
Here’s the OpenWeatherMap API (which we’ve been using in this course) formatted in the RAML spec. (I actually just used API Transformer to convert my OpenAPI 3.0 spec to RAML.) As you can see, RAML is highly similar to the OpenAPI spec.
#%RAML 1.0title:OpenWeatherMap APIversion:2.5baseUri:https://mocksvc.mulesoft.com/mocks/082e051b-e960-48f7-9d75-2f49af8ccd86/data/2.5/# baseUri: http://api.openweathermap.org/data/2.5/baseUriParameters:{}documentation:-title:OpenWeatherMap APIcontent:'Getthecurrentweather,dailyforecastfor16days,andathree-hour-intervalforecastfor5daysforyourcity.Helpfulstats,graphics,andthisdayinhistorychartsareavailableforyourreference.Interactivemapsshowprecipitation,clouds,pressure,windaroundyourlocationstations.DataisavailableinJSON,XML,orHTMLformat.**Note**:ThissampleSwaggerfilecoversthe`current`endpointonlyfromtheOpenWeatherMapAPI.<br/><br/>**Note**:Allparametersareoptional,butyoumustselectatleastoneparameter.CallingtheAPIbycityID(usingthe`id`parameter)willprovidethemostpreciselocationresults.'securitySchemes:auth:type:Pass ThroughdescribedBy:queryParameters:appid:required:truedisplayName:appiddescription:API key to authorize requests.type:stringtypes:SuccessfulResponse:displayName:Successful responsetype:objectproperties:coord:required:falsedisplayName:coordtype:Coordweather:required:falsedisplayName:weatherdescription:(more info Weather condition codes)type:arrayitems:type:Weatherbase:required:falsedisplayName:basedescription:Internal parametertype:stringmain:required:falsedisplayName:maintype:Mainvisibility:required:falsedisplayName:visibilitydescription:Visibility, metertype:integerformat:int32wind:required:falsedisplayName:windtype:Windclouds:required:falsedisplayName:cloudstype:Cloudsrain:required:falsedisplayName:raintype:Rainsnow:required:falsedisplayName:snowtype:Snowdt:required:falsedisplayName:dtdescription:Time of data calculation, unix, UTCtype:integerformat:int32sys:required:falsedisplayName:systype:Sysid:required:falsedisplayName:iddescription:City IDtype:integerformat:int32name:required:falsedisplayName:nametype:stringcod:required:falsedisplayName:coddescription:Internal parametertype:integerformat:int32Coord:displayName:Coordtype:objectproperties:lon:required:falsedisplayName:londescription:City geo location, longitudetype:numberformat:doublelat:required:falsedisplayName:latdescription:City geo location, latitudetype:numberformat:doubleWeather:displayName:Weathertype:objectproperties:id:required:falsedisplayName:iddescription:Weather condition idtype:integerformat:int32main:required:falsedisplayName:maindescription:Group of weather parameters (Rain, Snow, Extreme etc.)type:stringdescription:required:falsedisplayName:descriptiondescription:Weather condition within the grouptype:stringicon:required:falsedisplayName:icondescription:Weather icon idtype:stringMain:displayName:Maintype:objectproperties:temp:required:falsedisplayName:tempdescription:'Temperature.UnitDefault:Kelvin,Metric:Celsius,Imperial:Fahrenheit.'type:numberformat:doublepressure:required:falsedisplayName:pressuredescription:Atmospheric pressure (on the sea level, if there is no sea_level or grnd_level data), hPatype:integerformat:int32humidity:required:falsedisplayName:humiditydescription:Humidity, %type:integerformat:int32temp_min:required:falsedisplayName:temp_mindescription:'Minimumtemperatureatthemoment.Thisisdeviationfromcurrenttempthatispossibleforlargecitiesandmegalopolisesgeographicallyexpanded(usetheseparameteroptionally).UnitDefault:Kelvin,Metric:Celsius,Imperial:Fahrenheit.'type:numberformat:doubletemp_max:required:falsedisplayName:temp_maxdescription:'Maximumtemperatureatthemoment.Thisisdeviationfromcurrenttempthatispossibleforlargecitiesandmegalopolisesgeographicallyexpanded(usetheseparameteroptionally).UnitDefault:Kelvin,Metric:Celsius,Imperial:Fahrenheit.'type:numberformat:doublesea_level:required:falsedisplayName:sea_leveldescription:Atmospheric pressure on the sea level, hPatype:numberformat:doublegrnd_level:required:falsedisplayName:grnd_leveldescription:Atmospheric pressure on the ground level, hPatype:numberformat:doubleWind:displayName:Windtype:objectproperties:speed:required:falsedisplayName:speeddescription:'Windspeed.UnitDefault:meter/sec,Metric:meter/sec,Imperial:miles/hour.'type:numberformat:doubledeg:required:falsedisplayName:degdescription:Wind direction, degrees (meteorological)type:integerformat:int32Clouds:displayName:Cloudstype:objectproperties:all:required:falsedisplayName:alldescription:Cloudiness, %type:integerformat:int32Rain:displayName:Raintype:objectproperties:3h:required:falsedisplayName:3hdescription:Rain volume for the last 3 hourstype:integerformat:int32Snow:displayName:Snowtype:objectproperties:3h:required:falsedisplayName:3hdescription:Snow volume for the last 3 hourstype:numberformat:doubleSys:displayName:Systype:objectproperties:type:required:falsedisplayName:typedescription:Internal parametertype:integerformat:int32id:required:falsedisplayName:iddescription:Internal parametertype:integerformat:int32message:required:falsedisplayName:messagedescription:Internal parametertype:numberformat:doublecountry:required:falsedisplayName:countrydescription:Country code (GB, JP etc.)type:stringsunrise:required:falsedisplayName:sunrisedescription:Sunrise time, unix, UTCtype:integerformat:int32sunset:required:falsedisplayName:sunsetdescription:Sunset time, unix, UTCtype:integerformat:int32/weather:get:displayName:Call current weather data for one locationdescription:Access current weather data for any location on Earth including over 200,000 cities! Current weather is frequently updated based on global models and data from more than 40,000 weather stations.securedBy:-authqueryParameters:q:required:falsedisplayName:qdescription:'**Cityname**.*Example:London*.Youcancallbycityname,orbycitynameandcountrycode.TheAPIrespondswithalistofresultsthatmatchasearchingword.Forthequeryvalue,typethecitynameandoptionallythecountrycodedividedbyacomma;useISO3166countrycodes.'type:stringid:required:falsedisplayName:iddescription:"**CityID**.*Example:`2172797`*.YoucancallbycityID.TheAPIrespondswiththeexactresult.TheListofcityIDscanbedownloaded[here](http://bulk.openweathermap.org/sample/).Youcanincludemultiplecitiesinthisparameter—justseparatethembycommas.Thelimitoflocationsis20.*Note:AsingleIDcountsasaoneAPIcall.So,ifyouhave3cityIDs,it’streatedas3APIcalls.*"type:stringlat:required:falsedisplayName:latdescription:'**Latitude**.*Example:35*.Thelatitudecoordinateofthelocationofyourinterest.Mustusewith`lon`.'type:stringlon:required:falsedisplayName:londescription:'**Longitude**.*Example:139*.Longitudecoordinateofthelocationofyourinterest.Mustusewith`lat`.'type:stringzip:required:falsedefault:94040,usexample:94040,usdisplayName:zipdescription:'**Zipcode**.Searchbyzipcode.*Example:95050,us*.Pleasenotethatifthecountryisnotspecified,thesearchusesUSAasadefault.'type:stringunits:required:falsedefault:standardexample:value:imperialdisplayName:unitsdescription:'**Units**.*Example:imperial*.Possiblevalues:`metric`,`imperial`.Whenyoudonotusethe`units`parameter,theformatis`standard`bydefault.'type:stringenum:-standard-metric-imperiallang:required:falsedefault:enexample:value:endisplayName:langdescription:'**Language**.*Example:en*.Youcanuselangparametertogettheoutputinyourlanguage.Wesupportthefollowinglanguagesthatyoucanusewiththecorrespondedlangvalues:Arabic-`ar`,Bulgarian-`bg`,Catalan-`ca`,Czech-`cz`,German-`de`,Greek-`el`,English-`en`,Persian(Farsi)-`fa`,Finnish-`fi`,French-`fr`,Galician-`gl`,Croatian-`hr`,Hungarian-`hu`,Italian-`it`,Japanese-`ja`,Korean-`kr`,Latvian-`la`,Lithuanian-`lt`,Macedonian-`mk`,Dutch-`nl`,Polish-`pl`,Portuguese-`pt`,Romanian-`ro`,Russian-`ru`,Swedish-`se`,Slovak-`sk`,Slovenian-`sl`,Spanish-`es`,Turkish-`tr`,Ukrainian-`ua`,Vietnamese-`vi`,ChineseSimplified-`zh_cn`,ChineseTraditional-`zh_tw`.'type:stringenum:-ar-bg-ca-cz-de-el-en-fa-fi-fr-gl-hr-hu-it-ja-kr-la-lt-mk-nl-pl-pt-ro-ru-se-sk-sl-es-tr-ua-vi-zh_cn-zh_twMode:required:falsedefault:jsonexample:value:jsondisplayName:Modedescription:'**Mode**.*Example:html*.Determinestheformatoftheresponse.Possiblevaluesare`xml`and`html`.Ifthemodeparameterisempty,theformatis`json`bydefault.'type:stringenum:-json-xml-htmlresponses:200:description:Successful responsebody:application/json:displayName:responsedescription:Successful responsetype:SuccessfulResponse404:description:Not found responsebody:{}
RAML’s specification format is highly similar to the OpenAPI spec. There’s really not much point in having multiple specifications for REST APIs in the industry, so my guess is that in five years, RAML will be obsolete.
Outputs
You can generate outputs using the RAML spec from a variety of platforms. Here are three ways:
API Console output. Choose this option if you want a standalone API Console output delivered on your own server. (Note that this option also allows you to embed the console in an iframe.)
RAML2HTML project. Choose this option if you want a simple HTML output of your API documentation. No interactive console is included.
More detail about each of these options is provided in the following sections.
Developer Portal on Anypoint platform
Anypoint is the API development platform on Mulesoft. APIs you develop with Mulesoft can be shared and viewed on their Anypoint Exchange portal.
The Anypoint console has a dashboard where you can work on your RAML definition, add other documentation pages (outside the spec), configure mocking services, and more. If your company already uses Mulesoft for other API development services, it would make sense to use their documentation and portal features as well. You can also export your RAML definition to OpenAPI through the Anypoint console.
The UI when working with RAML definitions in the Anypoint platform
Note that you can add additional pages to your documentation in Anypoint. (Kudos to the Mulesoft team for recognizing that API documentation is more than just a set of reference endpoints.)
OpenWeather API documentation in Mulesoft's Anypoint Exchange
One of the unique options Mulesoft offers is called API Notebook. This is a unique tool designed by Mulesoft that allows you to provide interactive code examples that leverage your RAML spec.
API Console output
You can download the same code that generates the output on the Anypoint Platform and create your own interactive documentation. The standalone project (on GitHub) is called API Console. Here’s a demo. Instructions for building API Console from a RAML file are available on the api-console project on GitHub. After you build the output, upload it to a web server and go to the index.html file.
Finally, you can also use a tool called RAML2HTML project to generate HTML documentation from a RAML spec. Here’s an example of what the RAML2HTML output looks like. It’s a static HTML output without any interactivity. See the RAML2HTML documentation for instructions on generating this output.
Conclusion
Exploring Mulesoft in more depth is beyond the scope of this tutorial, but hopefully I’ve introduced you to RAML and Mulesoft. Overall, large platforms that process and display your API documentation can only do so if your documentation aligns with a spec their tools can parse. RAML provides this standard spec for the Mulesoft ecosystem of tools. Their enterprise-level API tools provide powerful capabilities for your API.
About Tom Johnson
I'm an API technical writer based in the Seattle area. On this blog, I write about topics related to technical writing and communication — such as software documentation, API documentation, AI, information architecture, content strategy, writing processes, plain language, tech comm careers, and more. Check out my API documentation course if you're looking for more info about documenting APIs. Or see my posts on AI and AI course section for more on the latest in AI and tech comm.
If you're a technical writer and want to keep on top of the latest trends in the tech comm, be sure to subscribe to email updates below. You can also learn more about me or contact me. Finally, note that the opinions I express on my blog are my own points of view, not that of my employer.