36 Replies Latest reply on Jun 17, 2016 7:38 AM by div_gcet

    Calendar Event support via the REST v3 api?

    dvanderwilt

      I am looking to be able to interface with calendar events through the rest v3api but there does not appear to be any support in this area.

       

      Specifically i need to be able to get events to be able to read all the associated data - date/time/location etc..

      I would like to be able to get events by the respective contentID as well as per space + tag.

       

       

      Searching the documentation yeilds no results for "events".

      I have tried using the Content Service to pull content by and id ( examplesite.com/events/1000 )  but no results are returned via any method : document/post/etc...

       

      Is there a way to get event data through the api?

      If not - any plans to support this soon?

        • Re: Calendar Event support via the REST v3 api?

          You can access an event just like any other content by simply calling the contents service, like any other content type (examplesite.com/content/1234353), with the ID being the unique content ID for the event (not the eventID).  Hope this helps!

          1 person found this helpful
            • Re: Calendar Event support via the REST v3 api?
              dvanderwilt

              Okay, that's great - thanks.

              I didn't catch on to this as events are not explicitly listed as part of the supported content types list but they do work as a filter type ( /api/core/v3/contents?filter=type(event) ) and do return the data as you note.

              - My initial discovery attempts  included a few get requests to see if i could get any returned data to work with but didn't get anything back, for reasons that are clear now  in that the contentID  that appears on the public site url ( examplesite.com/events/1000 ), for example, doesn't actually have a contentID of 1000 but rather 1006 in this case.

               

              I find this curious as ( examplesite.com//api/core/v3/contents/1006 ) shows  "id" : "1000"

              however, the  self indicates 1006 as the ID and indeed, this is the ID i had to use to get the data  ( found only via filtering by type ) :   "self" : {  .... ,    "ref" : "examplesite.com/api/core/v3/contents/1006" }

               

              I find this discrepancy a bit confusing as there doesn't appear to be any way to get the unique content ID   without a string parse of the self:ref:value which is a bit risky and not something i'd rely on.

              Is there a more reliable way to get this unique ID that i'm not aware of?

               

              Thanks for the support here - excellent response time!

                • Re: Calendar Event support via the REST v3 api?

                  Yeah, the ID vs content ID can be a bit confusing.

                   

                  Each object in the Jive universe has its own unique ID, according to its type.  This is a vestige of the old Jive architecture, where each object has its own table, and its own set of unique IDs.  When you view an event in the Jive UI, such as examplesite.com/events/1000, the 1000 portion of the URL references the eventID value in the jiveEvent table.  As you might expect, you might also have a document or a discussion with an ID of 1000, since they are stored in their own tables, as well. 

                   

                  The V3 APIs work a bit differently, however, given the global nature of the contents service, which expects an identifier that is globally unique.  This requires that we keep a global registry of all objects, along with their globally-unique identifiers, which is stored in the jiveBrowseCnt table.  This identifier is the ID referenced in the contents service.  That said, the URI itself is what acts as the event's ID, so I would recommend storing the entire string as the event's identifier in your app.  While it's not a native long value, it is still a valid unique identifer, and the numerical portion isn't really used otherwise.  One benefit of the V3 services is that each object returns a list of references which provide the appropriate URIs for whatever operations you may need to perform against an event.

                   

                  Does this help?

                   

                  Thanks!

                  • Re: Calendar Event support via the REST v3 api?

                    I'm with you on the confusing part of the different ids. You need some Jive history to get that one.

                     

                    There are some handy conversion APIs available that allow you to convert between the old schema (events/1001) and the new schema (contents/1006) available here: jiveapps/utilities at master · jivesoftware/jiveapps · GitHub

                     

                    I haven't tested those with the events content type, though.

                • Re: Calendar Event support via the REST v3 api?
                  tillwestermann

                  I have a bit of the same problem. I would like to process a JSON formatted event as retrieved from the rest API.

                  In the API documentation, there is no entry for events. Could you make this public? This would be a great help to me.


                  Thanks!

                    • Re: Re: Calendar Event support via the REST v3 api?

                      We don't currently have any docs around the Events entity (it's technically a plugin and not part of the core platform), but here's an example of what you get:

                       

                      throw 'allowIllegalResourceCall is false.';
                      {
                        "location" : "asdf",
                        "type" : "event",
                        "attachments" : [ ],
                        "url" : "",
                        "startDate" : "2013-11-11T19:00:00.000+0000",
                        "email" : "",
                        "endDate" : "2013-11-11T20:00:00.000+0000",
                        "phone" : "",
                        "eventAccess" : "open",
                        "attendance" : {
                          "response" : 1,
                          "anonymous" : false,
                          "yesAttendees" : {
                            "count" : 1,
                            "users" : [ {
                              "name" : {
                                "givenName" : "Ryan",
                                "familyName" : "King",
                                "formatted" : "Ryan King"
                              },
                              ...
                            } ],
                            "moreAvailable" : false
                          },
                          "noAttendees" : {
                            "count" : 0,
                            "users" : [ ],
                            "moreAvailable" : false
                          },
                          "maybeAttendees" : {
                            "count" : 0,
                            "users" : [ ],
                            "moreAvailable" : false
                          },
                          "cannotAttendReason" : "Event has ended",
                          "canAttend" : false,
                          "capped" : false,
                          "containerAllowsAttendance" : true,
                          "canJoinGroupToContribute" : false,
                          "yesStatus" : 1,
                          "noStatus" : 2,
                          "maybeStatus" : 3,
                          "unansweredInvitees" : {
                            "count" : 0,
                            "users" : [ ],
                            "moreAvailable" : false
                          },
                          "ended" : true
                        },
                        "parent" : "https://community.jivesoftware.com/api/core/v3/places/710964",
                        "visibility" : "place",
                        "categories" : [ ],
                        "content" : {
                          "type" : "text/html",
                          "text" : "<body><!-- [DocumentBodyStart:a66d0c82-d1cc-40df-af36-c2b69e45cf38] --><div class=\"jive-rendered-content\"><p>adfd</p></div><!-- [DocumentBodyEnd:a66d0c82-d1cc-40df-af36-c2b69e45cf38] --></body>"
                        },
                        "status" : "published",
                        "subject" : "A Test Event",
                        "viewCount" : 5,
                        "author" : {
                          "name" : {
                            "givenName" : "Ryan",
                            "familyName" : "King",
                            "formatted" : "Ryan King"
                          },
                          ...
                        },
                        "published" : "2013-11-11T18:26:31.894+0000",
                        "replyCount" : 0,
                        "updated" : "2013-11-11T18:26:31.894+0000",
                        "visibleToExternalContributors" : false,
                        "tags" : [ ],
                        "followerCount" : 1,
                        "likeCount" : 0,
                        "resources" : {
                          "invitations" : {
                            "ref" : "https://community.jivesoftware.com/api/core/ext/event-type-plugin/v3/invites/event/717588",
                            "allowed" : [ "GET" ]
                          },
                          "yesAttendees" : {
                            "ref" : "https://community.jivesoftware.com/api/core/ext/event-type-plugin/v3/rsvp/717588/attendees/yes",
                            "allowed" : [ "GET" ]
                          },
                          "likes" : {
                            "ref" : "https://community.jivesoftware.com/api/core/v3/contents/717588/likes",
                            "allowed" : [ "GET" ]
                          },
                          "maybeAttendees" : {
                            "ref" : "https://community.jivesoftware.com/api/core/ext/event-type-plugin/v3/rsvp/717588/attendees/maybe",
                            "allowed" : [ "GET" ]
                          },
                          "self" : {
                            "ref" : "https://community.jivesoftware.com/api/core/v3/contents/717588",
                            "allowed" : [ "DELETE", "PUT", "GET" ]
                          },
                          "html" : {
                            "ref" : "https://community.jivesoftware.com/events/1852",
                            "allowed" : [ "GET" ]
                          },
                          "attachments" : {
                            "ref" : "https://community.jivesoftware.com/api/core/v3/attachments/contents/717588",
                            "allowed" : [ "GET", "POST" ]
                          },
                          "followingIn" : {
                            "ref" : "https://community.jivesoftware.com/api/core/v3/contents/717588/followingIn",
                            "allowed" : [ "GET" ]
                          },
                          "rsvps" : {
                            "ref" : "https://community.jivesoftware.com/api/core/ext/event-type-plugin/v3/rsvp/717588",
                            "allowed" : [ "GET" ]
                          },
                          "invitees" : {
                            "ref" : "https://community.jivesoftware.com/api/core/ext/event-type-plugin/v3/rsvp/717588/invitees",
                            "allowed" : [ "GET" ]
                          },
                          "comments" : {
                            "ref" : "https://community.jivesoftware.com/api/core/v3/contents/717588/comments",
                            "allowed" : [ "GET" ]
                          },
                          "noAttendees" : {
                            "ref" : "https://community.jivesoftware.com/api/core/ext/event-type-plugin/v3/rsvp/717588/attendees/no",
                            "allowed" : [ "GET" ]
                          }
                        },
                        "id" : "1852"
                      }
                      

                       

                      Hope this helps!

                    • Re: Calendar Event support via the REST v3 api?
                      clduvall

                      I've been accessing events from the API without any issue, but I am having a little trouble finding the list of organizers/contacts.  This will be an important piece of information for me to pull, so if there is anyone who knows how to extract this from the event plugin, I'd be very grateful.

                      • Re: Calendar Event support via the REST v3 api?
                        james.dellow

                        There appears to be two ways to create an event, first with an ISO 8601 Date/Time string:

                          "startDate": "2016-03-27T09:00:00.000+1000",
                          "endDate": "2016-03-28T17:00:00.000+1000"
                        

                         

                        And the other with a date and time:

                          "startDate": "03/27/2016",
                          "startTime": "9:00 AM",
                          "endDate": "03/28/2016",
                          "endTime": "5:00 PM"
                        

                         

                        But can anyone confirm how locale affects the creation of events using the date and time method?

                         

                        It would appear that you need to know the user's local preference else the date format gets rejected (i.e. in Australia 03/27/2016 is the 3rd day of the 27th month not the 27th day of March). However is there any hierarchy to how different locales at a system, space and in the user preference interact?

                        • If the user has no locale, does it take the system locale? However, "english: en" appears to be dd/mm/yyyy not Mmm d, yyyy (as shown in the admin console)
                        • Does the space locale where the event is being created have any impact? Or does the user preference override this?

                         

                        BTW I'm assuming if an ISO 8601 Date/Time string is used then the locale setting doesn't come into effect.

                         

                        Finally, is there any other way to create an event without knowing the user's timezone or local preferences?

                        • Re: Calendar Event support via the REST v3 api?
                          div_gcet

                          Hi everyone,

                           

                          Can we filter out the events based on start or end date ?

                           

                          -Divya