You can use the REST Plug-In with vRealize Code Stream to invoke a REST API, which sends and receives data between external and internal applications, such as your Git repository, JIRA, and so on. The REST Plug-In enables applications that use a REST API to interact with other plug-ins to support continuous delivery of your development applications through the pipeline.

About this task

The REST Plug-In works with any REST API. It supports GET, POST, PUT, PATCH, and DELETE HTTP methods. When you add a REST task to your pipeline, the task calls a URL. For POST, PUT, and PATCH actions, you include a payload. In the payload, you can bind your pipeline and task properties when the pipeline runs.

You can add REST tasks to your pipeline to communicate information between applications, and provide status to the next task in the pipeline stage. For example, if you add a REST task to create a tag on a Git commit for a build, the task could post a request to get the check-in ID from your repository. Then, the task would send a payload to your repository to create a tag for build, and your repository would return the response with the tag.

You can use a Poll task to poll the API used in the REST task until the task results meet the exit criteria. See Configure a Poll Task.

Prerequisites

  • Verify that your instance of vRealize Code Stream includes one or more pipelines with stages, in Draft state. See Create a Release Pipeline.

Procedure

  1. In your pipeline, click Add Task to add a task to a stage.
  2. Add a REST task.
    1. Click Add Task.
    2. In the Add Task dialog box, click the Provider drop-down menu.
    3. Click REST Task.
    4. Enter a name for the task, and click OK.
  3. Configure the REST task.
    1. In the REST task, click the gear, and click Configure.
    2. In the REST Request Properties area, select the HTTP method.

      To have the REST task import information from another application, you select the POST method. To export information to another application, you select the GET method.

    3. Enter the URL that identifies the REST API endpoint.
    4. For a task to import information from another application, include the payload variable.

      For example, for an import task, you would enter ${Stage0.export.responseBody}. If the response data size exceeds 5 MB, the REST task might fail.

    5. To provide authorization for the task, click Add Headers and enter a header key and value.

    6. Click Save.
  4. Activate and run the pipeline, and view the task execution details.
    1. In your pipeline, click Activate, then on the toolbar click Execute.
    2. After the pipeline runs, click Pipeline Executions, and click the REST task in the pipeline stage.
    3. In the Task Result dialog box, click the Result drop-down arrow, and verify that the details display the response code, response body, and the response header keys and values.

    4. Click the Input drop-down arrow, and view the input details, which include the name and value pairs, and the header key and value pairs.

Results

You configured a REST task to send information between applications and plug-ins in your instance of vRealize Code Stream.