API Reference

Collections.createCollection

This method creates a collection in a vhost. Pass the application Id and the array $collectionInfo in order to create the new collection. The collection can be one of two types: Manual (type 1) or Saved Search (type 2). For the Manual collection, the $collectionInfo parameters to pass are name, type, and description. For the Saved Search collection, the $collectionInfo parameters to pass are: name, type, description, sort, sortdir, channel, groupid, includeChildGroups, assignmentid, eventid, filetype, moderation, and limit.

Please note: You can only set one of the following: groupid, eventid or assignmentid; otherwise an error will result.

Syntax

Either collections.createCollection ( array collectionInfo, int vhost )

Arguments

NameTypeRequiredDefault valueDescription
collectionInfoarrayRequirednoneThe data to set for the new collection. Please view the Parameters table below for the keys and allowed values for $collectionInfo.
vhostintRequirednoneThe application ID that the collection belongs to.

Parameters: collectionInfo

The parameters that can be passed in the collectionInfo array.

NameTypeDescriptionPossible Values
nameSTRING(Required) The name of the collection. It can not be a duplicate of another collection that exists in the application.String
typeINT (Required) The collection type: 1 (Manual) or 2 (Saved Search). The remainder of the parameters are not needed for Manual Collections1, 2
descriptionSTRING(Optional) A description of the collection.a string
sortSTRING(Optional) The sort field for the media in the collection.upload, hits, commentcount, rating, votecount
sortdirSTRING(Optional) Sets the direction of the sort field.ASC, DESC
channelINT (Optional) The channel to filter the media by.an integer
groupidINT (Optional) Filter the media by showing media only in this group (the parent-group).
Use this parameter with the 'includeChildGroups' parameter which allows you to view the media from child-groups of the groupid, making it the parent-group.

Please note: You can only set one of the following: groupid, eventid or assignmentid.
an integer
assignmentidINT (Optional) Filters the media by showing media only in this assignment.

Please note: You can only set one of the following: groupid, eventid or assignmentid.
an integer
eventidINT (Optional) Filters the media by showing media only in this event.

Please note: You can only set one of the following: groupid, eventid or assignmentid.
an integer
includeChildGroupsSTRING(Optional) Filters the collection by showing media in child-groups with this moderation.
Use the following:
'false' to include no results from children of the parent-group
'accepted' to include media that are in approved child-groups
'notdenied' to include media that are in child-groups that are not denied
'denied' to include media that are in child-groups that are denied
'all' to include media that are from all child-groups.

Note Bene: The moderation status set in this parameter pertains only to the child-groups and does not affect the moderation status of the parent-group. The moderation status of the parent-group is irrelevant since the parent-group is determined by the groupid value/dropdown.
false, accepted, notdenied, denied, all
filetypeINT (Optional) Filters the media by showing media only with this filetype.
Use the following:
0 for All filetypes
1 for Images only
2 for Videos only
3 for Audio files only
4 for Text files only
0, 1, 2, 3, 4
moderationINT (Optional) Filters the media by showing media only with this moderation.
Use the following:
-1 for All moderation statuses
0 for media that with moderation status Pending
1 for media that with moderation status Approved
2 for media that with moderation status Denied
3 for media that with moderation status Not Denied
-1, 0, 1, 2, 3
limitINT (Optional) Sets the number of media to be shown.an integer: 0 to 500

Response

The response for the successful creation of a collection.

NameTypeDescriptionDefault Values
resultINTUpon success the response will be the id of the new collection.(Integer) success, error message (String)

Sample Response

Code examples

0 comments

Be the first to comment on createCollection.

Add a Comment

  • captcha