Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This guide will walk you through creating an API file and a basic Get REST API endpoint that will return the a Hello World message.

Open the workspace 

(If you haven't created an example workspace, create a workspace called papihello. See Using Workspaces

Open the example workspace by pointing your browser to the URL:

http://[HOST]:[PORT]/ide/papihello

Where host is the server you installed Profound.js on and port is the port number Profound.js is running on. If the installation is on your PC or Mac computer, use localhost.

OR open the workspace from the ide with the Open button and then select the example workspace:

Image ModifiedImage Modified


Create API file

Create a new API json file by clicking the New button and selecting API file. The file will be opened and the Canvas, Parameters, API Routes, and Properties panel will be initialized.

Image Modified                   Image Modified

Set Properties

On the left hand lower panel select the General Info tab and fill on the following values

  • Name: hello
  • Summary: hello world example
  • HTTP Method: get

  • HTTP Path: /helloworld

  • Category, Sub Category, Tag, and Description all help improve documentation and organization. 

Image Modified

Save

...

Output Parameters

In the lower center panel select the Output Parameters tab. 

Image Added

Click the green plus button to add a new parameter. This will open the API Parameter dialog.

Enter Response for the name and leave the Data type set to string. Adding an example and description helps the auto-generated documentation be more complete. 

Image Added

Click OK to add the parameter.

Image Added

Save

Save your API file by clicking the Save button in the menu ribbon. Image Added The first time you use save you will be presented a save dialog with the File Name defaulting to Unnamed.api.json. You should change the Unnamed portion to an appropriate file name, like

...

helloworld.api.json in this case. Click Save.


Image Modified


Add Logic

It is best to add properties and parameters and then save before starting on logic steps because the parameters will appear as options when building the logic steps.

Profound API uses Low Code steps to build the logic of the API. In this example we have one step to set the output to the "Hello World" message.

Click on Add Step... in the canvas.

Image Added

The step builder dialog will open. At the top type a description for the step then in the What would you like to do? drop down scroll down and click on Program Data. From the Program Data options click on Set API Output

Image Added

The dialog will update to allow you to specify the value for the response parameter. For this example we will return a static string value so enter the value 'Hello World' for the parameter. Then click OK.

Image Added

Save

Save the changes Image Added

Test

On the lower right panel switch to the Test tab. If the API endpoint expected parameters there would be options to enter them at the top of the Test panel.

Image Added

For this example, there are no parameters so just click Execute to test the endpoint.

Image Added