API Reference

Collections.getCollectionData

This method returns the collection info along with media in the collection based upon the collection ID requested. This method returns two arrays, "info" and "data". The "info" array holds the collection ID information where the "data" array holds a list of arrays for each media item in the collection.

Syntax

bool collections.getCollectionData ( int collection, int editMode = false, bool sane_metadata = false )

Arguments

NameTypeRequiredDefault valueDescription
collectionintRequirednoneThe ID of the collection you want media from.
editModeintOptionalfalseThis sets whether pending media in the collection is returned in the response.
sane_metadataboolOptionalfalseWill unserialize metadata. Default false.

Response: Info

The Response Info will contain data about the collection.
NB: The Response Data contains information about the media in that collection, and is shown in below in Response Data.

NameTypeDescriptionDefault Values
idINTThe collection IDINT
vhostINTThe vhost ID that the collection belongs to.INT
thumbnailSTRINGA thumb url of an image to represent the collection.empty STRING
typeINTThis determines whether the collection is a saved search collection or a manual collection. Saved search is represented by 1 and manual collection by 2.1/2
nameSTRINGThe name of the collection. This is used for recognition of the channel.STRING
descriptionSTRINGAn overview of the media content that is in the collection.STRING
createdYYYY-MM-DD HH:MM:SSThe date the collection was created in our system.YYYY-MM-DD HH:MM:SS
baseurlSTRINGDEPRECATEDSTRING
channelINTThe channel that is used as a filter if the collection type is a saved search.empty / channel ID
addtotopINTWhen this is set the channel will be added to the top of the channel list.0/1
autoactiveINTThis sets the collection that it will be set as published as its default state.0/1

Response: Data

The Response Data contains the data for media in the collection.
This part of the response is the same as the data returned by the media.getFileInfo service call.

NameDescriptionPossible Values
idThe media ID of the requested media.INT
vhostThe ID of the vhost which the file belongs to.INT
publicUrlThe publicly accessible url of the media item. This url will log a hit on the piece of media.STRING
thumbUrlthe publicly accessible url used only as a thumbnail for the piece of media. Using the thumb url will NOT log a hit on the media item.STRING
extensionThe original file extension of the uploaded media item. An example would be png.STRING
filenameThe original file name of the uploaded media item.string/empty
filetypeThe filetype of the requested media item.0,1,2,3,4
hitsThe number of views the media received.INT
messageThe message of the media item.STRING
moderationstatusThe current moderation status of the file.0,1,2,3,-1
positionThe position media item in the collection list.INT
ratingThe rating of the file.INT
tagsAll the tags associated with the piece of media. Each tag is separated by a space.STRING
titleThe title of the media item.STRING
uidThe ID of the user who uploaded the media into the system.INT
uploadThe upload date of the when the file was first uploaded into MediaFactory.YYYY-MM-DD HH:MM:SS
user_nameThe user name of the submitter.STRING
user_nicknameThe submitter's nickname.STRING
votecountThe vote count of the file.INT
locationThe server location of the uploaded media item.STRING (s3, fmlocal, fmdevs3)
moderationdeniedidThe moderation reason for being denied.Possible values for denied reasons are 0-14. Exact reasons are available in our glossary.

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/collections/getCollectionData?collection=[COLLECTION_ID]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <info>
    <id>COLLECTION_ID</id>
    <vhost>VHOST_ID</vhost>
    <thumbnail/>
    <type>1</type>
    <name>COLLECTION_NAME</name>
    <description>COLLECTION_DESCRIPTION</description>
    <created>2012-02-03 11:40:39</created>
    <baseurl/>
    <channel>0</channel>
    <addToTop>0</addToTop>
    <autoActive>1</autoActive>
  </info>
  <data>
    <item>
      <extension>png</extension>
      <filename>filemobile_lydhz6cTvy1qcnl1ho1_500.png</filename>
      <filetype>1</filetype>
      <hits>49</hits>
      <id>MEDIA_ID</id>
      <message>MEDIA_MESSAGE</message>
      <moderationstatus>2</moderationstatus>
      <position>4</position>
      <rating>0</rating>
      <tags>media example test upload</tags>
      <title>MEDIA_TITLE</title>
      <uid>USER_ID</uid>
      <upload>2012-01-25 16:36:47</upload>
      <user_name>USER_NAME</user_name>
      <user_nickname/>
      <vhost>VHSOT_ID</vhost>
      <votecount>0</votecount>
      <publicUrl>http://fmdevs3.filemobile.com/storage/MEDIA_ID</publicUrl>
      <thumbUrl>http://fmdev.s3.amazonaws.com/storage/MEDIA_ID</thumbUrl>
      <location>fmdevs3</location>
      <moderationdeniedid>2</moderationdeniedid>
    </item>
  </data>
</result>
Sample JSON Response
{
    "status": true,
    "result": {
        "info": {
            "id": COLLECTION_ID,
            "vhost": VHOST_ID,
            "thumbnail": null,
            "type": 1,
            "name": "COLLECTION_NAME",
            "description": "COLLECTION_DESCRIPTION",
            "created": "2012-02-03 11:40:39",
            "baseurl": null,
            "channel": 0,
            "addToTop": 0,
            "autoActive": 1
        },
        "data": [
            {
                "extension": "png",
                "filename": "filemobile_lydhz6cTvy1qcnl1ho1_500.png",
                "filetype": 1,
                "hits": 49,
                "id": MEDIA_ID,
                "message": "MEDIA_MESSAGE",
                "moderationstatus": 2,
                "position": "4",
                "rating": 0,
                "tags": "media example test upload",
                "title": "MEDIA_TITLE",
                "uid": USER_ID,
                "upload": "2012-01-25 16:36:47",
                "user_name": "USER_NAME",
                "user_nickname": "",
                "vhost": VHOST_ID,
                "votecount": 0,
                "publicUrl": "http://fmdevs3.filemobile.com/storage/MEDIA_ID",
                "thumbUrl": "http://fmdev.s3.amazonaws.com/storage/MEDIA_ID",
                "location": "fmdevs3",
                "moderationdeniedid": 2
            }
        ]
    }
}

Code examples

0 comments

Be the first to comment on getCollectionData.

Add a Comment

  • captcha