Adapter API Routes
  • 24 May 2023
  • Dark
    Light
  • PDF

Adapter API Routes

  • Dark
    Light
  • PDF

Article Summary

Adapter API routes can be defined in the same manner as application routes. This allows you to expose adapter functionality using a web API instead of a task or custom code.

Route Example

Adding the route property to a method in the pronghorn.json file informs Itential Automtion Platform (IAP) that you would like the route exposed.

For example, let's say we have an adapter named HelloWorld. We can define a route for one of its methods with the following entry in the pronghorn.json file.

{
    "name" : "hello",
    "summary" : "Say hello",
    "description" : "Example",
    "input" : [],
    "output" : {
        "type" : "object",
        "name" : "return_data",
        "description" : "A string saying hello back to the user."
    },
    "route" : {
        "verb" : "GET",
        "path" : "/hello"
    },
    "roles" : ["admin"]
}

This example tells IAP that we would like to define the route /hello to serve as the interface for the method hello in our HelloWorld adapter.

One important difference between applications and adapters when it comes to their API routes is that applications use the title property in the pronghorn.json file for their base path, whereas adapters use their service name. The service name is the name you gave the adapter when creating it. This name can be seen in the Admin Essentials application under the Adapters dropdown.

AdaptersDropdown.png

Let's take our HelloWorld adapter as an example. If we added it to IAP with the name HelloWorldAlpha, then the hello method could be accessed via the following route:

http://<IAP base path>/HelloWorldAlpha/hello

If we added a second HelloWorld adapter named HelloWorldBeta then the hello method would have this route:

http://<IAP base path>/HelloWorldBeta/hello

Reference

You can see the routes that IAP creates on the Help Desk page under Adapter/Integration API. Navigate to the icon on the left pane → select Help (right side) → click the View Documentation button under Adapter/Integration API.

http://<IAP base path>/help

AdapterIntegrationAPI.png

Other Uses

Exposed adapter routes can also be used in JSON Forms validation in the same manner as application routes. Just find your base URL and API route in the dropdowns.

JsonFormsValidation.png


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.