Providing a Request Body

Provide the request body that's required for a REST request using the POST or PUT method.

The following procedures can be used to configure a request body in the main HTTP URL or the optional polling URL and termination URL.

Adding the Request Body

Currently, only JSON is the supported format for a request body.

To create a request body:

  1. On the Define execution details step of the Configure REST API Details page, select Request to create a request body for the REST task.

    To create a request body for a polling or termination URL, go to the Specify completion criteria page, select the Configure a polling and termination condition for a no-wait REST call checkbox. On the Polling or Termination tab, select Request.

    If you don't see the Request tab, ensure that you have selected the appropriate HTTP method.

  2. In the editor, enter the request body.
    • You can type or copy and paste the entire payload.

    • You can reference existing parameters in the payload using the syntax ${}. For example:

      {
          "modelType": "USER_PROJECT",
          "modelVersion": "20200901",
          "parentRef": {},
          "name": "${PROJECT_NAME}",
          "identifier": "${PROJECT_NAME}",
          "description": "Creating my project",
          "objectVersion": 0,
          "objectStatus": 8,
          "registryMetadata": {
              "registryVersion": 0
          }
      }
    Note

    The built-in validator in the editor validates the request body. If you see a red dot with an 'x' at the side of the editor, hover on the icon to see the error for that line of code.
  3. To assign a task parameter to the entire request body, click Expose as a task parameter. See Parameterizing the Request Body.

    To edit the body of a parameterized request body, edit the parameter's value.

Parameterizing the Request Body

In addition to using parameters within the request body, you can parameterize the entire request body.

See Adding the Request Body.

After you create the request body in the editor, you can assign a task parameter to the entire body.

To parameterize the entire request body:

  1. On the Define execution details step of the Configure REST API Details page, select Request.

    To parameterize the request body for a polling or termination URL, go to the Specify completion criteria page. On the Polling or Termination tab, select Request.

  2. Click Expose as a task parameter.

    If you have not yet entered the request body, Data Integration displays a warning message in a dialog. Enter a request body first, then assign a parameter to the entire body.

  3. In the Add parameter panel, enter a name for the parameter in the Identifier field, or use the default value.

    The parameter name must be unique in the REST task. For a current list of the parameters in the task, see Viewing All the Parameters in a REST Task.

  4. (Optional) Enter a Description to help identify the purpose of the parameter to other users.
  5. The Data type of the parameter is JSON, which you cannot change.
  6. In the Value field, set the default JSON for this task parameter.
  7. Click Add.
    The parameter name is added to the top of the editor.

To edit the body of a parameterized request body, edit the parameter's value.

Editing the Value of a Request Body Parameter

You can change the default value of the task parameter for the request body.

To edit the parameterized request body:

  1. On the Define execution details step of the Configure REST API Details page of a POST or PUT method, select Request.

    To edit the parameterized request body for a polling or termination URL, go to the Specify completion criteria page. On the Polling or Termination tab, select Request.

  2. Click Edit parameter.
  3. In the Edit parameter panel, you can edit only the Value field. You cannot change the data type or description.

    To edit the description, see Editing a REST Task Parameter.

  4. Click Save.
Removing the Request Body Parameter

Removing the parameter removes only the association of the parameter to the request body in the REST task.

To unassign the parameter from the entire request body:

  1. On the Define execution details step of the Configure REST API Details page of a POST or PUT method, select Request.

    To unassign the parameter from the request body for a polling or termination URL, go to the Specify completion criteria page. On the Polling or Termination tab, select Request.

  2. Click Remove parameter.
  3. In the Remove parameter dialog, click Remove.

    The parameter is unassigned from the request body. The request body that was assigned to the parameter becomes the default request body.

    Note

    The parameter is not deleted from the REST task. To delete the parameter, see Deleting a REST Task Parameter.