Recipe_Post_Rest_Api::register_routes_for_recipes()

Rest API Custom Endpoints

Contents

  • Changelog

  • Source Source

    File: src/core/automator-post-types/uo-recipe/class-recipe-post-rest-api.php

    	public function register_routes_for_recipes() {
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/add/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'add' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/delete/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'delete' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/update/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'update' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/get_options/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'get_options' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/change_post_status/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'change_post_status' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/change_post_recipe_type/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'change_post_recipe_type' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/change_post_title/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'change_post_title' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/recipe_completions_allowed/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'recipe_completions_allowed' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		/**
    		 * Maximum number of times a Recipe can run
    		 */
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/recipe_max_completions_allowed/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'recipe_max_completions_allowed' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/set_recipe_terms/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'set_recipe_terms' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		//Rest APIs for User Selector Automator v2.0
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/user-selector/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'user_selector' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/trigger-options/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'trigger_options' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/schedule_action/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'schedule_action' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    
    		register_rest_route(
    			AUTOMATOR_REST_API_END_POINT,
    			'/remove_schedule/',
    			array(
    				'methods'             => 'POST',
    				'callback'            => array( $this, 'remove_schedule' ),
    				'permission_callback' => array( $this, 'save_settings_permissions' ),
    			)
    		);
    	}
    

    Changelog Changelog

    Changelog
    Version Description
    1.0 Introduced.