Manage Approvals
    • PDF

    Manage Approvals

    • PDF

    Article Summary

    1. Approve/Reject a Request

    This PATCH method approves or rejects a request for a specified approval request.

    Notes:
    • To execute this API, the user should have permission assigned (through policy) with action as authz.approval.update.
    • Approval/rejection for a renamed secret is canceled.
    PATCH{{url}}/api/v1/approvals/{approvalid}?approveRequest=yes/no

    Request Parameter

    The request parameter used in this method is shown in the following table:

    ParameterDescriptionData TypeRequired

    approveRequest

    Specifies whether this request needs to be approved or rejected. The value can be 'yes' or 'no'.

    String

    Mandatory

    Request Example 

    curl -X PATCH '{{url}}/api/v1/approvals/{approvalid}?approveRequest=yes/no' -H 'Authorization: Bearer <token>'
    

    Response Example 

    Status: 204 No Content

    2. Get Approval Request Details

    This GET method returns the approval request details for the specified approval.

    Note: To execute this API, the user should have permission assigned (through policy) with action as authz.approval.read.

    GET
    {{url}}/api/v1/approvals/{approvalid}
    curl -X GET '{{url}}/api/v1/approvals/{approvalid}' -H 'Authorization: Bearer <token>'
    

    Response Example 

    Status: 200 Ok
    {
        "requestId": "123",
        "userId": "user1",
        "resource": "/machine/dev/DB/DB1",
        "approvers": ["approver1", "approver2", "approver3"],
        "status": PENDING,
        "timeToApprove": 5,
        "validFor": 0,
        "actionBy": "",
        "chnnelId": "111"
    }

    3. Get Approval Requests

    This GET method returns the list of all approval requests.

    Note: To execute this API, the user should have permission assigned (through policy) with action as authz.approval.list.

    GET
    {{url}}/api/v1/approvals

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired

    filter


    The filter that can filter the list of approvals based on the status of the request, PENDING or TIMEOUT. The supported operators are 'eq' and 'co'.
    For example: status eq PENDING,TIMEOUT

    String


    Optional



    requestType

    Specifies the type of request. The value can be 'myRequests' or 'myApprovals'.

    String

    Optional

    pageToken

    Autogenerated token for next page of records in case the results are more than one page. Append this token in requested API URL to access the next set of pages.

    String

    Optional

    Request Example

    curl -X GET '{{url}}/api/v1/approvals' -H 'Authorization: Bearer <token>'
    

    Response Example 

    Status: 200 Ok
    {
        "result": [
            {
                "requestId": "82ea9d7f-bdc4-40b1-9848-708498b872b5",
                "userId": "ViewUser",
                "resource": "/--lp--secrets/23454",
                "action": "sm.secret.read",
                "justification": "kl",
                "approvers": {
                    "userIds": [
                        "lpargain@britive-az-cis.net",
                        "latika"
                    ]
                },
                "createdAt": "2022-02-18T07:27:32.346Z",
                "status": "PENDING",
                "validFor": 1440,
                "timeToApprove": 1440,
                "expirationTimeForApproveRequest": "2022-02-19T07:27:32.346Z"
            }
        ],
        "pagination": {
            "next": "",
            "prev": ""
        }
    }



    Was this article helpful?