diff --git a/projects/plugins/jetpack/class.json-api-endpoints.php b/projects/plugins/jetpack/class.json-api-endpoints.php index 30a023d093d8f..314742143b5e8 100644 --- a/projects/plugins/jetpack/class.json-api-endpoints.php +++ b/projects/plugins/jetpack/class.json-api-endpoints.php @@ -132,7 +132,14 @@ abstract class WPCOM_JSON_API_Endpoint { * * @var string */ - public $rest_route = null; + public $rest_route; + + /** + * Jetpack Version in which REST support was introduced. + * + * @var string + */ + public $rest_min_jp_version; /** * Accepted query parameters @@ -350,12 +357,14 @@ public function __construct( $args ) { $this->method = $args['method']; $this->path = $args['path']; $this->path_labels = $args['path_labels']; - $this->rest_route = $args['rest_route']; $this->min_version = $args['min_version']; $this->max_version = $args['max_version']; $this->deprecated = $args['deprecated']; $this->new_version = $args['new_version']; + $this->rest_route = $args['rest_route']; + $this->rest_min_jp_version = $args['rest_min_jp_version']; + // Ensure max version is not less than min version. if ( version_compare( $this->min_version, $this->max_version, '>' ) ) { $this->max_version = $this->min_version; @@ -2761,6 +2770,15 @@ public function build_rest_route() { return $version_prefix . $this->rest_route; } + /** + * Get Jetpack Version where support for the endpoint was introduced. + * + * @return string + */ + public function get_rest_min_jp_version() { + return $this->rest_min_jp_version; + } + /** * Return endpoint response * diff --git a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-list-endpoint.php b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-list-endpoint.php index 7ed7d3240f465..59f8e4f110b7d 100644 --- a/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-list-endpoint.php +++ b/projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-list-endpoint.php @@ -6,6 +6,7 @@ 'method' => 'GET', 'path' => '/sites/%s/plugins', 'rest_route' => '/plugins', + 'rest_min_jp_version' => '14.0-a.7', 'stat' => 'plugins', 'min_version' => '1', 'max_version' => '1.1',