Title: [Plugin: JSON API] Querying on multi-site instance
Last modified: August 20, 2016

---

# [Plugin: JSON API] Querying on multi-site instance

 *  [Lounge9](https://wordpress.org/support/users/lounge9/)
 * (@lounge9)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-json-api-querying-on-multi-site-instance/)
 * How can I get the JSON API to work across a multisite instance?
 * I can only get results when I query with a specific post name, like:
    ?json=1&
   p=314
 * URLs that use the API methods, like this: /api/get_post/?id=314
    return this:{“
   status”:”error”,”error”:”Not found.”}
 * Any help would be greatly appreciated.
 * Thanks,
    DouG

Viewing 1 replies (of 1 total)

 *  [pro120](https://wordpress.org/support/users/pro120/)
 * (@pro120)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-json-api-querying-on-multi-site-instance/#post-2333475)
 * I recently needed a solution for this. Here is my fix.
 * I added the following lines just below the included files of json-api.php
 *     ```
       if( isset($_GET['siteid']) ) {
       	global $site_id;
       	$site_id = $_GET['site_id'];
       	switch_to_blog($site_id);
       }
       ```
   
 * You would just include the site id in your query string like so
    [http://example.com/api/?siteid=3&id=43&post_type=attachment](http://example.com/api/?siteid=3&id=43&post_type=attachment)
 * This was using wordpress 3.2.1
 * I don’t think the global $site_id declaration was 100% necessary but shouldn’t
   hurt.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: JSON API] Querying on multi-site instance’ is closed to new 
replies.

 * 1 reply
 * 2 participants
 * Last reply from: [pro120](https://wordpress.org/support/users/pro120/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-json-api-querying-on-multi-site-instance/#post-2333475)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
