Define API Video Script

Open server module

Let’s start by opening our Server Module. It’s called TutorialPublish unless you gave it a different name.

 

Showing source tab, click API definition tab

Here we are in the Source tab. Since we’re not writing any code in this tutorial, let’s switch over to the API Definition tab.

 

Click Add

To define a path, click the Add button and choose path. The red arrow indicates we have one or more errors in our API definition.

Click red arrow

When we click on the arrow, we see the path requires at least one segment. Segments are like subdirectories of the Path. Segments are defined in the Path Name.

Double click on path

Let’s specify the Path Name as /Contact.

Click red arrow

Let’s click on the red arrow one more time to verify that the Path Error has gone away.

Server routines have the executable code to handle Operations like Get and Put.

Expand Operations

Click on Getxx

Let’s expand Operations and click Getxx to show its details.

Change the name to GetContact and leave the default verb as Get.

Click the …

Select GetContacts

[Click on the three dots]  Last, we need to select the GetContact Server Routine.

Notice all errors have gone away, so let’s save the Server Module now. To accomplish this, click on the Path to view its Details and append forward-slash ContactID surrounded by curly brackets - where ContactId is the name of the parameter.

Click on Path

Click add button and choose parameter

[Click on the arrow]  When we click on the red arrow, the message says the path parameter has not been described yet, so let’s do that next.

Click the Add button and choose Parameter. Set the name to ContactId. The default Path location is now correct because our parameter is part of the path.

Expand SearchString

Click schema object

And as you can see by this red arrow, we need to describe the content of the parameter in a schema object. To do that, simply expand the parameter to reveal the Schema Object down here……click on the Schema Object and fill in the details.

Fill in details

Set the description to Contact Identification.

Set the type to Field.

Now, the Field name must be the name of a repository field. If you don’t know the name, you can press F8 to show the repository view.

Expand Tables, expand the letter X, and expand the xContacts table.

The repository field we want to use is called xContactIdentification. Since it’s such a long name, let’s just right-mouse click on the field and choose Copy Name.

Double click on the Schema object once again to bring back the details and paste field name.

Define Put and Delete operations

Finally, the last steps will be defining the Put and Delete operations. Just like before, we…

Set the focus on the path.

Click the Add button, but this time choose operation.

Set the name to PutContact, leave the verb as Put and choose the server routine PutContact.

And for one last time, set the focus on the path…

Click the Add button and choose operation.

Set the name to DeleteContact, change the verb to Delete and choose the server routine DeleteContact.

Click the save button to save of all your changes and that completes API definition.

Please continue with Get Contact, Put Contact and Delete Contact menu items to copy the required code and make the server routines functional.