• Resolved koulouridis

    (@koulouridis)


    Hey, so I’m trying to create events through your API.

    I’m having issues trying to pass values in _EventStartDate and _EventEndDate, these variables are critical for the event to be able to show up.

    Without those values, the event does not show up and displays a 404 error.

    So, any help with the following:

    $data = [
        "title" => $json_resp[0]->subject,
        "content" => $json_resp[0]->subject,
        "excerpt" => $json_resp[0]->shortDescription,
            "_EventStartDate"  => $json_resp[0]->startDate, //2021-12-15T11:00:00
            "_EventEndDate" => $json_resp[0]->endDate, //2021-12-15T14:00:00
        "status" => "publish",
        "featured_media" => 30,
    ];

    The two date values, do not get passed, so the event is being created with all the values that I’m passing except the Start/End values.

    *If I add some dates manually, the event is showing up fine.

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Support masoodak

    (@masoodak)

    Hi @koulouridis,

    Thanks for reaching out!

    Would you be so kind as to let me know the name of the theme you are currently using on your site? Also, if possible, do share your system information with us,

    https://theeventscalendar.com/knowledgebase/k/sharing-your-system-information/

    Kind regards,
    Masood

    Plugin Support Abz

    (@abzlevelup)

    Hi @koulouridis, thanks for providing more information here. Also please update your response here and remove the system information. I already shared this with the team and I’d get back to you when I know more.

    Have a great day.

    Best,
    Abz

    Thread Starter koulouridis

    (@koulouridis)

    Hey Abz, thank you for replying but, I can’t seem to find how to remove my reply, please help!

    Thread Starter koulouridis

    (@koulouridis)

    If my information cannot be deleted, please contact an administrator to edit/delete my reply!

    Plugin Support Abz

    (@abzlevelup)

    Hi @koulouridis, no worries with the sys info here. We’d get back to you as soon as I hear from the team.

    Best,
    Abz

    Thread Starter koulouridis

    (@koulouridis)

    Okay, meaning that you will handle it?

    I’m not feeling comfortable having the linuxserver.gr etc, etc part public, is there something we can do?

    Plugin Support Abz

    (@abzlevelup)

    Hi @koulouridis, yes I would check with our admin forum if it is something we can do. I’d get back to you as soon as I hear from them.

    Best,
    Abz

    Plugin Support Abz

    (@abzlevelup)

    Hi @koulouridis, in regard to your ticket here. I reached out to one of our devs saying:

    There is no documented event creation in the API docs, just updating. However, the API uses start_date and end_date for those values, rather than the meta keys, would be good to try this. https://theeventscalendar.com/knowledgebase/k/introduction-to-the-events-calendar-rest-api/

    Let us know if that will do for what you’re trying to accomplish here.

    Best,
    Abz

    Thread Starter koulouridis

    (@koulouridis)

    Hey, thank you for spending time replying to my question!

    So if there is no document about event creation through your API, is there a chance for me to ask you some questions about date and time?

    Date been a real hassle for me… I mean, if I exclude the date from my code, I can create events no problem with your API.

    But by excluding the date + time, much information will be left out…

    If it’s okay, my questions are:

    1)If I wanted to update an event date through your API, what would be the correct JSON for doing that, is it possible I get an example?

    2)What are the required fields for a date to be updated successfully?

    3)Is there a possibility, the date+time fields giving me trouble because of my WordPress settings?

    4)You mentioned start_date and end_date, so does that include also time? (this question is an extension of 1). I mean, “2021-12-15 11:00:00” that is what your API returns at start_date / end_date, so what is the correct string to send if I wanted to update my event?

    Plugin Support Abz

    (@abzlevelup)

    Hello @koulouridis, apologies for the delay in my reply here. I needed some confirmation from one of our devs.

    1)If I wanted to update an event date through your API, what would be the correct JSON for doing that, is it possible I get an example?

    See the article here about Swagger Docs:
    https://theeventscalendar.com/knowledgebase/k/introduction-to-the-events-calendar-rest-api/

    The article includes all the ways you can use the API and JSON format for it. Moreover, you can enter the data for the fields you want to change and it will show you an example JSON.

    2)What are the required fields for a date to be updated successfully?

    The only required field for a successful update would be the event_id. You could update anything that you wanted to change.

    3)Is there a possibility, the date+time fields giving me trouble because of my WordPress settings?

    Yes, it could. You can pass the timezone to the API to set the event timezone. You probably should if you are setting dates/times to be safe.

    4)You mentioned start_date and end_date, so does that include also time? (this question is an extension of 1). I mean, “2021-12-15 11:00:00” that is what your API returns at start_date / end_date, so what is the correct string to send if I wanted to update my event?

    Yes, start_date and end_date include time — the same format as what they give will work. Any string you would give to PHP’s date() should work.

    Let me know if this helps.

    Best,
    Abz

    Thread Starter koulouridis

    (@koulouridis)

    Hey Abz,

    thank you once more for the elaborate reply!

    I will once again check for a solution with what you gave me!

    Also, I looked around a little in swagger and I found that the POST – create event schema does not accept start_date and end_date, or at least from what I understood. Am I correct?

    Could that also may be the case that I can’t POST start_date and end_date?

    Plugin Support Abz

    (@abzlevelup)

    Hello @koulouridis, no worries. We’re here to help.

    Is there an error on your end when you do the POST? I’m curious about your payload and format as well. Could you share the payload you’re posting?

    Looking forward to hearing from you.

    Best,
    Abz

    Thread Starter koulouridis

    (@koulouridis)

    I’m using PHP curl to post the following at this URL:
    https://my-wordpress.com/wp-json/wp/v2/tribe_events

    First payload attempt:
    https://prnt.sc/whYy3xhVOKSp

    Second payload attempt:
    https://prnt.sc/eHgkc3rb35yd

    Both of them created an event with all the above shown values, except the start and end date. (and obviously also except the duration, timezone etc. on the second attempt)

    My WordPress Date Settings are the following:
    https://prnt.sc/XJSIAYFAcJxK

    FYI, the response I’m getting is 200, but it feels like it’s rejecting the keys and not the values of the start/end date fields.

    Plugin Support Abz

    (@abzlevelup)

    Hello @koulouridis, thanks for providing more information and the payload here.

    I was able to insert it on my test, but perhaps there’s another issue, or missed out on a setting here — worth checking. I’d reach out to one of our devs and see what’s up.

    I’d get back to you as soon as I hear from him. Also please note that this is free support, I’d be trying my best to help you out but it would take some time as our devs have different prios at the moment.

    Appreciate your patience. Have a great day.

    Abz

    Thread Starter koulouridis

    (@koulouridis)

    No, I thank you for getting back to me after such a long request!

    If you need more of my settings / code, feel free to ask

    I’ll wait for your reply! Though, I’m curious, why isn’t there a POST documentation?

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Create events with API’ is closed to new replies.