You can use a sequence of REST API workitem service commands to approve a machine request.

始める前に

  • Log in to vRealize Automation as an approver with at least one of the following qualifications:

    • You are designated as an approver in an approval policy.

    • You belong to a group which has been designated as an approval group in an approval policy.

    • You are designated as a delegate for someone who is an approver.

  • Verify that the host name and fully qualified domain name of the vRealize Automation instance are available.

  • Verify that you have a valid HTTP bearer token that matches your login credentials. See REST API Authentication.

手順

  1. List all available work item IDs.
    curl --insecure -H "Content-Type: application/json" 
    -H "Authorization: Bearer $token” 
    https://$host/workitem-service/api/workitems
  2. Get details for a specific work item ID.

    For example, get the details for work item 5e3e9519-78ea-4409-a52c-e4aa3bc56511.

    curl --insecure -H "Content-Type: application/json" 
    -H "Authorization: Bearer $token” 
    https://$host/workitem-service/api/workitems/5e3e9519-78ea-4409-a52c-e4aa3bc56511
  3. Construct a JSON file that contains the work item ID information that you need to approve a machine request.
    1. Copy the appropriate JSON input file template to a new file in an XML editor that maintains formatting.

    2. Substitute the input variables in the template with the values you obtained for your specific work item ID, for example 5e3e9519-78ea-4409-a52c-e4aa3bc56511.

    3. Save the file with a new name, for example, approve.json.

  4. Approve the submitted machine request by specifying the work item ID and including the JSON file as part of the command line.
    curl --insecure -H "Content-Type: application/json" 
    -H "Authorization: Bearer $token" 
    https://$host/workitem-service/api/workitems/5e3e9519-78ea-4409-
    a52c-e4aa3bc56511/actions/com.mycompany.csp.core.approval.action.approve 
    --d @approve.json

タスクの結果

If the command is successful, the HTTP status is 201 Created. If the command is not successful, the HTTP status is 204 No Content.