Creating your First REST Action

This use case will help you learn how to create a REST Action. This Action will request some information from a REST endpoint via a simple GET request. In the following use case we will use the CDA-REST-Endpoint. This endpoint can also be replaced by any other endpoint of your choice.

Watch the video:

Before you Start...

Make sure that the following conditions are met before you start creating your REST Action:

   
The RA Web Service REST Agent agent is available.

The PCK.ITPA_SHARED Pack is installed.

Note: Download the packs from https://marketplace.automic.com/.

The PCK.AUTOMIC_RA_REST pack is installed.

To Create the Hello CDA Action

  1. Navigate to the Process Assembly perspective.
  2. Select the Action Packs tab.
  3. Create a new Action Pack by clicking the Create Action Pack button in the sidebar.
  4. Name it Hello World.
  5. Click Create Action Pack to finish the creation process.
  6. Click the Add Action button in the toolbar to add an Action to the Action Pack. The Add Action dialog is displayed.
  7. Select the REST type from the drop-down list.
  8. Fill in the other fields.

    Note: Categories are listed in the Explorer when editing workflows. They are represented as folders within the AE and can be changed later on.

  9. Click Next.
  10. Now it's time to select the authentication type supported by the endpoint of your choice. For the purpose of this use case the Basic type is selected, as this method is used by the CDA endpoint.
  11. Click Next to confirm the creation of the Action.
  12. Re-validate your input and click Add.
  13. Let's navigate now to Variables & Prompts > Prompt Sets to specify the endpoint and credentials.
  14. Click the Request tab to specify the REST resource that you want to go for. For the purpose of this use case, we will retrieve the list of all applications.
  15. Click Execute in the toolbar to execute the Action.
  16. An input request is triggered, which is indicated in the upper right corner of your screen (yellow number). Click it to open it.
  17. Since we have already defined the required values in the prompt sets we only have to submit our request.
  18. A quick look at the Last Report helps us determine whether everything worked out fine.

    Image displaying report

  19. Let's define now our first output variable. A GET request like the one we've just performed makes only sense when the response is used for further processing. So let's extract a value from the response. To do so, switch to Response and click Add Row.
  20. We could now directly paste a JSON Path into the respective field, but we will use the response expression tester to immediately validate our input. To do so, simply click the Test button on the very right of the row.
  21. You can provide arbitrary data or use the result of the last execution for the test. Click Replace to fill in the result of the last execution.
  22. Specify the JSONPath expression and click Evaluate.

    Image displaying  Response Expression Tester dialog

  23. Click Save to confirm your changes.

    Note: You can change the parsing type and expression directly in the test window. The text in the Test Input is kept for the next test and will be cleared on logout.

  24. Let's add now a second output variable just as we did with the first one. The result should look like this:

    Image displaying second output variable

    Note: The output name of a variable for REST Actions cannot start with "&". However, variables in the AE should always end with "#".

  25. Click the Save button of the JOB object.

Congratulations! You have just created your first REST Action.

Additional Notes

See also: