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|bool startPage = false, int|bool 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 by moderation status (accepted, denied, unmoderated, moderated, notdenied, all).
filtersarrayOptionalarray()
sortstringOptional'created DESC'Sets the sort field. Use format: fieldname ASC/DESC (default: "created DESC").
startPageint|boolOptionalfalseStarting page index for pagination (default: false, counts from 0).
pageSizeint|boolOptionalfalseItems returned per page, max 200 (default: false, default 100).
includeTotalCountboolOptionalfalseIf true, include total matching event count in response.
noLimitboolOptionalfalseIf true, disable pagination (requires events.getEventsNoLimit permission).
childGroupCountboolOptionalfalseIf true, include child event count for parentGroupId.

Optional Filters

The optional "filters" parameter is an array that may contain filter options.

NameTypeDescriptionDefaultPossible Values
creatorUserIDINTReturns only events created by the specified user ID.emptyINT
parentEventIDINTReturns only events whose parent is the event specified.INTINT
includeChildrenBOOLReturns all events who have parentEventID as their ancestor.truefalse
searchQuerySTRINGA string that must exist in name, description, address, host, or city.emptySTRING
searchNameSTRINGA string that must exist in the name of the events returned.emptySTRING
searchDescriptionSTRINGA string that must exist in the description of events.emptySTRING
custom1STRINGA string that must match the custom1 field value.emptySTRING
mediaIDINTA media item that must be present within the events.emptyINT
endBeforeYYYY-MM-DD HH:MM:SSA date and time that events must end before.emptyYYYY-MM-DD HH:MM:SS
endAfterYYYY-MM-DD HH:MM:SSA date and time that 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.STRING
noteSTRINGSome text about the event (not searchable).STRING
logoINTThe media ID that is used as the event logo.INT
urlSTRINGThe url of the event.STRING
createdYYYY-MM-DD HH:MM:SSThe date the event was created.YYYY-MM-DD HH:mm:SS
createdByINTThe user ID of the user who created the event.INT
memberCountINTThe number of members in the event.INT
mediaCountINTThe number of media items in the event.INT
approvedMediaCountINTThe number of approved media items.INT
notDeniedMediaCountINTThe number of not denied media items.INT
geo_longitudeLNGThe longitude of the event.NUMBER (-52.44)
geo_latitudeLATThe latitude of the event.NUMBER (62.86)
moderationStatusSTRINGThe moderation status of the event.accepted, denied, unmoderated, moderated, notdenied, all
parentEventINTThe ID of the parent event.INT
addressSTRINGThe address of the event.STRING
citySTRINGThe city that the event is located in.STRING
countrySTRINGThe country (2-letter code).STRING
stateSTRINGThe state/province (2-letter code).STRING
postalcodeSTRINGA valid postal code.STRING
newMediaEmailTemplateIDINTID of email template for new media notifications.INT
hostSTRINGThe name of the host who created the event.STRING
groupTypeINT1 for group, 2 for event.1/2
vhostINTThe vhost ID that the event belongs to.INT
otherARRAYAdditional information (not searchable).ARRAY
custom1STRINGA searchable and filterable custom field.STRING
treeleftINTUsed internally for sorting and ordering events.INT
treerightINTUsed internally for sorting and ordering events.INT
emailSTRINGEmail address for uploading media to the event.STRING
totalCountINTTotal count if includeTotalCount is true.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