JSON Rest API

Home Forums Calendar Products Events Calendar PRO JSON Rest API

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #245481
    Anthony D’Arco
    Participant

    Howdy, we have been playing around with the Rest API to see if we can’t get your information into our app. However, every time we try we seem to only be able to get a list of very general information. We were wondering if the Event Calendar actually works with the API, and if so, is there any documentation on how to get the EC info out of WordPress? I couldn’t find anything when I was using your search tool.

    Thank you,
    Anthony

    #245638
    Barry
    Member

    Hi Anthony,

    Can you confirm if you’re working through the API added by this plugin (or if you are using develop code for WordPress that hasn’t yet been released in stable form)?

    #245750
    Anthony D’Arco
    Participant

    Barry,

    I should have been more specific, yes, I am using that plugin.

    Thank you,
    Anthony

    #247901
    Barry
    Member

    OK – well we can’t really guarantee compatibility with other plugins (and haven’t taken any steps to specifically integrate with this one). Are you finding you can work with custom post types and taxonomies generally – ie, are the difficulties you are experiencing specific to The Events Calendar and its own set of post types?

    #247957
    Anthony D’Arco
    Participant

    I understand that, and I know this is planning on making it to core at some point. I am able to get into custom post types in general, however its not able to get at some of the more fine-tuned details that the EC has. When we are testing it, we can get it to display the events, but things like start and end times are not available. Does that make sense?

    Thank you,
    Anthony

    #248057
    Barry
    Member

    Yes, that makes sense.

    The start and end dates for events are actually just stored as post meta data (and a brief skim of their docs suggests post meta is covered, to some extent) – have you investigated working with post meta via this API generally and is it looking like there are specific “gotchas” with event post meta data, for some reason?

    #279616
    Anthony D’Arco
    Participant

    I apologize for the delay in response. I’ve been super busy/playing around with the rest API and getting the hang of it more and more. I’m not sure exactly what you meant by specific “gotchas,” but this is what I have so far.

    Basically, I have been converting wpquery arrays into query strings. When I test the following:
    http://hfca.staging.wpengine.com/wp-json/posts?type=hfca-teachers
    I get all the information from the post type hfca-teachers as expected, however, when I do the follow:
    http://hfca.staging.wpengine.com/wp-json/posts?type=tribe_events
    I get a 502 Bad Gateway. That would lead me to believe there is some sort of incompatibility, correct?

    I have done a lot of other tests, but these two query strings seem as though they would be the most helpful in figuring out what is going on.

    Thank you,
    Anthony

    #279690
    Anthony D’Arco
    Participant

    I apologize, I found something else out interesting:

    so, clearly its not everything in the ECP, for venues:
    http://hfca.staging.wpengine.com/wp-json/posts?type=tribe_venue
    it worked just fine (Still not showing the meta data, but that is the next step). Is it possible that I have too many events, or something of that nature?

    Thank you,
    Anthony

    #283255
    Barry
    Member

    http://hfca.staging.wpengine.com/wp-json/posts?type=tribe_events
    I get a 502 Bad Gateway. That would lead me to believe there is some sort of incompatibility, correct?

    I’m not sure, perhaps something else is conflicting – can you inspect the server error log and check for any pertinent errors … and does this occur in an otherwise default environment (with just the JSON API plugin, our core and PRO plugins and a default, unmodified WordPress theme such as Twenty Thirteen)?

    The structure of your URLs interests me – have you further customized things/changed the routing or have you extended the plugin with new controllers of your own? Forgetting the API base for the moment, shouldn’t the latter half of that URL you provided be:

    …/get-posts/?post_type=tribe_events

    It certainly works for me when I test it locally, but I’m basically just using an “out of the box” configuration which may not be identical to your own.

    Is it possible that I have too many events, or something of that nature?

    Not impossible, but if so might it be worth setting an additional count parameter in your URL query? Though, as it looks like this defaults to 10, I’m not sure why it would be a problem.

     

    #285757
    Anthony D’Arco
    Participant

    Alright, I think this just a lot more interesting. I couldn’t get the rest API to work at all with the default theme (I believe they may have it disabled, based on what I saw in the documentation). So, I setup a new testing environment using Genesis (because that is our base theme on the majority of our sites). It turns out it worked just fine AND it worked for events:
    http://testeditor.wpengine.com/wp-json/posts?type=tribe_events

    There were only two events and they both popped up no problem. So, I am going to reach out to WpEngine to see if they can shed some light on the 502 Error, however that doesn’t solve my second problem, the meta data does not seem to want to appear.

    (as a quick side note, I agree the URL structure is a bit off, but the docs say to do it that way, and when you get a response, it actually shows the URL I need, so I’m not creating that each time, it is something I copy and paste with each level I get deeper).

    Thank you,
    Anthony

    #285793
    Anthony D’Arco
    Participant

    One last little tidbit. I found the documentation (not a very intuitive place for this, but I found that to retrieve the meta for a post you do the following (so simple its stupid):
    http://testeditor.wpengine.com/wp-json/posts/470/meta

    But when that is put in I keep getting a 403 Forbidden Error. Thoughts?

    Thank you,
    Anthony

    #289526
    Barry
    Member

    So, I am going to reach out to WpEngine to see if they can shed some light on the 502 Error

    That’s a good idea, especially if it is only occurring in that environment (perhaps they can point you to an error log or otherwise help).

    I found that to retrieve the meta for a post you do the following (so simple its stupid):
    http://testeditor.wpengine.com/wp-json/posts/470/meta

    But when that is put in I keep getting a 403 Forbidden Error. Thoughts?

    I’m not sure, but I’d start by exploring if this is a general issue with the JSON API plugin (does it happen for regular posts with post meta data, or just events) and go from there. Perhaps it’s intentional where the user/agent is accessing the API without having authenticated?

     

     

     

    #701621
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

    #1354409
    Courtney
    Member

    Hey there

    Just posting a quick update that we’ve just launched The Events Calendar – Full REST Support. You can read the release notes at https://theeventscalendar.com/release-events-calendar-full-rest-support/.

    We also published a helpful guide: Introduction to The Events Calendar REST API https://theeventscalendar.com/knowledgebase/introduction-events-calendar-rest-api/ .

    We’re excited to provide this functionality for you.

    Thanks
    Courtney 🙂

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘JSON Rest API’ is closed to new replies.