Skip to content

EspoCRM – Open Source CRM Application

2.6 KB
Raw Blame
{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://www.espocrm.com/schema/routes.json",
    "title": "routes",
    "description": "Backend API routes.",
    "type": "array",
    "items": {
        "type": "object",
        "description": "A route.",
        "properties": {
            "route": {
                "type": "string",
                "description": "A route path. Example: `/MyScope/:id/myAction`."
            },
            "method": {
                "type": "string",
                "enum": [
                    "get",
                    "post",
                    "put",
                    "delete",
                    "options",
                    "patch"
                ],
                "description": "An HTTP method."
            },
            "noAuth": {
                "type": "boolean",
                "description": "Makes the route not requiring authentication."
            },
            "apiAuthForbidden": {
                "type": "boolean",
                "description": "Forbids API authentication, such as the API user, OAuth. Since 10.1."
            },
            "actionClassName": {
                "type": "string",
                "description": "An action class. Should implement the interface Espo\\Core\\Api\\Action."
            },
            "consumes": {
                "type": "array",
                "items": {
                    "type": "string",
                    "description": "Media type.",
                    "examples": [
                        "application/json",
                        "multipart/form-data",
                        "application/x-www-form-urlencoded",
                        "text/plain"
                    ]
                },
                "description": "If defined, restricts content types allowed for the endpoint. If an empty array, the Content-Type header must be empty. As of v10.1."
            },
            "params": {
                "type": "object",
                "description": "Parameters. If starts with a colon, then will be parsed from the URI. Example: `:id`.",
                "additionalProperties": {
                    "type": "string"
                },
                "properties": {
                    "controller": {
                        "type": "string",
                        "description": "A controller name."
                    },
                    "action": {
                        "type": "string",
                        "description": "A controller action name."
                    }
                }
            }
        },
        "required": [
            "route",
            "method"
        ]
    }
}