Title: Wrong REST API path accessed on Multisite
Last modified: November 30, 2020

---

# Wrong REST API path accessed on Multisite

 *  Resolved [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/)
 * My dev site is WordPress Multisite.
    register_rest_route() correctly registers
   example.com/site-name/wp-json/find-my-blocks/blocks but the find-my-blocks.js
   script looks for /wp-json/find-my-blocks/blocks
 * If I access example.com/site-name/wp-json/find-my-blocks/blocks I see the returned
   JSON.
 * Could wp_localize_script be used to pass the site_url to the script?
    I’m happy
   to help test any changes.

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

 *  Plugin Author [edeesims](https://wordpress.org/support/users/edeesims/)
 * (@edeesims)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-13727567)
 * Hey [@daymobrew](https://wordpress.org/support/users/daymobrew/),
 * I have never tested this with multisite. I will be working on a couple of other
   things this week, but will add this in hopefully in the next couple of weeks
 *  Plugin Author [edeesims](https://wordpress.org/support/users/edeesims/)
 * (@edeesims)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14219252)
 * [@daymobrew](https://wordpress.org/support/users/daymobrew/) I know I’m a little
   late on this, but a version just released that may have fixed this issue.
 *  Thread Starter [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14219566)
 * Thanks.
    I saw the changelog for 3.2.0 mention the site_url. I’ll give it a try
   and get back to you.
 *  Thread Starter [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14227656)
 * It didn’t work because of too many slashes in the REST url.
    I got a 404 for 
   the query: [https://www.example.com/block-demos/wp-json///find-my-blocks/blocks](https://www.example.com/block-demos/wp-json///find-my-blocks/blocks)
 * Note the 3 forward slashes after wp-json.
 * The localized settings have site_url:
    “site_url”:”https:\/\/www.example.com\/
   blocks-demos\/wp-json\/”
 * I removed some of the slashes in the js code. Here is the diff of what worked
   for me:
 *     ```
       --- find-my-blocks.orig.js	2021-03-22 17:34:04.000000000 +0000
       +++ find-my-blocks.js	2021-03-24 10:18:44.000870300 +0000
       @@ -34537,10 +34537,10 @@
              setBlocks = _react_1$useState2[1];
   
          react_1.useLayoutEffect(function () {
       -    var fetchUrl = "/find-my-blocks/blocks";
       +    var fetchUrl = "find-my-blocks/blocks";
   
            if (find_my_blocks_globals.site_url) {
       -      fetchUrl = "".concat(find_my_blocks_globals.site_url, "/").concat(fetchUrl);
       +      fetchUrl = "".concat(find_my_blocks_globals.site_url, fetchUrl);
            }
   
            fetch(fetchUrl).then(function (res) {
       ```
   
 *  Plugin Author [edeesims](https://wordpress.org/support/users/edeesims/)
 * (@edeesims)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14251287)
 * Hey [@daymobrew](https://wordpress.org/support/users/daymobrew/)
 * I have updated this in `3.3.2`. Can you please try again 🤞
 *  Thread Starter [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [5 years, 2 months ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14252636)
 * 3.3.2 works on my multisite installation. Brilliant. Thanks.
 *  Plugin Author [edeesims](https://wordpress.org/support/users/edeesims/)
 * (@edeesims)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14261643)
 * Great to hear!!

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

The topic ‘Wrong REST API path accessed on Multisite’ is closed to new replies.

 * ![](https://ps.w.org/find-my-blocks/assets/icon.svg?rev=2297395)
 * [Find My Blocks - Locate blocks on your site](https://wordpress.org/plugins/find-my-blocks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/find-my-blocks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/find-my-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/find-my-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/find-my-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/find-my-blocks/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [edeesims](https://wordpress.org/support/users/edeesims/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/wrong-rest-api-path-accessed-on-multisite/#post-14261643)
 * Status: resolved