• Register

Validating Fields

Each object that allows write access (create or update) will also provide a validate method to validate field values.

The validate method takes a partial object as a parameter.  it will validate the value of each field that is passed.  A list of validation errors is returned.

Note that some validations that check relationships with other objects or that span more than one field cannot be checked during the validate method call.  For these cases, create or update may still encounter errors on data that validate considers correct.

Calling the Validate Method

Here is an example request calling the application.validate method.  Here, the name field is validated.  The result of true indicates the name was valid.

A JSON-RPC Request for calling the validate method

{
    "method": "application.validate",
    "params": [
        {
            "name": "new_application_name"
        }
    ],
    "id": 1
}

The JSON-RPC Response for valid data

{
    "result": true,
    "error": null,
    "id": 1
}

Validation Errors

If there is an error in the data passed, an invalid object error message will be returned.

A JSON-RPC Request for calling the validate method

Here is an example request calling the application.validate method, but with invalid data.

{
    "method": "application.validate",
    "params": [
        {
            "name": ""
        }
    ],
    "id": 1
}

The JSON-RPC Response

{
    "result": null,
    "error": {
        "message": "Invalid Object",
        "code": 1000,
        "data": [
            {
                "field": "name",
                "message": "This value is not allowed to be blank."
            }
        ]
    },
    "id": 1
}

Docs Navigation