title: How can i get data from custom post type using WP REST API
body: <p><strong>I want to GET data from my custom post type using  WP REST API.</strong></p>
  
  <p>My Custom post type is <strong>"result"</strong> and I have tried with this parameters.</p>
  
  <pre><code>http://ejobbox.com/wp-json/wp/v2/result/?
  
  http://ejobbox.com/wp-json/wp/v2/result/?per_page=10
  </code></pre>
  
  <p><strong>and also with</strong></p>
  
  <pre><code>http://ejobbox.com/wp-json/wp/v2/posts/?post_type=result
  </code></pre>
  
  <p>But I am not able to get data using custom Post type.</p>
  
  <p><strong>I have also added this into my custom post type</strong>   </p>
  
  <pre><code>'show_in_rest'=&gt; true,
  'rest_base'          =&gt; 'result',
  'rest_controller_class' =&gt; 'WP_REST_Posts_Controller',
  </code></pre>
  
  <p>Still I didn't get any result.</p>
  
  <p>Please, can you tell me what I am doing wrong here and what can I do to get data from my custom post type?
  Please Give me a suggestion for this.</p>
  
  <p><strong>My Function.php (Custom post type) code is Here:</strong></p>
  
  <pre><code>function codexres_custom_init() {
      $args = array(
        'public' =&gt; true,
        'label'  =&gt; 'Result'
      );
      register_post_type( 'result', $args );
  }
  add_action( 'init', 'codexres_custom_init' );
  
  
  function codex_result_init() {
      $labels = array(
          'name'               =&gt; _x( 'Result', 'post type general name', 'your-plugin-textdomain' ),
          'singular_name'      =&gt; _x( 'Result', 'post type singular name', 'your-plugin-textdomain' ),
          'menu_name'          =&gt; _x( 'Result', 'admin menu', 'your-plugin-textdomain' ),
          'name_admin_bar'     =&gt; _x( 'Result', 'add new on admin bar', 'your-plugin-textdomain' ),
          'add_new'            =&gt; _x( 'Add New', 'Result', 'your-plugin-textdomain' ),
          'add_new_item'       =&gt; __( 'Add New Result', 'your-plugin-textdomain' ),
          'new_item'           =&gt; __( 'New Result', 'your-plugin-textdomain' ),
  
          'edit_item'          =&gt; __( 'Edit Result', 'your-plugin-textdomain' ),
  
          'view_item'          =&gt; __( 'View Result', 'your-plugin-textdomain' ),
  
          'all_items'          =&gt; __( 'All Result', 'your-plugin-textdomain' ),
  
          'search_items'       =&gt; __( 'Search Result', 'your-plugin-textdomain' ),
  
          'parent_item_colon'  =&gt; __( 'Parent Result:', 'your-plugin-textdomain' ),
          'not_found'          =&gt; __( 'No Result found.', 'your-plugin-textdomain' ),
          'not_found_in_trash' =&gt; __( 'No Result found in Trash.', 'your-plugin-textdomain' )
      );
  
      $args = array(
          'labels'             =&gt; $labels,
          'description'        =&gt; __( 'Description.', 'your-plugin-textdomain' ),
          'public'             =&gt; true,
          'publicly_queryable' =&gt; true,
          'show_ui'            =&gt; true,
          'show_in_menu'       =&gt; true,
          'show_in_rest'       =&gt; true,
          'query_var'          =&gt; true,
          'menu_icon'          =&gt; 'dashicons-admin-users',
          'rewrite' =&gt; array( 'slug' =&gt; __('result', 'result')),
          'capability_type'    =&gt; 'post',
          'has_archive'        =&gt; true,
          'hierarchical'       =&gt; false,
          'rest_base'          =&gt; 'result',
          'rest_controller_class' =&gt; 'WP_REST_Posts_Controller',
          'menu_position'      =&gt; 5,
          'supports'           =&gt; array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
          'taxonomies'       =&gt; array('result','category', 'post_tag')
  
      );
  
      register_post_type( 'result', $args );
  }
  </code></pre>