BP_REST_XProfile_Data_Endpoint::register_routes()
Register the component routes.
Description
Source
File: bp-xprofile/classes/class-bp-rest-xprofile-data-endpoint.php
public function register_routes() {
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/(?P<field_id>[\d]+)/data/(?P<user_id>[\d]+)',
array(
'args' => array(
'field_id' => array(
'description' => __( 'The ID of the field the data is from.', 'buddyboss' ),
'type' => 'integer',
),
'user_id' => array(
'description' => __( 'The ID of user the field data is from.', 'buddyboss' ),
'type' => 'integer',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this, 'get_item' ),
'permission_callback' => array( $this, 'get_item_permissions_check' ),
),
array(
'methods' => WP_REST_Server::EDITABLE,
'callback' => array( $this, 'update_item' ),
'permission_callback' => array( $this, 'update_item_permissions_check' ),
'args' => array(
'value' => array(
'description' => __( 'The list of values for the field data.', 'buddyboss' ),
// @todo Removed to support array and object both.
/*'type' => 'object',
'items' => array(
'type' => 'string',
),
'arg_options' => array(
'validate_callback' => 'rest_validate_request_arg',
'sanitize_callback' => 'rest_sanitize_request_arg',
),*/
),
),
),
array(
'methods' => WP_REST_Server::DELETABLE,
'callback' => array( $this, 'delete_item' ),
'permission_callback' => array( $this, 'delete_item_permissions_check' ),
),
'schema' => array( $this, 'get_item_schema' ),
)
);
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.