100% found this document useful (4 votes)
2K views

Building an API Product: Design, implement, and release API products that meet user needs 1st Edition Bruno Pedro 2024 Scribd Download

Pedro

Uploaded by

djidjaremili10
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (4 votes)
2K views

Building an API Product: Design, implement, and release API products that meet user needs 1st Edition Bruno Pedro 2024 Scribd Download

Pedro

Uploaded by

djidjaremili10
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 62

Download the full version of the textbook now at textbookfull.

com

Building an API Product: Design, implement,


and release API products that meet user needs
1st Edition Bruno Pedro

https://textbookfull.com/product/building-an-api-
product-design-implement-and-release-api-products-
that-meet-user-needs-1st-edition-bruno-pedro/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Biota Grow 2C gather 2C cook Loucas

https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-loucas/

textbookfull.com

API Design Patterns MEAP v07 Jj Geewax

https://textbookfull.com/product/api-design-patterns-meap-v07-jj-
geewax/

textbookfull.com

The Complete ASP.NET Core 3 API Tutorial: Hands-On


Building, Testing, and Deploying 1st Edition Les Jackson

https://textbookfull.com/product/the-complete-asp-net-core-3-api-
tutorial-hands-on-building-testing-and-deploying-1st-edition-les-
jackson/
textbookfull.com

Practical management and leadership for doctors Second


Edition Cotton

https://textbookfull.com/product/practical-management-and-leadership-
for-doctors-second-edition-cotton/

textbookfull.com
Dirty Player A Fake Relationship Sports Romance 1st
Edition Shae Sullivan [Sullivan

https://textbookfull.com/product/dirty-player-a-fake-relationship-
sports-romance-1st-edition-shae-sullivan-sullivan/

textbookfull.com

Analysis and Application of Analog Electronic Circuits to


Biomedical Instrumentation (Biomedical Engineering) 2nd
Edition Northrop
https://textbookfull.com/product/analysis-and-application-of-analog-
electronic-circuits-to-biomedical-instrumentation-biomedical-
engineering-2nd-edition-northrop/
textbookfull.com

A Conceptual Metaphor Account of Word Composition 1st


Edition Meihua Zheng

https://textbookfull.com/product/a-conceptual-metaphor-account-of-
word-composition-1st-edition-meihua-zheng/

textbookfull.com

Reconfiguring the Fifteenth-Century Crusade 1st Edition


Norman Housley (Eds.)

https://textbookfull.com/product/reconfiguring-the-fifteenth-century-
crusade-1st-edition-norman-housley-eds/

textbookfull.com

Advancement of Shock Capturing Computational Fluid


Dynamics Methods Numerical Flux Functions in Finite Volume
Method Keiichi Kitamura
https://textbookfull.com/product/advancement-of-shock-capturing-
computational-fluid-dynamics-methods-numerical-flux-functions-in-
finite-volume-method-keiichi-kitamura/
textbookfull.com
A Literary History of Reconciliation Power Remorse and the
Limits of Forgiveness Jan Frans Van Dijkhuizen

https://textbookfull.com/product/a-literary-history-of-reconciliation-
power-remorse-and-the-limits-of-forgiveness-jan-frans-van-dijkhuizen/

textbookfull.com
Building an API Product

Design, implement, and release API products


that meet user needs

Bruno Pedro
Building an API Product
Copyright © 2024 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted
in any form or by any means, without the prior written permission of the publisher, except in the case
of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable
for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.

Group Product Manager: Kunal Sawant


Senior Editor: Kinnari Chohan
Technical Editor: Vidhisha Patidar
Copy Editor: Safis Editing
Project Coordinator: Prajakta Naik
Indexer: Subalakshmi Govindhan
Production Designer: Prashant Ghare
Marketing DevRel Coordinator: Sonia Chauhan

First published: January 2024


Production reference: 1110124

Published by Packt Publishing Ltd.


Grosvenor House
11 St Paul’s Square
Birmingham
B3 1RB, UK

ISBN 978-1-83763-044-8
www.packtpub.com
To my wife, Vânia, and my two sons, Bernat and Enric. Without their ongoing love and support, I
wouldn’t have been able to write this book.
Contributors

About the author


Bruno Pedro is a computer science professional with over 25 years of experience in the industry.
Throughout his career, he has worked on a variety of projects, including internet traffic analysis, API
backends and integrations, and web applications. He has also managed teams of developers and founded
several companies, including Tarpipe, an iPaaS, in 2008, and the API Changelog in 2015. In addition
to his work experience, Bruno has also made contributions to the API industry through his written
work, including two published books on API-related topics and numerous technical magazine and
web articles. He has also been a speaker at numerous API industry conferences and events since 2013.
About the reviewers
David Roldán Martínez is currently the Head of APIs at Shaper by atmira. He also holds the position
of Associate Professor at the Universitat Politècnica de València (Spain) and is actively involved as a
researcher at VRAIN (Valencian Research of Artificial Intelligence Network).
Professionally, David is a Business and Solutions architect with over 25 years of experience in software
systems architecture. He holds a Ph.D. in Telecommunications Engineering and has a strong educational
background, including master’s degrees and extensive technological training. Additionally, he is a
scientific-technical evangelist, having authored more than thirty books.
David’s areas of expertise encompass APIs and their applications in various markets such as Banking,
Insurance, and Retail. He is well-versed in Artificial Intelligence, Digital Transformation, and the API
and Open Economy.

Christos Gkoros is a seasoned software engineer and architect with over 13 years of experience in
the industry. He has worked on a variety of projects in different technologies and industries, always
striving to find the best possible solution. With a focus on APIs, he is currently exploring ways to help
engineers in areas like API Design, API Management, and Strategy.
Christos has a proven track record of transforming complex challenges into streamlined, secure
systems, having spearheaded API design at Postman and microservice architecture at Vodafone. He
is passionate about mentorship and education and is committed to helping future talent grow and
succeed in the field.
Table of Contents

Preface xiii

Part 1: The API Product


1
What Are APIs? 3
The different types of APIs 3 The web 10
Local APIs 4 Available technologies and protocols 13
Remote APIs 5
Communication protocols 13
The history of APIs 7 Implementation technologies 14
Unix 9 Tools 16
Network APIs 9 Summary 17

2
API User Experience 19
Who uses APIs? 20 Second-degree user experience 30
Industries 20 API friction 30
Personas 24 Summary 32
Developer experience 27
viii Table of Contents

3
API-as-a-Product 35
Business value 36 Security 41
Monetization models 37 Logging and monitoring 41
The freemium model 38 Rate-limiting 42
Tiered model 38 Authentication and authorization 42
PAYG model 39 Summary 43
Support and documentation 39

4
API Life Cycle 45
Design 46 Maintenance 50
Implementation 48 Summary 51
Release 49

Part 2: Designing an API Product


5
Elements of API Product Design 55
Technical requirements 56 Validation 64
Ideation 56 Specification 66
Strategy 58 Summary 71
Definition 61

6
Identifying an API Strategy 73
The meaning of strategy 74 Personas 81
Stakeholders 76 Behaviors 84
Business objectives 79 Summary 85
Table of Contents ix

7
Defining and Validating an API Design 87
Technical requirements 88 Documentation 94
API capabilities 88 API mock 95
Use case analysis 88 Prototyping an API integration with
Functional requirements 91 a UI 100
Integration needs 92
Design iterations 103
Security and access control 93
Compliance with laws and regulations 94
Summary 104

8
Specifying an API 107
Technical requirements 108 AsyncAPI 119
Choosing the type of API to build 108 Creating a machine-readable API
Different types of APIs 110 definition 120
API specification formats 114 Following API governance rules 121
OpenAPI 114 API design 122
IDL (protocol buffers) 114 API life cycle management 123
GraphQL 115
Summary 124
WSDL 116

Part 3: Implementing an API Product


9
Development Techniques 129
Technical requirements 130 Popular languages for building APIs 134
Prototyping an API 130 Node.js 134
Choosing a programming language and Python 135
framework 131 Ruby 136
Factors to consider 131 Java 136
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
x Table of Contents

Go 137 Generating server code from a


Rust 138 specification 139
Comparing programming languages 139 Generating server code using Postman 140
Generating server code using OpenAPI
Generator 142

Summary 144

10
API Security 147
What is API security? 148 Authorization 154
Security testing 149 RBAC 154
OAuth scopes 155
Authentication 152
API key management 153 Summary 156
Token management 154

11
API Testing 159
Contract testing 160 Acceptance testing 165
Performance testing 162 Summary 166

12
API Quality Assurance 169
Defining QA 170 Regression testing 174
Test planning and execution 171 API monitoring 176
Behavioral testing 172 Summary 177
Table of Contents xi

Part 4: Releasing an API Product


13
Deploying the API 181
Continuous integration 182 Calendar-based API versioning 186
API versioning 183 Choosing an API gateway 186
Incremental API versioning 184
Summary 188
Semantic API versioning 185

14
Observing API Behavior 191
API usage analytics 192 Aggregating and categorizing feedback 197
Application performance monitoring 193 Acting on feedback 198
Scaling user feedback 199
User feedback 195
Summary 200

15
Distribution Channels 203
What is API distribution? 204 Marketplaces 210
Pricing strategy 205 Documentation 212
API portal 207 Summary 214
Community 208

Part 5: Maintaining an API Product


16
User Support 219
Helping users get their jobs done 220 Prioritizing bugs and feature requests 224
Support channels 221 Summary 227
xii Table of Contents

17
API Versioning 229
Technical requirements 230 Communicating changes 234
Managing multiple API versions 230 Summary 236
Breaking changes 232

18
Planning for API Retirement 239
When should you retire an API? 240 API product retrospective 243
Communicating API retirement 241 Summary 245

Index 247

Other Books You May Enjoy 256


Preface
Building an API Product is a comprehensive guide that ranges from the fundamentals of APIs and
their inner workings to mastering the steps involved in building successful API products. With this
book, you will be able to confidently and effectively create cutting-edge API products that excel in
today’s competitive market.

Who this book is for


This is a book that helps product managers and software developers navigate the world of APIs to
build programmable products. You don’t have to be an experienced professional to learn from this
book, as long as you have a basic knowledge of internet technologies and an understanding of how
users interact with a product.

What this book covers


Chapter 1, What Are APIs?, introduces you to API fundamentals, origins, and types such as REST,
gRPC, AMQP, and MQTT.
Chapter 2, API User Experience, explores how the API user experience is vital, second-degree experience,
and the impact of friction on success.
Chapter 3, API as a Product, outlines an API as a standalone product, emphasizing business value,
monetization options, support, documentation, and crucial security.
Chapter 4, API Life Cycle, provides an overview of the API life cycle stages, covering design, implementation,
release, and maintenance, offering an opinionated approach to API product management.
Chapter 5, Elements of API Product Design, introduces you to the key API product design stages, connecting
ideation, strategy, definition, validation, and specification, paving the way for an in-depth exploration.
Chapter 6, Identifying an API Strategy, analyses the strategy stage of API design, emphasizing identifying
stakeholders, determining business objectives, and understanding user personas and behaviors.
Chapter 7, Defining and Validating an API Design, covers the techniques for defining and validating
API design, starting with strategy-derived information and exploring API mocks, UI integration,
and stakeholder iteration.
xiv Preface

Chapter 8, Specifying an API, guides you on how to select an API architectural type based on behaviors
and capabilities, refining the definition with constraints and industry practices and creating a machine-
readable representation with governance rules.
Chapter 9, Development Techniques, offers a beginner-friendly guide to API development, covering
language and framework selection, code generation from specifications, prototyping, and extending
with business logic,
Chapter 10, API Security, explores API security, emphasizing its importance, distinguishing between
authentication and authorization, and introducing a security testing technique called fuzzing.
Chapter 11, API Testing, introduces you to API testing methods, covering contract testing to ensure
specification compliance, performance testing execution, and the connection of acceptance testing
to user personas.
Chapter 12, API Quality Assurance, covers API quality assurance, introducing behavioral testing to
validate against identified behaviors and setting up API monitors for periodic testing.
Chapter 13, Deploying the API, provides an overview of the API deployment process, covering continuous
integration, agility, automated testing, deployment, and API gateway trade-offs.
Chapter 14, Observing API Behavior, introduces you to API usage analytics, APM, and user feedback
analysis to identify and measure important metrics, usage patterns, and behavior.
Chapter 15, Distribution Channels, covers API distribution strategies, including pricing, API portals,
marketplace listing, and documentation options to enhance user activation.
Chapter 16, User Support, delves into ways to ensure user success with an API, covering support
channels, forums, and prioritizing bug fixes and feature requests from user feedback.
Chapter 17, API Versioning, explores techniques for managing multiple API versions, handling breaking
changes effectively, and communicating changes to users using machine-readable methods.
Chapter 18, Planning API Retirement, discusses API retirement, covering its definition, considerations,
and communication to users and conducting a retrospective to document what you have learned
from the process.

Download the example code files


You can download the example code files for this book from GitHub at https://github.com/
PacktPublishing/Building-an-API-Product. If there’s an update to the code, it will be
updated in the GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://
github.com/PacktPublishing/. Check them out!
Preface xv

Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file
extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Mount
the downloaded WebStorm-10*.dmg disk image file as another disk in your system.”
A block of code is set as follows:

html, body, #map {


height: 100%;
margin: 0;
padding: 0
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items
are set in bold:

[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance,
words in menus or dialog boxes appear in bold. Here is an example: “Select System info from the
Administration panel.”

Tips or important notes


Appear like this.

Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at customercare@
packtpub.com and mention the book title in the subject of your message.
xvi Preface

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you have found a mistake in this book, we would be grateful if you would report this to us. Please
visit www.packtpub.com/support/errata and fill in the form.
Piracy: If you come across any illegal copies of our works in any form on the internet, we would
be grateful if you would provide us with the location address or website name. Please contact us at
[email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you
are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts


Once you’ve read Building an API Product, we’d love to hear your thoughts! Please click here to go
straight to the Amazon review page for this book and share your feedback.
Your review is important to us and the tech community and will help us make sure we’re delivering
excellent quality content.
Preface xvii

Download a free PDF copy of this book


Thanks for purchasing this book!
Do you like to read on the go but are unable to carry your print books everywhere?
Is your eBook purchase not compatible with the device of your choice?
Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.
Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical
books directly into your application.
The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content
in your inbox daily
Follow these simple steps to get the benefits:

1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781837630448

2. Submit your proof of purchase


3. That’s it! We’ll send your free PDF and other benefits to your email directly
Part 1:
The API Product

This part provides a comprehensive guide to API development and management, beginning with
fundamental concepts, types, and origins, followed by a focus on user experience and the significance of the
API as a standalone product. It then delves into the API life cycle stages, covering design, implementation,
release, and maintenance, with an opinionated approach for effective API product management.

In this part, you’ll find the following chapters:

• Chapter 1, What Are APIs?


• Chapter 2, API User Experience
• Chapter 3, API-as-a-Product
• Chapter 4, API Life Cycle
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
1
What Are APIs?
APIs are the most powerful technology available today. While the API acronym can be deceitfully
simple, the concept it describes offers infinite possibilities. Welcome to the world of APIs, where you’ll
learn how to build an API product. Your first step in this expedition is to first learn what an API is.
In this chapter, you will understand the nature of APIs, looking back to their origins. You’ll also get
to know which technologies and tools are available for you to use.
The chapter begins by exploring different types of networks, such as the internet, and how APIs work
on them. You will then be guided through the history of APIs. You’ll see how APIs came to life and
understand how certain concepts in use today were born. Finally, you’ll see that there are different
technologies and tools that you can use to build an API product from scratch.
By the end of this chapter, you will know that APIs can exist on different types of networks. You will
understand what those networks are and what the most appropriate one for your API product is. You
will also know that there are synchronous and asynchronous APIs and what those terms mean. Most
importantly, you will know how to pick the right type of API and tools to build your API.
In this chapter, we’re going to cover the following main topics:

• The different types of APIs


• The history of APIs
• Available technologies and protocols

The different types of APIs


This section gives you an overview of the different types of APIs that exist. APIs are split between
local and remote, and then by the protocols that they adhere to. You’ll start by understanding what
an API is at a high level and why it’s so important. Then, you’ll dive into the different types of APIs.
Let’s get started.
4 What Are APIs?

Application programming interfaces, or APIs, allow applications to be used programmatically. They


create an interface—a layer of abstraction—that opens applications to interactions from the outside.
The interface has the goal of standardizing any connection to the application. Suppose you think
about an interface as a common boundary between two entities. In that case, an API is a way to let
an application communicate with other entities in a programmatic fashion.
This type of interaction is what you can call an integration. Integrating different applications, or different
parts of the same application, lets you build products by putting together pieces that are ready to be
used. Instead of creating all the features of a product from scratch, you can utilize functionality that
is already available in the form of an API. That alone is a powerful tool to use. Creating a product by
using APIs can be done in a fraction of the time it would take if you develop all the features yourself.
That happens because you can reuse pieces of functionality that are standardized and well understood.
Those pieces of functionality can be a whole product, a single feature, or a subset of a product
represented by a selection of features. Different types of APIs provide different types of interactions,
as you’re about to learn.

Local APIs
Local interfaces are the most used type of API, even if they’re often seen as invisible. All the applications
that run on a device need to communicate with the hardware. Applications interact with the device
via local APIs. They offer the advantage of providing a standard method of programming the device
to behave according to what users want. POSIX is one such standard created by the IEEE Computer
Society. It stands for Portable Operating System Interface, and its goal is to establish a layer of
communication that is standard across different operating systems. Another similar standard is
the Single UNIX Specification (SUS). macOS, a popular operating system developed by Apple
Inc., is considered partly compliant with POSIX and fully compliant with the SUS. This means that
anyone that interacts with macOS knows that it follows certain rules and conventions that have been
standardized. In theory, an application that is built to run on macOS could also run on other systems
that are compliant with the same standards.
Another way of introducing a standardized local layer of communication is by using common software
libraries. Even if a system doesn’t follow a full standard, some of its parts can use standardized libraries.
Java offers a popular set of libraries and APIs that can be used across systems. The programming
language was created by Sun Microsystems—acquired by Oracle Corporation—and has been used on
almost all operating systems. Java fully embodies the goal of standardizing how applications interact.
Its slogan is Write once, run anywhere, and it symbolizes the importance that its creators give to
standardized interfaces. Java’s versatility is enormous. You can use Java to create mobile applications
that run on Android devices, desktop applications, and everything in between.
The different types of APIs 5

By now, it’s clear that operating systems’ standards and libraries offer a way of interacting with the
lowest layers of computing devices. Another form of abstraction that encapsulates reusability at a
higher level is available through software modules. Most modern scripting programming languages
have the ability to create and use modules. Modular software development has become a popular
way of building applications. Modules provide functionality that is ready to be used and increase the
speed at which applications are built.
A widespread module system exists for the JavaScript programming language. Its name is npm, the
Node Package Manager. Its authors claim that npm is the world’s largest software registry, with over
one million modules available to be used by anyone. According to GitHub, JavaScript is the number
one used programming language at the time of writing. In fact, JavaScript has been in the first position
for the last eight years at least. Because npm is used by applications written in JavaScript, it’s the most
used module system.
Other module systems exist for different programming languages, and they all share that they want to
facilitate the reuse of functionality and increase the speed of developing software. Python, the second
most popular programming language, has PyPI, the Python Package Index. The third most popular
programming language, Java, also has its package system, Maven. There are all kinds of modules ready
for anyone to use on their applications. The point is that anyone is free to create and publish modules
and also to reuse modules that other people have published. Hence, a vast ecosystem of modular
software development keeps growing.
While local interfaces deal with the interaction between different parts of a local system, some of
those parts let you communicate with the outside world. Communication with remote systems is also
abstracted and standardized in the form of APIs. Read on to learn more about the different remote
APIs and how they can enhance the features of an application.

Remote APIs
Most people think of APIs as a way to interact with software that is running remotely. They tend to
ignore all the local interfaces that you’ve read about before—not because local APIs aren’t important,
but because they feel invisible. The opposite happens with remote APIs. Instead of being invisible,
remote APIs feel like they’re the most critical part of an application. The act of starting a connection
to a system that is running on a different part of a computer network feels like something worth
paying attention to. Remote connectivity can be split according to the type of network being used.
Let’s focus on local area networks (LANs) and wide area networks (WANs) because that’s where
most APIs operate.
LANs connect devices that are physically in the same location. The types of applications that exist on
a LAN are meant to be accessed exclusively by devices that are connected to the same network. APIs
that operate on LANs are typically focused on supporting specific classes of applications and not on
providing generic services to consumers. In other words, LAN APIs offer a way for devices to connect
to applications running on the same network. As with local APIs, here, the goal is to standardize how
the same type of applications communicate on LANs.
6 What Are APIs?

Databases are one type of application that is widely used in local networks. The ODBC standard was
created to standardize communication between applications and databases. ODBC stands for Open
Database Connectivity and is a standard API for accessing databases. Applications that use ODBC
can be ported across different database systems without having to be rewritten. You can, for instance,
develop a warehouse stock application that uses the MySQL database system. Suppose that, at some
point, you decide to switch to Oracle or some other database system. You don’t have to rewrite your
application as long as the database system supports ODBC. In the same way, if you decide to change
the implementation of your application to a different programming language, you don’t have to change
the database system. As long as the programming language supports ODBC, you know that you’ll be
able to interact with your database.
Printing is another popular activity on local networks. As you would expect, there are APIs that
standardize the communication between printers and other devices in the same LAN. One such API is
the Line Printer Remote protocol, or LPR. This protocol lets you interact with a printer, programming
it to print documents and even changing the configuration options of the target printer. Even though
printing happens primarily in LANs, it’s a type of application that can also be carried out across the
internet. To make communication with printers work easily outside LANs, there is a remote API
called Internet Printing Protocol, or IPP. According to Michael Sweet from Apple Inc., “at least
98% of all printers sold since 2010 support IPP." It became so popular because it offers features such
as authentication, access control, and encryption of data transmitted to the printer. And it’s not the
only API that operates on the internet, as you’ll see if you keep reading.
When you hear the term API, you immediately think about services that run on the internet. That’s
because wide access to networked services helped popularize the creation of APIs. Externalizing
features of an application feels natural in an environment where all services are connected to the
same network. Many times, you can even confuse internet APIs with the services that they expose. We
often talk about the API as the offering rather than the interface. That indicates that the internet has
contributed to the fragmentation of the types of APIs that are available. There are API types that are
best suited for reading data while other types are better used for synchronously storing information,
and there are types that work well to asynchronously share information about events.
Let’s start by exploring API types that let you easily read data from a remote server on the internet.
You can say that the simplest way to read data remotely is to directly access a document. However, you
would only call that an API if there were some degree of programmability involved. In other words,
when you’re directly retrieving a document, you’re not sending any parameters to an API. To make
it programmable, there has to be something on the server that interprets the request parameters and
changes the returned output based on what is being requested. A remote procedure call, or RPC, is
an example of a type of API that lets the requester send parameters to a server and, in return, receive
information. In the same way that you can read information with it, you can also use it to store
information on a server. In that case, you’re sending parameters along with the information that you
want to store. Depending on the size of the data—what you call an API payload—you can choose
what type of API and which technology to use.
Random documents with unrelated
content Scribd suggests to you:
with them he set out on his search. It had been told Alexander that
in the land there were many wells, and that none could tell one from
another, till they came to the right one, so that he had prepared a
way to find them out. Now the first well they should come to was
the Well of Life, and Alexander bade all his men take in hand a salt
fish, and wash it in every well they came to, till they should see
some strange thing, when they were to tell it to him. It must be said
that they of the host knew not what Alexander was seeking, nor
what was the reason of this washing of salt fish. So the men went
from one well to another, laughing and joking, and washing their salt
fish, till one of them, Andreas by name, dipped his fish into a certain
well, and suddenly the fish came to life in his hand and slipped out
into the well. Then he cried out with a loud voice, and all the men
near came running up to him, but he could say or do nothing but
point to the fish swimming about in the spring. So they fetched
Alexander to the spring, and he gave orders to fill a cask with the
water of it, but the old man said that the water was useless except it
were drunk when it was drawn from the spring.
Then he came to the Well of Youth, and it was in a dry land where
no man dwelt, for there was no river or tree near. And Alexander
would fain have the old man bathe in that well, but he would not,
for he said that it was good to be young once, and to be foolish
once, but to be young twice would be to be always a fool, and old
age was best when a man was tired of life. So the young men
bathed in the spring and their hearts grew hopeful, and they
rejoiced in their youth.
There remained the Well of Never-dying Men to be sought for, but
the old man told them that this was not here, nor was there any way
to it from that place, for they must seek it in the dark desert. On this
Alexander asked him of that desert, and he said that there the land
was dark day and night, the sun shone not there, and there was no
track or path for men to travel by. “Yet,” said the old man “it will be
easy for thee to enter into the land and to find the well, for thy
stone Elmas will guide thee to it when thou art in the land.” And with
these words the old man turned away, and when Alexander looked
for him, behold, he was not with them. Then Alexander and his men
returned to the army.
CHAPTER XV. HOW THE BRAHMANS CAME TO KING
ALEXANDER AND WHAT HE LEARNT FROM THEM:
AND OF THE COMING OF THE AMAZONS.
Now the tale tells that by this time the army was encamped near
the great river of India, the river Ganges. The river was very broad
so that men could just see across it from one bank to another, and it
was full of all manner of living beasts, crocodiles, scorpions, and
snakes, so that men dare not swim in it nor drive in their horses. It
happened on a day, that three men came to the other side of the
river, and stood there, so that the guards came to Alexander and
told him of it, and he came to the bank over against them. Then the
king bade one of his nobles ask them who they were, whence they
came, and what was their wish; and they answered, “We be
Brahmans, that never thought or did harm, and we bear a message
from our lord Dindimus to the lord of this army, Sir Alexander of
Greece.” And when he heard this the king ordered a carpenter to
make a boat to pass the river, and as soon as it was ready, he sent a
knight over the river with a message inviting them to come: so they
crossed the river and stood before him. Now they were very old
men.
Then Alexander spoke to these Brahmans of one thing and
another, and found that they lived in another manner than the
Greeks; for what he esteemed rich and noble and good, they set
little or no store by, and what they admired he thought mean and
poor. But since he was a wise king, and one who desired to learn the
secrets of things, he sent a letter to the chief of the Brahmans
asking him to describe what their nation did, “for,” said he, “you
differ from us very greatly, it cannot harm you to tell us about
yourselves, and we may learn from your example. A candle when it
is alight can light many others without burning less brightly.” And
with this letter of Alexander’s the Brahmans went away to their lord,
and in due time they returned bearing an answer.
The tale tells in full of these letters, though it likes me not to write
them here at length, but the answer of Dindimus astonished the
Greeks. He told them that the Brahmans were a lowly folk, who
neither ploughed nor reaped, fished nor hunted, who lived on the
fruits of the earth, and who drank water, who fought not and lied
not, who studied not, nor wore fine clothing, who loved the sun and
the sea, the woods and the song of birds, and who cared neither for
iron nor for gold. Then he went on to reprove them for their worship
of evil gods, for their pride, cruelty, and avarice. However, Alexander
answered him fairly, but only drew on himself a worse reproof. Then
Alexander seized eight of the chief Brahmans, and put to each of
them a question, saying that the one who answered worst should be
put to death first.
So the first of them was brought before him, and he said to him,
“This is thy question: Why have you no graves in which to bury your
dead?” The old man said, “We are buried in the cave in the hillside
where we pass our days, that we may know that our present life is
but a training for the future.” Then came the second, and the king
asked him, “Which are more in number, the dead or the living?”
“Those that are dead are more in number than the living, thou
thyself knowest how many men thou hast slain,” said the old man.
Then came the third and Alexander said, “What is the most wicked
thing in creation?” “Man is the most wicked thing, and thou thyself
art one of the worst of men, for many men hast thou slain, and few
hast thou saved from death.” “Is night older than day, or day older
than night?” was the next question of the king, and the Brahman
answered him that night was older than day. Then he asked the
others these questions, and to each of them the wise men gave him
a good answer. “How do you live, and now do you die?” “Is death
mightier than life?” “Who is it that has never been born?” “Which is
man’s strongest limb, his right hand or his left?”
At the last the lord of Macedon forgave their bold speech and let
them go; but, before they went, Alexander asked them, as his
custom was, what were the wonders of their land?
Then the eldest of the Brahmans told him of a wonderful well in
the land, that few men dare drink of, for he that was miserly or
unfaithful to his trust and drank of it, went mad on the spot. But
Alexander did not fear this, for no man had ever thought him
miserly, for when he had shared the spoil at Macedon, he left for
himself only hope and glory. Then the king asked to be led to that
place, and he went with few of his knights without fear, for the
Brahmans were an unarmed folk. Now, as he went on his way with
the Brahman, he came into a certain town of the land, and saw two
men pleading before the Judge, and he drew near to listen to them.
The first of them stood up before the Judge, and said, “Sir, in time
past I bought a house from this man, and dwelt in it; now, long
after, I have found in it a treasure hid under the earth of the garden,
which is not mine. Accordingly I offered to deliver the treasure to
him, and carried it to his house, but he has refused it and will not
take it. Wherefore, sir, I beseech you that he be compelled to take
this treasure, since he knows full well that it is not mine, for I have
no right to it.” Then Alexander said to the Brahman, “Surely this man
is foolish, for he might keep this treasure to himself.” But the Judge
turned to the other man, and bade him answer what was said
against him. So he stood up and said, “Sir Judge, that same treasure
was never mine, but he has digged in a place that no other man
who had the house has digged, and hath made that his own which
before had no master. And, therefore, I have no right to take it.”
Then Alexander said to the Brahman, “Surely this man may take it,
for the land was his, and the other man wishes him to take it.”
As he spoke, the two men talked together for a moment, and then
they turned toward the Judge, and begged him to take the treasure
himself, for they would have none of it. Then the Judge answered,
and said, “Since ye say that ye have no right thereto, so that neither
he to whom the heritage belonged in time past, nor he to whom it
now belongs may have it, how should I have any right thereto, that
am but a stranger in the matter, and never before heard a word
spoken of it. Would you escape the burden that falls on you, and
give me the charge of the treasure; that were evil done of you.” And,
after awhile, he took them and asked of him that had found the
treasure whether they had any children or no: so one of them
answered that he had a young son. Then he asked the other if he
had a daughter, and he said that he had. When he heard that, the
Judge was glad, and he ordered them to make a marriage between
the two, and that they should give them the treasure between them
as a marriage portion. And when Alexander heard this judgment, he
had great marvel thereof, and said thus to the Judge: “I trow there
is not in all the world so righteous a judge as thou art.” Then the
Judge looked on him with wonder, for he knew that he was an
outlander by his speech, though he wist not that he was Alexander,
and he asked him whether any Judge in his own country would have
done otherwise. “Yea, certainly,” said Alexander, “in many lands
would they have judged otherwise.” Then the Judge had great
marvel thereat, and he asked the king whether it rained, and if the
sun shone in that land; as if he would give him to understand that it
was strange that the gods should send any light, or rain, or other
good things to them that do not right and true judgment. But
Alexander had greater marvel than before, and he said there were
but few such nations upon earth as the people of this land.
Then king Alexander went with the old Brahman in search of the
well, and at the last they came to the place where the well was, and
it was a great square tank, built down into the ground with blocks of
stone, the sides covered with green moss, and the steps damp and
slippery, the water at the bottom dark and clear, but the Brahman
put forth his hand and said to the King, “O foolish of heart, bathe
not in this well, for thou art both miser and unfaithful. Miser art thou
for thy words about him who found the treasure: unfaithful in that
thy heart judged not as the Judge of the land did.” And Alexander
turned away in silence, for his heart judged him, and he dared not
enter the well, so he returned to his army.
And as Alexander went out of that land he passed through a city,
in the which all the houses of the city were of one height, neither
was any house greater in show than another. Now before the door of
every house was a great pit dug, and this pit was always open. Then
Alexander asked for the lord or judge of that city, and they told him
that there was in their city no judge or lord. And the king wondered
greatly how such a thing should be, that a city could remain without
a head or a judge; and he asked of the inhabitants thereof whereto
such things should serve. So the dwellers in that place answered him
and said: “O king, whereas thou dost wonder that we have no lord
over us to do justice among us, know thou that we have learnt to do
justice ourselves, wherefore we need no man over us to do it for us.”
Then said he to the men of the city: “Why do ye make these pits
before the doors of your houses?” And they answered him: “Know, O
Alexander, that these pits are our graves, which every man makes
before his door to be his own house, to which each of us must go,
and there dwell until his deeds are judged.” And Alexander asked
them yet another question: “Why are your houses built of one
height?” and they answered him: “O King, love and justice cannot be
even among all the people of a place if some of them are greater
than others, and no house nor family shall be greater than other in
this our town.” Then Alexander departed from them, wondering, but
well pleased.
The tale tells that before Alexander fought against Porus he sent
messengers to all lands in Asia, and among the rest to the land of
the Amazons. It is said of that land that only women live in it, and it
is governed by women, and whatever man comes into it he is
straightway slain; for the first founders of that land were the wives
of the men that were called Goths, the which men were cruelly slain,
and then their wives took their husbands’ armour and weapons, and
fell on their enemies with manly hearts, and took revenge of the
death of their husbands. For by dint of sword they slew all men,
both old men and children, and saved the females, and parted out
the prey, and purposed to live ever after without company of men.
And by the example of their husbands they had ever two queens
among them, one to lead the host and fight against enemies, the
other to govern and rule the kindreds. In short time they became
such fierce warriors that they had a great part of Asia under their
lordship nigh a hundred years; and among them they suffered no
man to live or abide, but of the nations that were nigh to them they
chose husbands, and they nourished their children till they were
seven years old, and then their sons they sent to their fathers, but
they saved their daughters and taught them to shoot and to hunt. It
is told that the great Hercules was the first who daunted their
fierceness, and that was more by friendship than by strength.
Now came messengers from Calistris, queen of the Amazons, to
Alexander, bearing letters from her in answer to his demand of
tribute, for she had heard how Alexander had followed in the
footsteps of Hercules, and had gone into India, and the letters told
of her land and its customs, and of the number of warriors she had,
and she went on: “I wonder at thy wit, that thou purposest to fight
with women, for if fortune be on our side, and if it hap that thou be
overcome, then art thou shamed for evermore, when thou art
overcome of women; and if our gods be wroth with us, and thou
overcomest us, it shall be little honour to thee that thou hast
overcome a band of women.” And when Alexander looked over the
letter he laughed, and wondered on her answer, and said that it was
not seemly to overcome women with sword and anger, but rather
with love and noble dealing: and therefore he sent messengers to
them offering friendship and a treaty. Then the queen of the
Amazons came with many of her maidens, and they reached
Alexander when he returned from the land of the Brahmans, and
abode with him many months, and at the last they departed from
him and went to their own land, being subject to his empire, not by
violence, but by friendship and by love.
And after these things Alexander reared up a pillar of marble, and
upon it he wrote in the tongue of the Greeks and of the Indians.
Now the inscription in Greek characters was but this:—
Α Β Γ Δ Ε
the first five letters of the alphabet, and they stood for the same
words as those in the Indian inscription:
ΑΛΕΞΑΝΔΡΟΣ ΒΑΣΙΛΕΥΣ ΓΕΝΟΣ ΔΙΟΣ ΕΚΤΙΣΕ
“King Alexander the God-born built this:” and he graved it deep on
the sides of the pillar.
CHAPTER XVI. HOW ALEXANDER PASSED THROUGH
THE LAND OF DARKNESS AND SLEW THE BASILISK.
Few days after Alexander and his army entered into a plain full of
fair flowers and trees. Now the trees of this land were fruitful and
bore all manner of food for man, and amongst them were apples
and almonds, vines and pomegranates, and plums and damsons;
and it was in this land that the Greeks first ate of damsons, for they
did eat of them three days while they were in the forest. But as they
went through the wood, they came upon giants twice as high as
other men, clad in coats of skin, and covered with long hair. So the
Greeks and the Indians were sore afraid lest these giants should fall
upon them and slay them, while the giants called one to another,
and came together through the trees to gaze on them, for they had
never seen men before. When the Greeks saw that these giants
were calling to one another and coming together, they drew up in
line of battle, and the knights clad in armour mounted their battle
horses, and the archers and spearmen prepared their weapons for
the onset: for the Greeks had never heard of giants who did no
harm to men. But these giants were great stupid oafs who stood
gazing with open mouths at Alexander and his men preparing to slay
them, and their food was grapes and pomegranates. And when the
army was drawn up in line, and all men were ready, Alexander gave
the word and they raised a loud shout so that the woods rang again,
and the giants turned and fled, for they had never heard sound of
man or of trumpet. Then the knights followed them and slew some
six hundred of them in the field and in the chase, so that none of
them were left in the land round about.
The tale tells that Alexander passed on with his army, still seeking
the wonders of the land and finding no man in this part of it, till he
came to another river where he halted for many days. And there
came men of the land to him, and Alexander asked them of the
wonders of the land, so they told him of certain trees near by which
grew with the sun, and when it was high they were great, and as
the sun fell below the earth so the trees grew smaller and sank
down into the soil. But when the king would set out to see this
marvel, they told him that no man could go near it for there was a
wild man who guarded the wood and suffered no one to pass. Then
Alexander sought counsel of his wise men, and they bade him take a
fair white maiden such as the wild man had never seen and hold her
before him, and so they did, and the wild man became quiet and still
at the sight of her, so the Greeks crept up to him and bound him in
great chains, and brought him before the King’s tent: now this wild
man was covered with hair stout and strong, and his arms were
great, and his strength was as that of ten men. And when the King
had gazed on him they bound him to a tree, and slew him, and
burnt him to ashes, for he had slain much folk of that country.
Next day the King and his company came to the place of the
trees, and they wondered at the sight, how they grew as the day
grew, and the height of them was a spear’s length, and on them
were fruits like to apples, and men called them the trees of the sun.
Now the tent of the King was over against the place where the trees
grew, and in the hot sunlight he felt thirst, so he bade one of his
carles fetch him an apple, and the man sprang forth to do his
bidding, but when he laid his hand on the fruit he fell to the ground
as if he was slain. There were birds on those trees among the
branches and some men wished to put their hands on them, for they
did not fly away from them, but as they did so, flames of fire came
out from the trees; and the men of the country told them that no
man could touch these trees and live. Then Alexander asked them of
the Land of Darkness, for the stone Elmas shone brightly, and he
knew that he was drawing near that land: but they said that no man
went to that land, for the way was through a desert that none could
cross.
Then Alexander chose him out of all his army three hundred
young men, able to endure hardship, and they made them ready to
go with him to the Land of Darkness, while the army was left in the
hand of King Porus; and he gave orders that the young men should
carry with them stores of food and water to pass through the desert
to the land they sought. Now there was a certain old man in the
army named Bushi, who had two sons chosen to go with the King,
and he bade them to take him with them to the Land of Darkness,
but they said to him that the King had straightly commanded that no
old man should go with them. Then said the old man, “O Sons,
make strong a box, and put me inside it, and set the box on a mule
and carry it with the baggage, and it shall be for your good, for a
party without old men to advise can come to no good.” So his sons
did as he bade them, and closed him in a box, and set him on a
mule’s back, and carried him with them to the land. And as
Alexander went on his way they met men of the land, journeying in
the desert, and these told them of the Well of Life, and how a man
had drunk of that well, but he could not find his way out of the Land
of Darkness, and ever he wandered to and fro, up and down, till at
last he gave up the search, and dwelt in a tower alone, and as the
years rolled on he grew smaller and smaller, and more and more
cruel, and when men came into that land, he slew them and fed on
their flesh.
Now when Alexander drew near the Land he came to a desert
land, where was neither well nor living thing, and they hastened
through it for five days, but on the morrow of the sixth day the sun
rose not, and there was no light of day: and so the king knew that
he had come on the Land of Darkness, but the tales that he had
heard came to his mind, and he feared, for he had no mind to
wander through that land without a guide. Then he went back with
his men for half a day’s journey, and lo! the light of the evening, so
he camped in that place and waited for morning light. On the
morrow he took counsel with his men, as to the way of return, and
he offered great reward to any man who should show the way of a
safe journey back, but his young men said, “O King, it is ours to go
where thou dost order us, and what thou biddest, that will we do:”
and he found no counsel in them. Then the two sons told their
father how the King had stopped and asked for counsel, and Bushi
bade them bring him before Alexander, and when they feared he
bade them be bold, for he had good counsel to give.
The tale tells that the King was sitting sorrowful in his tent that
day, for he dared not enter the Land without some means of safe
return, and he was unwilling to go back to the army without having
reached his object; and when the guards entered and told that an
old man sought speech of him, he thought that one of the gods
must have come to his help. So he made him to sit in his own seat,
for the man was very old and feeble, and asked him what he would.
Then Bushi answered and said, “O King, hear the words of an old
man; there is no love like the love of a mother for her young. Now
thou hast here with thee, many asses with their foals. This is my
word to thee. Leave here on the borders of the Land, half thy men
with their baggage trains, and leave with them the young foals, and
go thou with their mothers and the rest of thy men into the Land,
and do thy heart’s desire: then when thou wilt return from this Land,
loosen the mothers and leave them free, and take them for thy
guides, and they will lead thee back to the place where their young
ones be.”
Then Alexander the King praised him greatly, and gave rich reward
to the young men, his sons, and he offered to take the old man to
the Well of Life, but he would not, for he said, “How should I desire
to live for ever, being such a man as I am, for the bitterness of death
is past to me.” Then he gave counsel to the King that no man should
bathe in any well in the land, till he had seen it, for if he did the well
would disappear for a year. So Alexander did as the old man Bushi
advised him, for he divided his men into two bands, and one he left
on the borders of the Land of Darkness, with their baggage and with
the young foals, and one he took with him, and the men he took
with him he straightly charged to come to him when they found the
well, and on no account to bathe in it. So he entered the Land, and
the stone Elmas shone with a light like a star, and guided them on
the road for three days. But on the fourth day it grew duller, and
Alexander knew that he had passed the place of the Well of Life; and
he ordered his men to search for the well in all directions, but not to
go out of sound of the trumpets which rang out every hour, and to
come into the camp when it sounded. Seven times did the trumpet
sound, and the scouts came in, but on the seventh time, one of
them, Philotus by name, came in with his hair wet, and Alexander
knew that he had disobeyed the word of the king, and had bathed in
the well. Then said he to him, “O Philotus, canst thou lead me to the
well thou hast bathed in,” and the man answered, “Yea, Lord;” and
they set out together, but no well could be found. Then the wrath of
the King burst out, for he knew that he should see the Well no more
for a year if he remained in that place, and that all the labour of his
expedition was spent for nought but to make this Indian immortal,
and he bade men bring great stones, and build them in a pillar
round the Indian and close it at the top, and they did so, and he was
left alive inside the pillar, for indeed the Greeks could not slay him.
This done, Alexander put the reins on the necks of his asses, and
they turned and led the way to their young, and in three days he
was out of the Land of Darkness and on his way to the army.
In few days the King set out again with his host and went on his
way towards the mountain lands, and ever the way led upward till
after eleven days’ journey they came to a great plain among the
mountains, covered with trees and plants, and well watered by noble
rivers. The fruits were of the finest savour, and the water was
sweeter than milk or mead, and clearer than crystal. So they went
on through the land for many days, but they found no man in it, and
no houses or temples of the gods; until they came to a high
mountain which seemed to reach even to the clouds, and no way
was there of crossing it, it was so steep and rugged. But when they
came up to this range they found two passes which led through the
range, and where they met was a great temple, and the one path
led to the East, the way of the sun-rising, and the other to the
North. Now there was no man to tell them where these paths led, or
what was to be met in them. Then Alexander thought within himself
that he would go to the East, for the Gods had predicted that in the
East he should learn when and where was the end of his days, and
the army of the King went through the pass for seven days.
But on the eighth day, a sudden death fell on many of the men in
the host, for when they came to a certain spot or place among the
mountains, ever one or another noble knight would fall down
suddenly and lie dead on the road, nor did all men who passed the
place die, but some only. Then fear came upon all men, and those
who had passed the place dared not move either forward or
backward, and those who had not passed it would not go forward,
nor indeed did the King command them, for all men said, “The wrath
of the gods is upon us for coming into this land.” So Alexander
sought to find the reason for this death, and he went with one of his
knights up the mountains at the side of the pass, till he came to a
place whence he could see the whole of the pass and the mountains
behind it, and looking down into the valley he saw in one of the
clefts of the hills a loathly serpent, old and wrinkled, his thin long
neck and great head lying on the ground before it. And while the
King looked down, the ungainly worm slowly raised its heavy head
and looked down on the valley, and let it fall again, and a cry of grief
from his men told him that two more of his knights had fallen dead
on the pass, and Alexander knew that his eyes saw the Basilisk.
The tale tells that this beast is the most deadly of all serpents, for
its venom is such that whatsoever living thing it looks on it slays,
yea, the very grass is withered by its deadly breath. And no man
may slay it unawares easily, for once a man slew one with a lance,
and the venom of it was such that he died from it, though he came
no nearer the body than a spear’s length. This the king knew and he
sought not to slay it with a weapon, but he worked so that the worm
should kill itself; for he caused his men to make a shield larger than
a man, and on this shield he bade put a bright polished mirror, and
he wrapped his feet in linen, and put off his armour, and going softly
he bore the shield with its mirror before him, and set it down before
the den of the basilisk, and went his way. But the basilisk raised its
head as its manner was, and looked before it, and saw its face in the
mirror, and the poison of its own look killed it, so it fell dead with its
eyes wide open, and lay along the path. Then the knight who was
on the mountain watching blew his horn, and all men heard it and
rejoiced and praised the brave king who had delivered them from
the basilisk.
All this while the march of the host had lain between mountains,
and when men climbed to the top they saw nothing but other
mountains stretching away as far as they could see, no towns, no
villages, no living things, and on the day after the basilisk was slain,
the road suddenly stopped among the mountains, and the host
could go no further. Then Alexander the King bade them turn back
to the parting of the ways, and as they passed the place where the
basilisk had been he bade them burn it in asbestos cloth, and take
its ashes, for the ashes of the basilisk are a precious thing, able to
turn lead into pure gold, but the men found it not, though the great
mirror was still there. And at the last they came to the temple at the
parting of the ways, and the army lay round the temple for a day to
rest, for they were sore wearied with the passage through the
Eastward way. The next day at sunrise two aged men came out of
the temple, and Alexander spoke with them and they told him of the
ways, how that Bacchus, one of the gods, had made this road when
he came into India and conquered it, and how he had caused the
mountains to come together and block it up, so that no man should
pass through by it after. Then Alexander asked them of the
Northward way, and they told him how it led to the Trees of the Sun
and Moon: and they told of the wonders of the trees, and how they
spoke with men’s tongues, and told what should be in time to come,
and Alexander the King rejoiced.
CHAPTER XVII. HOW ALEXANDER CAME TO THE
TREES OF THE SUN AND THE MOON, AND WHAT
THEY TOLD HIM.
Howbeit Alexander made no sign to them of his joy, for he seemed
not to believe the old men, and he said: “Have I spread the might of
my name from the East even unto the West to no end but to
become a sport to old men and dotards.” Then the old men made
oath by the gods that this thing was true, and they told the King
how that these trees spoke both in the Greek and the Indian
language; and Alexander asked them of the way to this marvel, and
the men answered: “O King, whosoever thou art, no greater marvel
shalt thou see than this we tell thee of. The way to it is a journey of
ten days, nor can your army pass because of the narrow paths, and
the want of water, but at the most four thousand men with their
beasts of burden and their food.” Then all the friends of the King and
his companions besought him to go and see this great thing, and he
made as if he hearkened to their prayers, and consented to go with
them. So he left the army with its baggage and the elephants in the
hands of King Porus his friend, and set out on the Northward Way to
seek the trees which spoke to men.
Now the Northward Way was like the Eastward one, a narrow road
among high mountains, and little ease was there in going through it,
and for three days they came to no water, but at noon on the fourth
day they came to a spring which flowed out of a cave on the hillside.
Then the Indians told Alexander that this cave was sacred to
Bacchus, so he entered it and offered up a sacrifice to the god, and
prayed him that he might return safe to Macedon, lord of the world,
but he got no sign from the god that his prayer was heard. Then on
the morrow he set out, and on the tenth day at even they came to
the foot of a great cliff, shining in the setting sun from thousands of
brilliant points like diamonds, and from chains of red gold leading
from step to step up the face of the rock, high up beyond the ken of
men. And as the sun shone on it the steps seemed carved from
sapphires and rubies, so deep were the blue and red of their colour.
Then Alexander the king set up altars to the gods of heaven, and
offered sacrifices to each one of them, and he and his men lay that
night at the foot of the cliff.
Early in the morning he arose, and when he had called to him his
twelve tried princes, he began to ascend the steps on the side of the
mountain, and as he went up it seemed to him that he was going
into the clouds, and when he looked down, the path by which he
had come seemed as a silver ribbon among the hills, and the men of
his host seemed smaller than bees, and nothing that might happen
seemed strange to him, for his joy and lightness of heart. So on and
on they went and at length they came to the last of the steps, two
thousand five hundred of them, and they found that on the top of
the cliff was a wide plain, and in the distance they saw a fair palace
set in a garden, and a noble minster shining in the sun like gold. All
the plain was full of rich and noble trees bearing precious balm and
spices, and many fruits grew on their branches, and the inhabitants
of the plain fed on them, for there were many men on the plain, and
all men and women were clothed in the skins of panthers or of tigers
sewn together, and they spoke in the Indian tongue. As the Greeks
drew near the palace they saw it, what a fair home it was, and how
it had two broad doors to its hall, and seventy windows of diverse
shape, and when they came to the doors they found them covered
with beaten gold, and set with fair stones.
But the doors of the palace opened and shut, and there stood
before them a negro, ten feet high, with great teeth showing over
his lips, his ears pierced and a great pearl in each, and clothed in
skins. And when he had saluted them he asked them why they had
come to that land, and they said that they wished to see the trees
that spoke, and to hear something from them. Then the negro bade
them to take three of them, and to put off their shoes, and their
weapons and ornaments, and to clothe themselves in fair white
linen, and Alexander and two of his companions did so, and the
negro brought them within the palace, leaving the rest of their
companions outside. And as they went in they marked the fair
garden, and in it were golden vines bearing on them grapes of
rubies and carbuncles, and they saw how precious a place it was, so
that Paradise alone excelled it.
Now when they were come to the inner door of the hall, the negro
bowed himself down before them, and opened the door before
them, but went not in himself, for that room was the chief of the
palace, and when they lifted up their heads they saw before them a
couch and on it was a man. Now the hangings of the couch were of
golden brocade, and its coverlet was blue, embroidered with shining
ones in bright gold, and the bedhead was embroidered with
cherubim with glancing wings, and the canopy with the bright
seraphim. The curtains were of silk and on them was a fair garden of
needlework, and in it were beasts and birds, and the pillars were of
the same, and all the points and ornaments were of pearl. The
romance tells that he who rested in that room was one of the
noblest-looking men that ever had life, with a face bright and bold as
fire, his hair was long and grey, and his beard was as white as the
driven snow. When the King and his peers saw him they knew that
he must be of the blood of the gods and not of mankind, and they
knelt down on the ground before him, and saluted him with all
reverence. Then he reached out his arms to them, and raised him on
the bed, and answered them: “Hail, Alexander,” said he, “All hail,
thou who wieldest the earth, thou and thy princes are welcome. Sir,
thou shalt see with thy sight such marvels as never before man saw;
and thou shalt hear of what shall come, things that no man hath
heard but thee.” Then was the King astonished that his name was
known, and he said, “Oh, holy happy man, how dost thou name my
name, since thou hast never seen me before?” And the god
answered: “Yea, I knew thee ere a word of thy fame had spread
over the earth.” Then he went on: “Wish ye to look upon the trees
that bloom for ever, the trees of the sun and of the moon, that can
speak and tell thee of what is to be?” And Alexander the king said,
“Yes by my crown, this would I do more than anything else in the
world.” Then the god said, “Art thou clean of body and mind, thou
and thy friends; for no man may enter the place where they are who
is not pure of all stain?” and Alexander answered that they were. So
the Elder arose from his bed, and cast on him a mantle of gold, and
the ground glittered for the glory of his weeds, and he led them to
the door, and there stood there two elders like to those Alexander
had seen at the Parting of the Ways, and he gave them into their
hands, and bade them lead them to the place where they would be.
Then he turned and departed, and Alexander and his friends
Ptolemy and Antiochus went with the elders.
As they went the elders asked them if they had any metal or rich
thing with them, and bade them cast it off, and one of the elders
stayed at the door of the minster while the other led them through
it, and after that the three Greek lords passed through a wondrous
thick wood, full of most precious trees, olives and sycamores,
cypresses and cedars, with balm and myrrh trickling down the trunk
and all manner of incense and aromatic spices. In this wood they
came upon a little round clear space, and when they looked they
saw a great tree whereon was neither fruit nor leaves, bark nor bast,
and it was one hundred feet high. And on it they saw a bird resting
on one Of its branches, and the bird was of the size of a peacock,
with a crest such as the peacock has, and its cheeks and jaws were
red like a fowl, and its breast was of golden feathers, and its back
and tail of blue speckled with crimson, and its body of gold and red
speckled with grey. Then Alexander the king stayed and considered
this bird and wondered at it, and the guide answered his thought:
“Why dost thou wait and wonder, yon is the Phœnix, the bird that
lives a hundred years, and has no mate:” and he turned them a little
way and they saw a spot where two trees grew side by side, the
trees of the Sun and the Moon. “Behold now,” quoth the guide,
“these holy trees; form in thy mind the question thou wouldst ask of
them, but say it not in words that can be heard; and thou shalt have
an answer in plain words, such as no other oracle gives. And this
shall be a sign to thee that the gods are good to thee, since they
read thy thoughts and need not words to tell them thy question.”
The tale tells us that these trees were not like others, but their
boles and leaves shone like metal, and the tree of the sun was like
gold, and the tree of the moon was like silver, and the tree of the
sun was the male, and that of the moon the female. Then Alexander
asked his guide: “In what way will the trees answer me?” and the
Elder answered him: “Truly, O King, the Sun-tree begins to speak in
the Indian tongue, and ends in Greek; but the Moon-tree, since it is
female, speaks in a contrary manner, for it begins in Greek and
finishes in Indian, and thus in two tongues each tells us its mission
of fate.” Then he wished to offer sacrifices before the trees to
honour them as gods, but the Elder forbade him, for he said that no
living thing was to be injured in this place, and no fire must be
brought there, but that the only sacrifices offered to the trees were
kisses on the tree-boles. And when he heard this Alexander the King
knelt down on the ground and kissed the boles of the trees one after
the other, and asked within himself whether he should return to
Macedon, where his mother dwelt, having conquered all the earth.
Now, when he had asked this question in his mind, and he and his
fellows were kneeling on the ground before the tree, suddenly it
began to move, and the leaves began to quiver, though all was still
and calm in the forest, and there was a sound of going in the tree-
tops, and a sighing as if the wind was rustling through the leaves,
and the sighing and moaning of the leaves grew louder, and with a
swaying sough this answer came to the King: “O Alexander,
unbeaten in war thou art, and shalt be lord of all the world, yet
never shalt thou see the soil of thy sires, or return to thy dear land
of Macedon; thou shalt see thy mother and thy land no more.” When
they heard these things the companions of Alexander fell down to
the ground as if dead, so great was their grief, and they heard no
more of what was said; but Alexander knelt down before the Moon-
tree to ask of it a question. Then the Elder came to him and said: “O
King, the tree of the Moon answers not till the night has come, and
the moon is full in the sky.” So the King turned to his companions,
and comforted them with his kind words and gifts, and bade them
be of good cheer.
When the night was come Alexander rose up again to go before
the Moon-tree, and to hear its oracles, and his companions told him
of the danger of being unarmed and alone by night, but Alexander
feared not, for it was not lawful to slay any one in that forest,
neither was there any man in it save the guide and themselves. And
having adored the tree and kissed it, he knelt down before it, and
thought to ask when and where should be his end. Then at the
moment when the rays of the moon made the leaves shine with
splendour, he heard a voice from the tree: “Alexander, the end of thy
life draws near; this year shall be thine, but in the ninth month of
the next thou shalt die at Babylon, deceived by him in whom you
fully trust.” Then he was filled with grief and he looked at his friends,
and he knew that they were ready to die for him if need be, and he
thought of the other companions in whom he trusted, and that if he
slew them he might save himself, and then he thought of the
endless suspicion and sorrow he would live in for the rest of his
days, and he remembered the words of the god when he told him
that it was not good for men to know the end of their days, and he
strengthened his heart and comforted his friends, and he bade them
swear never to reveal the things they had heard, and again they
returned to the minster, and found tents thereby where they might
rest, and beds of skins, and on an ivory table there was food and
drink set for them, fruit and bread, and water from the stream. So
they slept and rested.
Then in the morning the Elder woke him from sleep, and led him
before the bare tree, and bade him ask of it what he would, and he
knelt before it and kissed it, and asked in his mind, “Who is it that
shall harm my mother or sisters or myself?” Then he had this
answer from the tree: “O mighty lord, if I should tell thee the man
who should betray thee it were easy for thee to slay him and to
overcome thy fate, and the oracles would be made of none effect.
Therefore thou shalt die at Babylon, not by iron, as thou deemest,
nor by gold, silver, nor by any vile metal, but by poison. Thy mother
shall die by the vilest death, and shall lie unburied in the common
way, to be eaten by birds and dogs. Thy sisters shall live long and
happy lives. Short as thy life shall be, thou shalt be lord of all lands.
Now ask no more, but return to thy army and to Porus thy friend.”
And the Elder came up to him and said: “Let us depart with speed,
for the weeping and moaning of thy companions have offended the
holy ones of the trees,” and Alexander and his companions departed
from the forest. Then he asked the Elder who was the god of the
palace, and he told the King it was Bacchus, who had sent him to
the temple at the Parting of the Ways, and who had welcomed him
in the palace. So Alexander came to his peers, and with them went
down the golden stairway and joined the host, and hurried on day
after day until he came to the Parting of the Ways, and there he
found his army under the command of Porus his friend.
And after the army was gathered together, Alexander the King
spoke of his journey to the oracles, and how he had climbed the
stairway, and how he had been guided by the god, and had asked
the trees of his fate, and he told them that the trees had promised
him that he should conquer the world, and return to Macedon, and
live a long life, and all the army shouted with joy. But the comrades
of Alexander and his twelve peers were sad, for they knew what was
foretold, yet they said not a word of it, but shouted with the rest.
Then Porus the Indian doubted of the truth, and he questioned the
king’s companions closely, but they told him not of the oracle:
howbeit he was assured in his heart that Alexander was to die, and
he thought to seize on the empire, and he began to contrive the
king’s death; and Alexander knew of his questionings, and kept
watch over his doings.
Then orders were sent to the host to prepare for their march, for
Alexander was minded to set out and conquer the nations that had
not yet submitted to him, yet before he started, he bade men set up
two marble pillars at the temple of the Parting of the Ways, and
between them a pillar of gold, and on it was written in the language
of the land, how that Alexander the king had come to this spot and
had conquered all nations, and it said how that there was no
passage to the Eastward but to the Northward only. And when this
was done all the tents were struck and the host moved into a land to
the north, where they had not yet been; and the people of the land
brought him tribute.
CHAPTER XVIII. HOW ALEXANDER SLEW PORUS
AND WON BACK THE WIFE OF CANDOYL AND WAS
KNOWN OF CANDACE WHEN HE CAME TO HER.
After these things the host of the Greeks and the Persians and the
Indians was gathered together, in one place, and messengers came
from all the kings of the land to it to Alexander the king, bringing
gifts of rare and precious things, of gold and spices, of the skins of a
fish like to a leopard’s skin, of living lions and other wild beasts.
Now, among these was the messenger of a Queen of the land,
Candace by name, the widow of a great king friend and cousin of
Porus; and they brought with them letters to King Porus from her.
And when Alexander heard tell of her, he asked the King of India
concerning her, who she was, and what manner of men she ruled
over, and Porus answered and told him how she was the fairest
woman in India, and how she had married his near kinsman, and
had borne him three sons, Candoyl, Marcippus, and Caratros. Then
he told him how he had sent his daughter to her for safety, and how
she had married her to Caratros, her youngest son, who should
reign after her, as the custom of that folk was: and he told of the
gods she worshipped, and of the people she ruled, and of the riches
of the land. Then Alexander was fain of her presence, and sent rich
gifts, and a golden image of Ammon his god, and a letter in which
he asked her to journey towards the mountains and meet him there,
and he gave the messengers wealth and a strict command to tarry
not till they brought him word again. But Porus purposed evil in his
heart, for he sought to stir up wrath against Alexander in Roxana the
Queen.
Thus the messengers came to Queen Candace and they laid
before her the letter of Alexander, and his gifts, and told how she
had been honoured by the wealth given to her messengers, and
besought her to meet the Lord of the Greeks, but she would not, for
she knew the double mind of Porus, and would not adventure herself
where she could meet him, yet was she willing to please Alexander,
so she sent again her messengers, and richer gifts than before, and
a letter praising his knighthood and his valour, and the power of his
gods. Now these were her gifts, a crown of gold set with a hundred
precious stones, and two hundred and ten chains of red gold, and
thirty rich goblets carved with pelicans and parrots, five Ethiopian
slaves of one age, a rhinoceros, a thousand beryls in caskets of
ebon-wood, and four elephants to carry this wealth, and on the back
of each was the skin of a spotted panther, rich and precious. So the
messengers went their way, and with them Queen Candace sent a
cunning painter, and she prayed him in private to make her a portrait
of the king on parchment, noting all his shape and proportion. And it
was done as she said, for Alexander received her gifts and well
entreated her messengers, and sent them home; and when they
came the painter brought his drawing before her, and she rejoiced,
for she had longed to see what manner of man the Greek lord was,
and now was her wish fulfilled.
It fell on a day that Alexander was in his tent, and one of his
clerks was there with him, and as men went out and he chanced to
be alone with the king, he fell on his knees before him, and
besought grace. Then Alexander comforted him and bade him speak
out boldly and fear not. So this clerk told the king how Porus knew
that the death of Alexander was near, and that he had gathered
together men from all parts to slay him, and he told him how that
the men of Gog and Magog were on the march from the frozen lands
of the North at the pay of Porus. Then Alexander asked how this
should be, and the clerk told him that he had been sent to them in
years back by Darius, and that then it had been a full year’s journey,
but now had they come nearer, so that one month saw the
beginning and the end of the way to them, when Porus had sent
him. Then the Lord of the Greeks grew wrathful and began to doubt
all men, for he remembered that he should die by the hands of a
friend whom he trusted, wherefore he sent messengers for Porus,
and when he came he said to him: “O Porus, is not the half of my
throne sufficient for thee, but thou must adventure to slay me by the

You might also like