API Reference

Events.getEvents

Returns a list of events for a specific vhost.

Pagination may be controlled via the "startPage" and "pageSize" parameters

The optional "sort" argument is a string that can be used to specify one field to sort the returned events by.The sort parameter can also include a sort direction ("ASC" or "DESC").

All events returned will have a last resort sort applied based on the unique event ID to ensure a consistent ordering of events even when the specified sort field is not unique. Example: sort="membercount DESC" - This will return a list of events with the events with the most members first. If multiple events have the same number of members then the ones with identical member counts will be ordered by ID equivalent to sort="membercount DESC, id".

To arrange the events or events in the same order as they appear in the tree within MediaFactory you must sort by "treeleft ASC". The fields supported for sorting are: membercount, id, created ,mediacount ,approvedmediacount ,notdeniedmediacount ,name, treeleft.

The various date filters are all parsed via the equivalent of PHP's strtotime function: http://php.net/manual/en/function.strtotime.php. The preferred form is YYYY-MM-DD HH:mm:ss


Syntax

array events.getEvents ( int vhost, int uid = NULL, string moderationStatus = 'accepted', array filters = array(), string sort = 'created DESC', int startPage = false, int pageSize = false, bool includeTotalCount = false, bool noLimit = false, bool childGroupCount = false )

Arguments

NameTypeRequiredDefault valueDescription
vhostintRequirednoneThe vhost ID that the event belongs to.
uidintOptionalNULLFilter by and only return events that the given user ID is a member of.
moderationStatusstringOptional'accepted'Filter the event list by the specified moderation status. The possible values are "accepted", "denied", "unmoderated", "moderated", "notdenied","all".
filtersarrayOptionalarray()See the list of possible filters for events.getEvents service below.
sortstringOptional'created DESC'Sets the sort field. Use the format fieldname ASC/DESC. Currently created, membercount, mediacount, id, approvedmediacount, notdeniedmediacount, name, startdate, enddate, and treeleft are supported. To retrieve the events in the same order they are in the event tree use "treeleft ASC".
startPageintOptionalfalseSets the startpage for the event list. This is used with pagination in conjunction with pageSize. The starting page index is 0 (the first page).
pageSizeintOptionalfalseSets the total number of items returned per page. This is used with pagination and in conjunction with startPage. The maximum number of events to include on each page by default is 100 and the maximum is 200.
includeTotalCountboolOptionalfalseIf "includeTotalCount" is "true" then the total number of matching events will be returned along with the events themselves. If it's "false" then the total count will not be returned. The default for includeTotalCount is false.
noLimitboolOptionalfalseYou may disable all pagination and limits on the number of events returned by setting the "noLimit" parameter to "true". This requires the events.getEventsNoLimit permission.
childGroupCountboolOptionalfalse If "childGroupCount" is "true" then the total number of child events for the parengGroupId will be returned. If it's "false" then the total count will not be returned. The default for childGroupCount is false.

Optional Filters

The optional "filters" parameter is an array that may contain the following keys and values.

NameTypeDescriptionDefaultPossible Values
creatorUserIDINTReturns only events created by the specified user ID. If the user ID specified is not the user that is currently logged in and is not the public user then a check is made for the "events.getEvents" permission.emptyINT
parentEventIDINTReturns only events whose parent is the event specified.INTINT
includeChildrenBOOLReturns all events who have parentEventID as their ancestor. May only be used in combination with the parentEventID filter.truefalse
searchQuerySTRINGA string that must exist in at least one of the following fields.emptyname, description, address, host, city
searchNameSTRINGA string that must exist in the name of the events returned.emptySTRING
searchDescriptionSTRINGA string that must exist in the description of the events returned.emptySTRING
custom1STRINGA string that must match the value of the custom1 field of the events returned.emptySTRING
mediaIDINTA media item that must be present within the events returned.emptyINT
endBeforeYYYY-MM-DD HH:MM:SSA date and time that the listed events must end before.emptyYYYY-MM-DD HH:MM:SS
endAfterYYYY-MM-DD HH:MM:SSA date and time that the listed events must end after.emptyYYYY-MM-DD HH:MM:SS

Response

The response items returned in a events.getEvents service call.

NameTypeDescriptionPossible Values
idINTThe ID of the event.INT
nameSTRINGThe name of the event.STRING
descriptionSTRINGA brief blurb about the event. History, purpose, location, ideas, awards, etc. The description is searchable.STRING
noteSTRINGSome text about the event. The note is not searchable.STRING
logoINTThe media ID that is used as the event logo.INT
publicUrlSTRINGThe url to access the event logo. The public url will log a hit against the media item when ever loaded. This would be best used on an event details page.STRING
thumbUrlSTRINGThe url to access the event logo. The thumb url will _NOT_ log a hit against the media item when loaded. This is best used in event galleries or plotting events on a map.STRING
urlSTRINGThe url of the event. This is used best if the event is for a company, an event with a unique url they wish to also direct traffic to.STRING
createdYYYY-MM-DD HH:MM:SSThe date the event was createdYYYY-MM-DD HH:mm:SS
createdByINTThe user ID of the user who created the event.INT
memberCountINTThe number of members in the eventINT
mediaCountINTThe number of media items in the event.INT
approvedMediaCountINTThe number of approved media items in the event.INT
notDeniedMediaCountINTThe number of not denied media items in the event.INT
geo_longitudeLNGThe longitude of the event. This would be specified by the creator of the event.NUMBER (-52.44)
geo_latitudeLATThe latitude of the event. This would be specified by the creator of the event.NUMBER (62.86)
moderationStatusSTRINGThe moderation status of the event which has just been created. By default if this is not passed the events moderationstatus will be unmoderated.accepted, denied, unmoderated, moderated, notdenied, all
parentEventINTThe ID of the parent event if the current event is a child.INT
addressSTRINGThe address of the event.STRING
citySTRINGThe city that the event is located in.INT
countrySTRINGThe country that the event is located in. This will be a 2-letter country code.STRING
stateSTRINGThis will be the state/province that the event is located in. It will be a 2-letter state/province code.STRING
postalcodeSTRINGA valid postal code to contact the event by.STRING
newMediaEmailTemplateIDINTThis is the ID of the email template that is sent out when a user uploads media into the event.INT
hostSTRINGThe name of the host who created the event or who is inchagre of the event.STRING
groupTypeINTThis specifies if the group is a group or an event. 1 represents a group and 2 represents an event.1/2
vhostINTThe vhost ID that the event belongs to.INT
otherARRAYAn associated array that is used to store any additional information about the event that does not fit in any previous fields. This field is _NOT_ searchable or filterable. This is equivelent to the metadata field for media.ARRAY
custom1STRINGA searchable and filterable field for any additional information that does not fit into any previous field.STRING
treeleftINTUsed internally for the sorting and ordering events.INT
treerightINTUsed internally for the sorting and ordering events.INT
emailSTRINGThe email address to use to allow users to email content to this email address and have it uploaded and entered into the event.STRING
totalCountINTIf the includeTotalCount argument is set to true the total count of events returned will be included in the response.INT
startDateYYYY-MM-DD HH:MM:SSThe start date of the event.YYYY-MM-DD HH:MM:SS
endDateYYYY-MM-DD HH:MM:SSThe end date of the event.YYYY-MM-DD HH:MM:SS

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/events/getEvents?eventId=[EVENT_ID]&includeTotalCount=true&filters[includeChildren]=true&filters[parentEventID]=[PARENT_EVENT_ID]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <item>
    <id>EVENT_ID</id>
    <name>EVENT_NAME</name>
    <description/>
    <note/>
    <logo>0</logo>
    <publicUrl/>
    <thumbUrl/>
    <url/>
    <created>2012-02-13 11:15:44</created>
    <createdBy>1</createdBy>
    <memberCount>0</memberCount>
    <mediaCount>0</mediaCount>
    <approvedMediaCount>0</approvedMediaCount>
    <notDeniedMediaCount>0</notDeniedMediaCount>
    <geo_longitude>0</geo_longitude>
    <geo_latitude>0</geo_latitude>
    <moderationStatus>unmoderated</moderationStatus>
    <parentGroup>0</parentGroup>
    <address/>
    <city/>
    <country/>
    <state/>
    <postalcode/>
    <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
    <host/>
    <groupType>2</groupType>
    <vhost>VHOST</vhost>
    <other/>
    <custom1/>
    <treeleft>65</treeleft>
    <treeright>66</treeright>
    <email>EVENT_CREATORS_EMAIL</email>
    <startDate/>
    <endDate/>
  </item>
  <item>
    <id>EVENT_ID</id>
    <name>EVENT_NAME</name>
    <description/>
    <note/>
    <logo>0</logo>
    <publicUrl/>
    <thumbUrl/>
    <url/>
    <created>2012-01-28 19:33:59</created>
    <createdBy>1</createdBy>
    <memberCount>0</memberCount>
    <mediaCount>1</mediaCount>
    <approvedMediaCount>0</approvedMediaCount>
    <notDeniedMediaCount>0</notDeniedMediaCount>
    <geo_longitude>0</geo_longitude>
    <geo_latitude>0</geo_latitude>
    <moderationStatus>accepted</moderationStatus>
    <parentGroup>0</parentGroup>
    <address/>
    <city/>
    <country/>
    <state/>
    <postalcode/>
    <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
    <host/>
    <groupType>2</groupType>
    <vhost>VHOST_ID</vhost>
    <other/>
    <custom1/>
    <treeleft>59</treeleft>
    <treeright>60</treeright>
    <email>EVENT_CREATORS_EMAIL</email>
    <startDate/>
    <endDate/>
  </item>
  <totalCount>2</totalCount>
</result>

Sample JSON Response
{
    "status": true,
    "result": {
        "0": {
            "id": "EVENT_ID",
            "name": "EVENT_NAME",
            "description": "",
            "note": "",
            "logo": "0",
            "publicUrl": "",
            "thumbUrl": "",
            "url": "",
            "created": "2012-02-13 11:15:44",
            "createdBy": "1",
            "memberCount": "0",
            "mediaCount": "0",
            "approvedMediaCount": "0",
            "notDeniedMediaCount": "0",
            "geo_longitude": "0",
            "geo_latitude": "0",
            "moderationStatus": "unmoderated",
            "parentGroup": "0",
            "address": "",
            "city": "",
            "country": "",
            "state": "",
            "postalcode": "",
            "newMediaEmailTemplateID": "0",
            "host": "",
            "groupType": "2",
            "vhost": "VHOST_ID",
            "other": [],
            "custom1": "",
            "treeleft": "65",
            "treeright": "66",
            "email": "EVENT_CREATORS_EMAIL",
            "startDate": null,
            "endDate": null
        },
        "1": {
            "id": "EVENT_ID",
            "name": "EVENT_NAME",
            "description": "",
            "note": "",
            "logo": "0",
            "publicUrl": "",
            "thumbUrl": "",
            "url": "",
            "created": "2012-01-28 19:33:59",
            "createdBy": "1",
            "memberCount": "0",
            "mediaCount": "1",
            "approvedMediaCount": "0",
            "notDeniedMediaCount": "0",
            "geo_longitude": "0",
            "geo_latitude": "0",
            "moderationStatus": "accepted",
            "parentGroup": "0",
            "address": "",
            "city": "",
            "country": "",
            "state": "",
            "postalcode": "",
            "newMediaEmailTemplateID": "0",
            "host": "",
            "groupType": "2",
            "vhost": "VHOST_ID",
            "other": [],
            "custom1": "",
            "treeleft": "59",
            "treeright": "60",
            "email": "EVENT_CREATORS_EMAIL",
            "startDate": null,
            "endDate": null
        },
        "totalCount": "2"
    }
}

Code examples

0 comments

Be the first to comment on getEvents.

Add a Comment

  • captcha