API Explorer 1 endpoints

Validate Dynamic Resource Doc

POST /obp/v7.0.0/management/dynamic-resource-docs/validate

OBPv6.0.0-validateDynamicResourceDoc Roles: CanCreateDynamicResourceDoc Dynamic-Resource-Doc

Dry-run validation of a Dynamic Resource Doc. Send the same payload you would send to Create Dynamic Resource Doc and this endpoint will:

  • Parse method_body (URL-decoded) as Scala code and run the ToolBox compiler against it, wrapped in the same template used at runtime (request/response case classes generated from example_request_body / success_response_body).
  • Run the OBP call allowlist guard (when the OBP prop dynamic_code_obp_calls_are_restricted is set to true).

Always returns HTTP 200. Inspect the valid field in the response:

  • true — the Scala compiles and all referenced OBP methods are on the allowlist.
  • false — the response includes error (raw compiler / guard message), message (OBP error constant) and details.error_type — one of:
    • CompilationError — method_body failed to compile.
    • DependencyError — compiled, but references OBP types/methods that the admin has not allowed in dynamic_code_allowed_obp_methods.
    • UnknownError — any other unexpected exception.

Nothing is persisted and no endpoint is served as a result of calling this.

User Authentication is Required. The User must be logged in. The Application must also be authenticated.

JSON request body fields (4)
description
Description of the object. Maximum length is 2000. It can be any characters here.
roles
CanCreateMyUser
summary
tags
Create-My-User
JSON response body fields (2)
message
123456
valid
valid
Example request body
{
  "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",
  "partial_function_name": "createUser"
}
Example success response
{
  "valid": true,
  "message": "Dynamic Resource Doc method body is valid Scala and uses allowed dependencies."
}
Possible errors (4)
  • OBP-20001: User not logged in. Authentication is required!
  • OBP-20006: User is missing one or more roles:
  • OBP-10001: Incorrect json format.
  • OBP-50000: Unknown Error.
Implemented by OBPv6.0.0 validateDynamicResourceDoc Originally /obp/v6.0.0/management/dynamic-resource-docs/validate