Update APi

This commit is contained in:
Hoang Huu 2019-10-02 14:52:28 +07:00
parent 79165222ac
commit b3a3673ba7

View File

@ -41,45 +41,55 @@ class Agency_Api extends Base_Api {
* *
*/ */
public function register_routes() { public function register_routes() {
/// call http://domain.com/wp-json/estate-api/v1/job/list //// /**
* Get agency list.
*
* Call http://domain.com/wp-json/estate-api/v1/agency/list
*/
register_rest_route( $this->namespace, $this->base . '/list', [ register_rest_route( $this->namespace, $this->base . '/list', [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_list' ], 'callback' => [ $this, 'get_list' ],
'permission_callback' => [ $this, 'validate_request' ], 'permission_callback' => [ $this, 'validate_request' ],
] ); ] );
/// call http://domain.com/wp-json/estate-api/v1/job/1 //// /**
* Get agency detail.
*
* Call http://domain.com/wp-json/estate-api/v1/agency/1
*/
register_rest_route( $this->namespace, $this->base . '/(?P<id>\d+)', [ register_rest_route( $this->namespace, $this->base . '/(?P<id>\d+)', [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_detail' ], 'callback' => [ $this, 'get_detail' ],
'permission_callback' => [ $this, 'validate_request' ], 'permission_callback' => [ $this, 'validate_request' ],
] ); ] );
/// call http://domain.com/wp-json/estate-api/v1/job/create //// /**
* Create a agency.
*
* Call http://domain.com/wp-json/estate-api/v1/agency/create
*/
register_rest_route( $this->namespace, $this->base . '/create', [ register_rest_route( $this->namespace, $this->base . '/create', [
'methods' => 'GET', 'methods' => 'GET',
'callback' => [ $this, 'create' ], 'callback' => [ $this, 'create' ],
'permission_callback' => [ $this, 'validate_request' ], 'permission_callback' => [ $this, 'validate_request' ],
] ); ] );
/// call http://domain.com/wp-json/estate-api/v1/job/edit //// /**
* Edit a agency.
*
* Call http://domain.com/wp-json/estate-api/v1/agency/edit
*/
register_rest_route( $this->namespace, $this->base . '/edit', [ register_rest_route( $this->namespace, $this->base . '/edit', [
'methods' => 'GET', 'methods' => 'GET',
'callback' => [ $this, 'edit' ], 'callback' => [ $this, 'edit' ],
] ); ] );
/// call http://domain.com/wp-json/estate-api/v1/job/delete ////
register_rest_route( $this->namespace, $this->base . '/delete', [
'methods' => 'GET',
'callback' => [ $this, 'delete' ],
'permission_callback' => [ $this, 'validate_request' ],
] );
/** /**
* List job by tags and taxonmies * Delete a agency.
*
* Call http://domain.com/wp-json/estate-api/v1/agency/delete
*/ */
/// call http://domain.com/wp-json/estate-api/v1/jobs //// register_rest_route( $this->namespace, $this->base . '/delete', [
register_rest_route( $this->namespace, $this->base . '/tags', [
'methods' => 'GET', 'methods' => 'GET',
'callback' => [ $this, 'delete' ], 'callback' => [ $this, 'delete' ],
'permission_callback' => [ $this, 'validate_request' ], 'permission_callback' => [ $this, 'validate_request' ],