Title: Documentation for REST API?
Last modified: July 3, 2022

---

# Documentation for REST API?

 *  Resolved [Optimizr](https://wordpress.org/support/users/william-greatman/)
 * (@william-greatman)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/)
 * Hi,
 * Thanks for the great plugin. I am trying to create mobile apps for my website
   and I need to show the slideshow on my app. In previous app, I am using `/wp-
   json/wp/v2/mtslides?_embed` and it is running fine.
 * But on new site, the route seems to be changed and I am getting following error
 * `{"code":"rest_no_route","message":"No route was found matching the URL and request
   method.","data":{"status":404}}`
 * According to other support threads, I think the routes are listed here `/wp-json/
   metaslider/v1/`. Correct me if I am wrong.
 * What I want for now is just to display single slideshow on my mobile apps. But
   every sub routes I entered required authentication because I got following message
   when I entered (for example) `/wp-json/metaslider/v1/slideshow/all`
 * `{"code":"rest_forbidden","message":"Sorry, you are not allowed to do that.","
   data":{"status":401}}`
 * I just want to show a slideshow that is publicly available on the web. Why do
   I need authorization to do so? Or am I in wrong direction or doing something 
   wrong? Please guide me or at least let me have the detailed documentation if 
   you have one.
 * Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [Arreane](https://wordpress.org/support/users/yanex/)
 * (@yanex)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15795024)
 * Hi,
 * May I know what versions of WordPress and MetaSlider you have on your old site
   compared to what version you are currently using now.
 *  Thread Starter [Optimizr](https://wordpress.org/support/users/william-greatman/)
 * (@william-greatman)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15800575)
 * Thank you for your reply. Surprisingly, both sites have the same latest versions.
 * WP » Version 6.0
    Meta Slider » Version 3.27.6
 *  [Arreane](https://wordpress.org/support/users/yanex/)
 * (@yanex)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15801978)
 * Hi,
 * I have informed by our team that there were no changes made in regards to our
   API.
 * It’s most-likely that there are other factors that might’ve cause the issue since
   you mentioned that the same version of WordPress and MetaSlider has been running
   fine on your other server.
 *  Thread Starter [Optimizr](https://wordpress.org/support/users/william-greatman/)
 * (@william-greatman)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15802167)
 * Even the server is the same for both sites. Just this endpoint
    `/wp-json/wp/
   v2/mtslides?_embed` isn’t working on new site. Could you please confirm if it
   is the right endpoint? If this should work, I would try with default theme and/
   or deactivating other plugins.
 *  [Arreane](https://wordpress.org/support/users/yanex/)
 * (@yanex)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15805476)
 * There are only two registered post types in MetaSlider (ml-slider and ml-slide)
 * So, you’d have to use the following routes.
    /wp-json/wp/v2/ml-slide /wp-json/
   wp/v2/ml-slider
 * But, before you can access the following routes, you’d have to modify the show_in_rest
   value to true. You can do this by adding the following code below to your functions.
   php.
 *     ```
       add_filter( 'register_post_type_args', 'customize_metaslider_post_type', 10, 2 );
       function customize_metaslider_post_type( $args, $post_type ) {
   
           if ( in_array($post_type, ['ml-slide', 'ml-slider'] ) ) {
               $args['show_in_rest'] = true;
           }
   
           return $args;
       }
       ```
   
 *  Thread Starter [Optimizr](https://wordpress.org/support/users/william-greatman/)
 * (@william-greatman)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15810776)
 * Thank you! This pointed me in the right direction. In my old working site, I 
   have this in my functions.php
 *     ```
       /**
        * Add REST API support to an already registered post type.
        */
       add_filter('register_post_type_args', 'metaslider_args', 10, 2);
   
       function metaslider_args($args, $post_type)
       {
   
       	if ('ml-slide' === $post_type) {
       		$args['show_in_rest'] = true;
   
       		// Optionally customize the rest_base or rest_controller_class
       		$args['rest_base']             = 'mtslides';
       		$args['rest_controller_class'] = 'WP_REST_Posts_Controller';
       	}
   
       	return $args;
       }
       ```
   
 * And now, I can use the same endpoint as my old working site.
 *  [Arreane](https://wordpress.org/support/users/yanex/)
 * (@yanex)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15815126)
 * That’s good news! Glad we are able to help.
 * I will mark this as resolved. Feel free to open a new issue in case you need 
   anything else.
    -  This reply was modified 3 years, 11 months ago by [Arreane](https://wordpress.org/support/users/yanex/).

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Documentation for REST API?’ is closed to new replies.

 * ![](https://ps.w.org/ml-slider/assets/icon.svg?rev=3523572)
 * [Slider, Gallery, and Carousel by MetaSlider - Image Slider, Video Slider](https://wordpress.org/plugins/ml-slider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ml-slider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ml-slider/)
 * [Active Topics](https://wordpress.org/support/plugin/ml-slider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ml-slider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ml-slider/reviews/)

## Tags

 * [api](https://wordpress.org/support/topic-tag/api/)
 * [rest](https://wordpress.org/support/topic-tag/rest/)

 * 7 replies
 * 2 participants
 * Last reply from: [Arreane](https://wordpress.org/support/users/yanex/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/documentation-for-rest-api/#post-15815126)
 * Status: resolved