Title: Get JSON Events List
Last modified: August 31, 2016

---

# Get JSON Events List

 *  Resolved [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/)
 * Hi,
 * I bought a mobile App Template from MyAppTemplate to build an app from my wordpress
   site (with EM plugin).
 * Android app receive events list surfing on a link and using JSON:
    you can see
   author example from
 * [http://www.myapptemplates.com/events/api/getEvents](http://www.myapptemplates.com/events/api/getEvents)
 * With this link you visualize JSON events list example.
 * How did the author do to link events page to API?
    I asked to him, but he didn’t
   answer…
 * There’s some that can help me to get JSON EVENTS LIST?
 * Thank you
 * [https://wordpress.org/plugins/events-manager/](https://wordpress.org/plugins/events-manager/)

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

 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030900)
 * I am not part of support team…
 * But do have a little experience pulling data from other JSON’s.
 * Putting my own JSON out is something I have looked at…
    you might try reading…
 * [http://www.htmlgoodies.com/beyond/javascript/provide-a-json-feed-from-your-wordpress-site-using-the-json-api-plugin.html](http://www.htmlgoodies.com/beyond/javascript/provide-a-json-feed-from-your-wordpress-site-using-the-json-api-plugin.html)
 * Which I believe implies you need a plugin to generate the JSON..
 * [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)
 * Would love to hear how it works out, please keep us informed.
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030901)
 * WARNING !!!!!
    [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)
   I just did a test on my local development machine !!! I am running WP 4.3.1..
   I GET.. `Fatal error: Call to undefined function get_rest_url() in C:\Abyss Web
   Server\htdocs\wordpress\wp-content\plugins\rest-api\extras.php on line 24`
 * see this post !
    [https://wordpress.org/support/topic/undefined-function-11?replies=4](https://wordpress.org/support/topic/undefined-function-11?replies=4)
 * I tried this on my the same machine..
    [https://wordpress.org/plugins/json-api/](https://wordpress.org/plugins/json-api/)
   And it works… but does not appear to show Events ! The plugin may need to be 
   configured for “custom” posts.
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030905)
 * OK ! I have success… you owe me a special Italian Beer !
 * see this post..
    [https://wordpress.org/support/topic/end-point-for-custom-post-type-in-v2?replies=13](https://wordpress.org/support/topic/end-point-for-custom-post-type-in-v2?replies=13)
 * Particularly…
    ‘show_in_rest’ => true,
 * Needs to be added when a Custom Post Type is registered..
    It looks like Events
   Manager is not doing this at this time..
 * On my local development machine.. on a test site using WP 4.4
    and this plugin…
   [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)
   which is Version 2 needs WP 4.4
 * Thusly.. ‘show_in_rest’ => true, needs to be added.
 * What I did…
    In the file… em-posts.php
 * Search for the lines that have…
    ‘has_archive’ => get_option(‘dbem_cp_locations_has_archive’,
   false) == true,
 * and put in after that line…
    ‘show_in_rest’ => true,
 * And it should work..
    You call up the JSON.. with a link like this… yourwebsite.
   com/wordpress/wp-json/wp/v2/event
 * You can paste your JSON file into a website like this to see it better…
    [http://jsonlint.com/](http://jsonlint.com/)
   or one of the many others available..
 * **
    CAUTION !!!! I am doing all this on my Local Development Machine using WP
   4.4x
 * **ALWAYS BACK UP YOUR FILES AND DATABASES.. and know how to FTP to your website**
 * Pretty cool stuff and hope you have success !
    I’ve been up since 2am.. and I
   am going to have a cheap American beer !
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030910)
 * Slight error in above post…
    Search for the lines that begin with Search for 
   the lines **that have… ‘has_archive’
 * and put in after that line…
    ‘show_in_rest’ => true,
 * The previous notation was to specific and you will miss some of the
    ‘has_archive’
   lines..
 * I think there were three of them.
 *  Thread Starter [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030934)
 * hi robswaimea,
    I have no words to explain how you are kind for all these answer:
   really, really, really thanks 🙂
 * I did all you explain:
    1) install plugin [https://wordpress.org/plugins/rest-api/](https://wordpress.org/plugins/rest-api/)
   and add lines ‘show_in_rest’ => true in em-posts.php..
 * this retrive me a JSON “[https://www.MYSITE.it/wp-json/wp/v2/posts&#8221](https://www.MYSITE.it/wp-json/wp/v2/posts&#8221);
   but “[https://www.MYSITE.it/wp-json/wp/v2/event&#8221](https://www.MYSITE.it/wp-json/wp/v2/event&#8221);
   not.
 * I have this message: {“code”:”rest_no_route”,”message”:”Nessun percorso fornisce
   una corrispondenza tra l’URL e le modalità di richiesta”,”data”:{“status”:404}}
   
   There’s no correspondence between url and modality request.
 * What could be the problem? thank you again 🙂
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030940)
 * `{"code":"rest_no_route","message":"Nessun percorso fornisce una corrispondenza
   tra l'URL e le modalità di richiesta","data":{"status":404}}`
 * You need to check if “Events” is even being produced..
 * You said “posts” works ? Yes..
 * What you need to do is “see” if “Events” is actually created…
 * Try..
    mywordpresswebsite/wp-json/wp/v2/types
 * When you get the JSON.. I like to put it in a viewer like..
    [http://jsonlint.com/](http://jsonlint.com/)
 * Just makes it easier to read…
 * That should output all the available JSONS
    ie Posts.. Pages…Attachment,
 * And thus you **should also** see…
    The same for Events, Locations, Event-recurring…
   just like Post, Pages, Attachments…. Looks something like this…
 *     ```
       "event": {
       		"description": "Display events on your blog.",
       		"hierarchical": false,
       		"name": "Events",
       		"slug": "event",
       etc, etc, etc, etc....
       ```
   
 * I am new to Output JSON… my experience is from “pulling” JSON.
 * Hope you get it worked out..
 * But if you get something for Posts.. then it should work for Events.
 *  Thread Starter [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7030999)
 * OMG It works, really really thanks 🙂
 * This code works for me:
 * [http://www.dayroma.it/wp-json/wp/v2/event](http://www.dayroma.it/wp-json/wp/v2/event)
 * Now that we are JSON Friend, I’d like to ask you: can you help to add new routes
   to REST API?
 * I tried to follow the guide, but it doesn’t work this:
 *     ```
       function my_awesome_func( $data ) {
           $posts = get_posts( array(
               'author' => $data['id'],
           ) );
   
           if ( empty( $posts ) ) {
               return null;
           }
   
           return $posts[0]->post_title;
       }
   
       <?php
       add_action( 'rest_api_init', function () {
           register_rest_route( 'wp-json/wp/v2/', '/author/(?P<id>\d+)', array(
               'methods' => 'GET',
               'callback' => 'my_awesome_func',
           ) );
       } );
       ```
   
 * I put this code to functions.php in my child theme, Is it wrong?
 * I would like to get events filtered by date (today, tomorrow, or other), can 
   you help me to understand the way?
 * YOU ARE SO KIND 🙂
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7031005)
 * `Now that we are JSON Friend`
 * You haven’t even bought me a beer yet !
    Just kidding… Glad you got it worked
   out !
 * I looked at your main site.. and it is beautiful !
    We are both doing entertainment,
   music, festivals.. that’s cool !
 * My brain is all mushy right now.. and all scrambled as I was working hard on 
   some other JSON and XML stuff..
    I can hardly see straight 🙂
 * As to your direct question.. I really can’t make any knowledge of it…
    It looks
   like it pertains more to the the Rest Api Plugin..
 * I am not very familiar with WordPress and Output API (JSON)…
    So pulling it back
   in… and making it work I don’t know.
 * Everything I do is pulling in API JSON, converting it to XML…
    And thusly… my
   inexperience with your project.
 * `I tried to follow the guide, but it doesn't work this:.......`
 * BUT…
    I’d look at how you write these lines… `'author' => $data['id'],` and..`
   return $posts[0]->post_title;`
 * those appear to be your “filters”… I would try and research info on that.
 * I am not sure this will help… but looking at the “structure” of you API JSON 
   might give you a clue…
 * So take your your [http://www.dayroma.it/wp-json/wp/v2/event](http://www.dayroma.it/wp-json/wp/v2/event)
   
   and paste it into [http://codebeautify.org/jsonviewer](http://codebeautify.org/jsonviewer)
   In the middle of the page use the button “JSON to XML” to convert it to XML….
 * Maybe this will give you ideas with…
 *     ```
       function my_awesome_func( $data ) {
           $posts = get_posts( array(
               'author' => $data['id'],
       ```
   
 * And if you do resolve the issue it would be wonderful if you shared your knowledge.
 * Have a great a weekend !
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7031006)
 * If you are saying the code you put in above…
    “Broke” your website…
 * Take out the line…
 * `<?php`
 *  [Robswaimea](https://wordpress.org/support/users/robswaimea/)
 * (@robswaimea)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7031007)
 * Honestly… at this point.. I think you are going to get some other help.
 * While I did some reading.. and it looks like you may have to “add” custom filters…
   
   I don’t know anymore on this project.
 * Good luck hope you get it worked out !
 *  Thread Starter [fersamp](https://wordpress.org/support/users/fersamp/)
 * (@fersamp)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7031015)
 * Very kind as usual, how can I buy you a beer? 🙂
 * I really thank you for your time spent for me.
    As soon as I can fix my code 
   problem, I’ll be happy to write you, either here or directly by email if you 
   want, you are very nice, see you 😉

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

 The topic ‘Get JSON Events List’ is closed to new replies.

 * ![](https://ps.w.org/events-manager/assets/icon-256x256.gif?rev=3711454)
 * [Events Manager - Calendar, Bookings, Tickets, Appointments and more!](https://wordpress.org/plugins/events-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/events-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/events-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/events-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/events-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/events-manager/reviews/)

 * 11 replies
 * 2 participants
 * Last reply from: [fersamp](https://wordpress.org/support/users/fersamp/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/get-json-events-list/#post-7031015)
 * Status: resolved