Quick Start Guide¶
Choreo is a cloud-native low-code engineering platform that allows you to create APIs, API Proxies, triggers, and scheduled tasks to implement your integration solution.
Tip
Take a look at the Choreo playlist for video tutorials that guide you through the steps to create, publish, deploy, consume, and observe your APIs.
This quick start guide walks you through the steps to create, develop, publish, deploy, and invoke a REST API using Choreo.
Create your first REST API¶
Step 1: Create a REST API¶
First, let's create a new REST API:
-
Sign in to the Choreo Console at https://console.choreo.dev.
You will view the Home page.
-
In the Create from a Sample section, click Echo Service.
Choreo starts creating an API using the template in this sample.
Once Choreo completes adding the API, you can see the overview of this API.
Next, let's deploy this API and make it invokable.
Step 2: Deploy the REST API¶
Choreo maintains two environments by default: development and production. Let's deploy the API to the development environment.
-
Click Deploy in the left navigation menu.
-
Go to the Build Area card and click Build and Deploy.
This deploys the API to the development environment to make it invokable.
Now let's test the REST API to verify whether it works as expected.
Step 3: Test the REST API¶
To test the REST API, follow these sub-steps:
-
Click Test in the left pane.
-
Expand the POST method with the / resource path.
-
Click Try it out.
-
Add a meaningful string as the request body. For example,
Welcome to Choreo
. -
Click Execute. You'll see the string you entered in step 4 above returned as the server response.
Congratulations! You have now tested the REST API and are ready to implement the business logic.
Implement the business logic¶
Developing an API involves writing the business logic for it. APIs often need to integrate with third-party systems to create a comprehensive integration solution. With Choreo, you can create your integration solution easily by implementing the business logic using its low-code editor, pro-code editor, or both.
Step 1: Develop in low-code¶
Follow this procedure to further develop the API by adding a new resource and simple business logic:
-
Click Overview in the left navigation menu.
-
Click Edit Code.
Info
The Web Editor can take some time to open if you are a first-time user.
-
Click + below the low-code diagram to add a new resource and configure it as follows:
Field Value HTTP Method GET
Resource Path personalizedMessage
Return Type string | error
-
Click + Add Parameter to add a query parameter. Enter the following values to get a name as input:
Field Value Type string
Param Name name
-
Click Save to save the query parameter, and then click Save again to save the resource.
-
In the low-code diagram, click + after Start.
In the Add Constructs pane, click Variable.
-
Update the given variable statement syntax (i.e.,
var variable = <add-expression>
) to generate a personalized message by following these steps:-
To generate the message in string format, click
var
, and click string. -
Double-click
variable
which is the default variable name to edit it. Entermessage
as the new variable name. -
To generate the personalized message, double-click
<add-expression>
and enter the following expression:"Hello "+ name
Now the variable statement is updated as follows:
string message = "Hello "+ name;
-
-
Click Save.
-
To return the personalized message, click + below the variable you created and click Return.
In the Return pane, the return statement syntax is displayed as
return <add-expression>
.Click
<add-expression
, and click message in the list of suggestions that appear below the return statement syntax. -
Click Save.
Info
You can click the > icon on the top left corner of the editor if you want to work in the code view. Depending on your expertise, you can work in the low-code view or the pro-code view. You can also work on both views simultaneously.
Step 2: Run and test the REST API¶
Once you update the REST API configuration as described above, you can verify whether it works as expected by following these steps:
-
Click the menu icon for the listener construct and then click Run.
A terminal opens with logs that indicate the status of the REST API. If you updated the REST API as instructed above, you will see the following log:
Running executable
-
To invoke the REST API, click the menu icon for the listener construct and then click Try it.
This opens the Swagger view with details of your REST API.
-
Expand the GET resource and click Try it out.
-
In the name field, enter any value (for example,
Alice
). -
Click Execute.
The Swagger view displays the response under Response Body as shown in the image below:
Step 3: Commit changes to GitHub¶
Choreo maintains source code in a private GitHub repository. When you create a component, Choreo creates it in the private GitHub repository associated with your account. Therefore, you must commit and push your changes if you want to change the API Implementation.
Follow this procedure to commit and push your changes to GitHub.
-
On the bottom bar of the editor, click Sync with Choreo upstream.
Alternatively, you can click source control on the left pane or click Sync changes with Choreo in the pop-up displayed at the bottom right corner.
-
Click Sync my changes with Choreo in the window displayed.
-
Enter a meaningful commit message and click ✓ on the toolbar. This commits the changes to the locally cloned copy of your private GitHub repository.
Select Yes in the message that appears to specify that you need the changes to be staged.
-
On the top toolbar, click ... and then click Push.
Click OK in the message that appears to confirm that you want to push the changes.
This pushes the local changes to your private GitHub repository.
Tip
If you want to redeploy new changes, see Deploy Your REST API.
Now let's publish the API and invoke it via the API Developer Portal.
Manage your REST API¶
Choreo provides full API management capabilities so that you can manage your REST API lifecycle, apply security, apply rate-limiting policies, configure usage plans, and add documentation.
Step 1: Publish the API¶
Follow this procedure to publish the API to the API Developer Portal so that external consumers can view and consume the API:
-
Click Manage in the left pane.
-
On the Lifecycle Management page, click Publish.
-
Click Go to Devportal.
You will see the published API:
Step 2: Invoke the API¶
Follow this procedure to invoke the REST API via the API Developer Portal:
-
Click Credentials in the left pane of the API Developer Portal.
-
Click Generate Credentials. Choreo creates credentials for an internal application and subscribes this API to that internal application.
-
Click Generate Access Token, copy the generated access token, and click Close.
-
Click Try Out in the left pane.
-
Paste the copied access token in the Access Token field.
-
Click the
GET
resource you added to expand it. -
Click Try it out and enter a name for the query parameter.
-
Click Execute. You'll see the personalized message as the response from the API.
Congratulations! You have successfully created a REST API, published it on the API Developer Portal, and invoked it via the API Developer Portal.
Top