Quick Start Guide¶
New to WSO2 API Manager? No worries; we'll guide you through the basics!
In this step-by-step guide, you’ll learn how to create, publish, and invoke an API using the Publisher Portal and Developer Portal.
Before you begin...¶
Choose a deployment option to start WSO2 API Manager.
Here's how you can download and run WSO2 API Manager locally:
-
Install Java SE Development Kit (JDK) version 21 and set the
JAVA_HOME
environment variable.Tip
For more information on setting the
JAVA_HOME
environment variable for different operating systems, see Setup and Install -
Download WSO2 API-Manager.
-
Extract the downloaded zip file.
-
Navigate to the
<API-M_HOME>/bin
folder from your command line. -
To start WSO2 API Manager, execute the relevant command:
Here's how you can run WSO2 API Manager using Docker:
- Install Docker if you haven't done so already.
-
Pull and start WSO2 API Manager by executing the following command:
Note
- The
docker run
command will start WSO2 API Manager and expose the ports9443
and8243
.
- The
What you'll build¶
In this sample scenario, you'll implement the full lifecycle of an API using WSO2 API Manager.
Here are the steps that we are going to follow:
Let's get started...
Step 1: Create, Deploy and Publish an API¶
Follow the instructions below to create, deploy and publish an API via the Publisher Portal of WSO2 API-M.
-
Navigate to the Publisher Portal.
-
Sign in with
admin/admin
as the credentials. -
Next, let's create a mock REST service by navigating to Mocky.io. You can provide the following configuration in order to create a mock service.
Field Value HTTP Status
200 - OK Response Content Type
application/json Charset
UTF-8 HTTP Response Body
{"hello": "world"}
Finally click Generate My HTTP Response to save and generate the mock service url.
-
Select REST API from the home screen and then click Start From Scratch.
-
Enter the API details.
Name HelloWorld Context /hello
Version 1.0.0 Endpoint https://run.mocky.io/v3/e42a76f0-95f3-4759-b658-dcc2b0c8bacd
-
Click Create & Publish.
This will publish your first API on the Developer Portal as well as deploy it on the API Gateway. You now have an OAuth 2.0 secured REST API that is ready to be consumed.
Step 2: Subscribe to the API¶
Follow the instructions below to subscribe to the API via the Developer Portal of WSO2 API-M.
-
Navigate to the Developer Portal.
https://localhost:9443/devportal
The published
HelloWorld
API is listed in the Developer Portal as shown below. -
Click Sign-In and enter
admin/admin
as your credentials to sign in to the Developer Portal. -
Once you click on the HelloWorld API, you will be redirected to the API overview page. Then, go ahead and click on the TRY OUT button.
And with that, we have subscribed to the API using the
DefaultApplication
.
Step 3: Invoke the API¶
Follow the instructions below to invoke the created API.
-
Click on Try Out → API Console from the left menu. Then, click on GET TEST KEY to generate a test access token.
Note
If this is the first time you are using the API console from your browser, open a new tab and navigate to the https://localhost:8243/ URL.
This will prompt your browser to accept the certificate used by the API Gateway. This is required because by default the API Gateway uses a self-signed certificate that is not trusted by web browsers.
Since a trusted certificate is used when running in production, you won't have to do this step when running in production.
-
Click on the
GET
resource of the API to expand the resource and Click Try It Out. -
Click Execute.
You should see the
{"hello" : "world"}
response from the API.
Congratulations! With that, you've created, deployed, and published your first API. Next, you subscribed to it and put it to the test. Your journey with WSO2 API Manager has officially begun!