Approve Dynamic Change Request
POST /obp/v7.0.0/management/dynamic-change-requests/CHANGE_REQUEST_ID/approval
OBPv7.0.0-approveDynamicChangeRequest Roles: CanApproveDynamicChangeRequest Dynamic-Change-RequestDynamic
Approve a Dynamic Change Request and apply it.
The checker must not be the requestor (OBP-30279: The checker (approver/rejecter) cannot be the same user as the maker (requestor). Maker/Checker separation is required.). payload_hash must equal the request's stored hash, so the client has to show the checker exactly what is being approved. The server then re-checks that the live target has not changed since submission, wins the INITIATED to APPROVED transition (a concurrent approval or rejection loses), re-compiles and re-validates the payload, applies it through the same provider the v4.0.0 / v6.0.0 endpoint uses, and records the approved body hash on the target. If re-validation or apply fails the request is moved to FAILED with the reason in checker_comment and the target is left unchanged.
User Authentication is Required. The User must be logged in. The Application must also be authenticated.
URL Parameters:
CHANGE_REQUEST_ID: CHANGE_REQUEST_ID
JSON request body fields (2)
- payload_hash
- payload_hash
- checker_comment
- checker_comment
JSON response body fields (18)
- actioned_at
- actioned_at
- business_justification
- business_justification
- checker_comment
- checker_comment
- checker_user_id
- checker_user_id
- created_at
- created_at
- current_payload
- current_payload
- current_payload_hash
- current_payload_hash
- dynamic_change_request_id
- dynamic_change_request_id
- expires_at
- expires_at
- operation
- operation
- payload_hash
- payload_hash
- proposed_payload
- proposed_payload
- request_path
- request_path
- request_verb
- POST
- requestor_user_id
- requestor_user_id
- status
- target_id
- target_id
- target_type
- target_type
Example request body
{
"payload_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"checker_comment": "Reviewed the method body; matches UAT hash."
}Example success response
{
"dynamic_change_request_id": "0d1c9e3c-6c2b-4c1e-9a53-2d5b2f0d7f11",
"target_type": "DYNAMIC_RESOURCE_DOC",
"target_id": "",
"operation": "CREATE",
"status": "APPROVED",
"request_verb": "POST",
"request_path": "/obp/v4.0.0/management/dynamic-resource-docs",
"payload_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"current_payload_hash": "",
"proposed_payload": {
"request_url": "/my_user/MY_USER_ID",
"success_response_body": {
"my_user_id": "some_id_value",
"name": "Jhon",
"age": 12,
"hobby": [
"coding"
],
"_optional_fields_": [
"hobby"
]
},
"example_request_body": {
"name": "Jhon",
"age": 12,
"hobby": [
"coding"
],
"_optional_fields_": [
"hobby"
]
},
"programming_lang": "Scala",
"bank_id": "gh.29.uk",
"roles": "CanCreateMyUser",
"summary": "Create My User",
"error_response_bodies": "OBP-50000: Unknown Error.,OBP-20001: User not logged in. Authentication is required!,OBP-20006: User is missing one or more roles: ,OBP-10001: Incorrect json format.",
"request_verb": "POST",
"description": "Create one User",
"tags": "Create-My-User",
"method_body": "%20%20%20%20val%20Some(resourceDoc)%20%3D%20callContext.resourceDocument%0A%20%20%20%20val%20hasRequestBody%20%3D%20callContext.httpBody.exists(_.nonEmpty)%0A%0A%20%20%20%20%2F%2F%20get%20Path%20Parameters%2C%20example%3A%0A%20%20%20%20%2F%2F%20if%20the%20requestUrl%20of%20resourceDoc%20is%20%2Fhello%2Fbanks%2FBANK_ID%2Fworld%0A%20%20%20%20%2F%2F%20the%20request%20path%20is%20%2Fhello%2Fbanks%2Fbank_x%2Fworld%0A%20%20%20%20%2F%2FpathParams.get(%22BANK_ID%22)%20will%20get%20Option(%22bank_x%22)%20value%0A%0A%20%20%20%20val%20myUserId%20%3D%20pathParams(%22MY_USER_ID%22)%0A%0A%0A%20%20%20%20val%20requestEntity%20%3D%20callContext.httpBody.filter(_.nonEmpty)%20match%20%7B%0A%20%20%20%20%20%20case%20Some(rawBody)%20%3D%3E%0A%20%20%20%20%20%20%20%20try%20%7B%0A%20%20%20%20%20%20%20%20%20%20com.openbankproject.commons.util.JsonAliases.parse(rawBody).extract%5BRequestRootJsonClass%5D%0A%20%20%20%20%20%20%20%20%7D%20catch%20%7B%0A%20%20%20%20%20%20%20%20%20%20case%20e%3A%20MappingException%20%3D%3E%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20errorResponse(s%22%24InvalidJsonFormat%20%24%7Be.msg%7D%22)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20case%20None%20%3D%3E%0A%20%20%20%20%20%20%20%20return%20errorResponse(s%22%24InvalidRequestPayload%20Current%20request%20has%20no%20payload%22)%0A%20%20%20%20%7D%0A%0A%0A%20%20%20%20%2F%2F%20please%20add%20business%20logic%20here%0A%20%20%20%20val%20responseBody%3AResponseRootJsonClass%20%3D%20ResponseRootJsonClass(s%22%24%7BmyUserId%7D_from_path%22%2C%20requestEntity.name%2C%20requestEntity.age%2C%20requestEntity.hobby)%0A%20%20%20%20Future.successful%20%7B%0A%20%20%20%20%20%20(responseBody%2C%20HttpCode.%60200%60(callContext.callContext))%0A%20%20%20%20%7D",
"dynamic_resource_doc_id": "vce035ca-9a0f-4bfa-b30b-9003aa467f51",
"partial_function_name": "createUser"
},
"requestor_user_id": "9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
"business_justification": "Expose the new loan quote endpoint for the mobile app.",
"checker_user_id": "9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
"checker_comment": "Reviewed the method body; matches UAT hash.",
"created_at": "1100-01-01T01:01:01.000Z",
"actioned_at": "1100-01-01T01:01:01.000Z",
"expires_at": "1100-01-01T01:01:01.000Z"
}Possible errors (10)
- OBP-20001: User not logged in. Authentication is required!
- OBP-10001: Incorrect json format.
- OBP-20006: User is missing one or more roles:
- OBP-30346: Dynamic change request not found. Please specify a valid CHANGE_REQUEST_ID.
- OBP-30347: Dynamic change request is not in INITIATED status. It has already been approved, rejected, withdrawn or has expired.
- OBP-30348: The payload_hash in the approval does not match the stored hash of the change request. Re-read the request and approve exactly the content shown.
- OBP-30349: The target of this change request has changed since it was submitted. Withdraw it and submit a new request against the current version.
- OBP-30279: The checker (approver/rejecter) cannot be the same user as the maker (requestor). Maker/Checker separation is required.
- OBP-30354: The dynamic change request was approved but could not be applied. Its status is now FAILED; see checker_comment for the reason.
- OBP-50000: Unknown Error.