Building an API on Microgateway
Key Points
- The architecture consists of a cloud‑based API Management node (on Bluemix) that the developer accesses via a browser, which forwards calls to a locally‑run standalone microgateway that can then reach internal or external resources.
- After logging into Bluemix, you create a new API (named “requote”), set it to HTTPS, define its output as HTML, and initially remove any security definitions for simplicity.
- You add a single GET operation at the path **/requote** and configure an invoke that calls www.brainyquote.com, appending a search term via an environment‑variable query‑string placeholder.
- Using the “Microgateway Apps” catalog, you create a new product called “requote,” associate the newly defined API with this product, and then save the configuration.
- The tutorial assumes the microgateway is already installed on the developer’s workstation and that the Bluemix environment is pre‑configured to communicate with it.
Full Transcript
# Building an API on Microgateway **Source:** [https://www.youtube.com/watch?v=YKqxvTMCUQE](https://www.youtube.com/watch?v=YKqxvTMCUQE) **Duration:** 00:09:31 ## Summary - The architecture consists of a cloud‑based API Management node (on Bluemix) that the developer accesses via a browser, which forwards calls to a locally‑run standalone microgateway that can then reach internal or external resources. - After logging into Bluemix, you create a new API (named “requote”), set it to HTTPS, define its output as HTML, and initially remove any security definitions for simplicity. - You add a single GET operation at the path **/requote** and configure an invoke that calls www.brainyquote.com, appending a search term via an environment‑variable query‑string placeholder. - Using the “Microgateway Apps” catalog, you create a new product called “requote,” associate the newly defined API with this product, and then save the configuration. - The tutorial assumes the microgateway is already installed on the developer’s workstation and that the Bluemix environment is pre‑configured to communicate with it. ## Sections - [00:00:00](https://www.youtube.com/watch?v=YKqxvTMCUQE&t=0s) **Building a Microgateway API on Bluemix** - The passage outlines how to set up a micro‑gateway‑based API, describing the cloud‑hosted API management node, the local standalone gateway, and the step‑by‑step process for creating the API in the Bluemix dashboard. ## Full Transcript
this video will show you how to
construct an API that runs on the micro
Gateway here is a visual representation
of the architecture or topology that
will be used for this
course you'll see that the API
management node at the very top is
actually running on Blue miix in the
cloud the API developer or in other
words you is using a browser to access
that API management
node the API management node also
connects to the API Gateway which in
this particular case is the Standalone
micro Gateway this Standalone micro
Gateway will be running on the
developers local
machine once that Gateway is up and
running it can then re reach out onto
the network to any sorts of
resources within the Enterprise or
outside the Enterprise that you directed
to get to note also that when it comes
time to let other people or other
developers know about your micro Gateway
API you can use the developer portal we
will not use that particular step for
this
course
this course assumes that you have
already installed the micro Gateway on
the local developer workstation and that
you have configured your Blu miix
environment to communicate with the
micro
gateway to begin log in to your blue
miix
account from the
dashboard click the menu icon and then
select drafts
once you arrive at drafts click on
apis then click add and click create a
new
API give the new API a
name in this particular case we're going
to call it
[Music]
requote do not associate with any
product and click
add when the new API comes up you'll see
that a number of configuration items are
already set we will set the scheme as
https this API will produce HTML
output
right now we're going to remove the
security definition that can be added
again later when we want
it now we create a
path and this will be the path that
external people call to take advantage
of the U API and this path we call slash
requote the standard operation is a get
and that will suffice for us we have
nothing else to add to this relatively
simple
API now we click
assemble now we click
invoke and we give the invoke a a title
in this particular case a brainy
quote We Now set the
URL that this invoke will invoke to go
and get the resource information that
this API
represents in this particular case we
are going out to
www.brainyquote.com
to get a hold of some brainy
quotes
in this case we are also going to
append a search
term that will be embedded in the
request query
string so we use
this environment variable representation
for query string
scrolling down for the rest of the
invoke configuration we see that we're
not doing anything else beyond the
defaults
now we can actually click the test
button and this will allow us to
create a product first we select the
micro Gateway apps catalog which is the
catalog that points at our micro Gateway
environment now we create a new product
called
requote and we go ahead and ass
associate the API and create the
product now notice that we haven't saved
this yet so we go up and save it and
when we do that the test environment
notices that it's no longer saved
correctly so we republish the
product this sequence of events will
happen every time you change the API and
then want to go ahead and test
it
okay now we go back to our developer
workstation we set our console level
debugging to debug and we restart the
Gateway the Gateway goes out to the API
manager on Blu miix obtains the
configuration for the new API which we
can then now use Curl to actually invoke
our first API is actually up and running
and it
works now let's have a look and see what
we really saw happening here if we
scroll back in the debug of the console
we can see here where the invoke took
advantage of our query string and went
out and invoked brainy quote
that is all very well and good with one
problem all of the links and URLs
embedded in the return from
brainyquote.com
point to brainyquote.com and not back to
our
API so let's fix the fact that we want
all urls to point to our API and not to
the back end so we use a JavaScript that
does exactly
that now we go back and retest our API
we republish it because it has
changed and we can reinvoke
this first we have to get the micro gate
way running on the developer workstation
to pick up the changes from the micro
Gateway API manager so we stop and
restart the micro Gateway once
again now we go over and run the uh curl
command to invoke the
API in this case we're looking for
quotes from
Shakespeare and when we look at the
response from the AP
now we see that the links have been
replaced with our own links that point
back to our own
API this API is now
ready thank you for watching this video
be sure to visit the other two videos in
this
series and