LLMS_REST_API_Keys_Controller::get_item_schema()
Get the API Key’s schema, conforming to JSON Schema.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-api-keys-controller.php
protected function get_item_schema_base() {
return array(
'$schema' => 'http://json-schema.org/draft-04/schema#',
'title' => 'api_key',
'type' => 'object',
'properties' => array(
'description' => array(
'description' => __( 'Friendly, human-readable name or description.', 'lifterlms' ),
'type' => 'string',
'required' => true,
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'sanitize_text_field',
),
),
'permissions' => array(
'description' => __( 'Determines the capabilities and permissions of the key.', 'lifterlms' ),
'type' => 'string',
'required' => true,
'context' => array( 'view', 'edit' ),
'enum' => array_keys( LLMS_REST_API()->keys()->get_permissions() ),
),
'user_id' => array(
'description' => __( 'The WordPress User ID of the key owner.', 'lifterlms' ),
'type' => 'integer',
'required' => true,
'context' => array( 'view', 'edit' ),
'arg_options' => array(
'sanitize_callback' => 'absint',
'validate_callback' => array( $this, 'validate_user_exists' ),
),
),
'truncated_key' => array(
'description' => __( 'The last 7 characters of the Consumer Key.', 'lifterlms' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'last_access' => array(
'description' => __( 'The date the key was last used. Format: Y-m-d H:i:s.', 'lifterlms' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
),
);
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.1 | Introduced. |