Event Cloud makes it easy to manipulate, narrow down, and sort through data with OData Query Parameters.
For more information on OData Query Parameters, check out this article from OData about Querying Data.
This article will go over a few common scenarios for these query options.
Query Options
$expand
This allows you to expand a data field.
If you're seeing a value of NULL or an empty array, but you expect there should be data, try "expanding" that value.
Example:
GET https://ngapi.hubb.me/api/v1/[eventId]/Sessions?$expand=SessionType,TimeSlot,Room,Track
This will expand the SessionType, TimeSlot, Room, and Track node.
These fields may show as NULL until they are "expanded."
GET https://ngapi.hubb.me/api/v1/2364/Users?$expand=UserCustomRoles
This will expand the UserCustomRoles node.
This field may display as an empty array until "expanded."
$filter
This allows you to filter the data to only what you want to see.
Only items where the expression evaluates to TRUE are included in the response.
Example:
GET https://ngapi.hubb.me/api/v1/[eventId]/Users?$filter=Id eq 554088
This will return information for one user. The User Id must EQUAL 554088.
GET https://ngapi.hubb.me/api/v1/[eventId]/Users?$filter=Company ne "HP"
This will return all users whose Company does NOT EQUAL "HP".
$select
This can be used to limit the data fields with are returned with a call. You can select only certain fields to come through.
Example:
GET https://ngapi.hubb.me/api/v1/[eventId]/Sessions?$select=SessionId,SessionType,Speakers
This will return only a subset of the available data. Instead of returning all the values for Sessions, this will only return three values (SessionId, SessionType, Speakers).
GET https://ngapi.hubb.me/api/v1/[eventId]/MyConference?$select=FirstName,LastName,Type
This will return only three values from the MyConference endpoint, as opposed to all the data.
$orderby
This will allow you to order the data by a certain parameter.
Example:
GET https://ngapi.hubb.me/api/v1/[eventId]/Sessions?$orderby=Id
This will return all sessions in numerical order based on the Session ID.
$top
This will allow you to limit the data that gets returned to a specific number.
Example:
GET https://ngapi.hubb.me/api/v1/[eventId]/Sessions?$top=10
This will return the top 10 sessions.
GET https://ngapi.hubb.me/api/v1/[eventId]/Sessions?$top=100
This will return the top 100 sessions.
Lamda Operators
This allows you to use "any" and "all" operators that evaluate a Boolean expression on a collection.
Example:
GET https://ngapi.hubb.me/api/v1/[eventId]/Sessions?$filter=PropertyValues/any(pv:pv/Value eq 'Fully Published')
This will return all sessions that have a custom field value of "Fully Published."
Comments
Please sign in to leave a comment.