Revver Developer Center: Api : Methods : Message

Revver Developer Center



message.find

Searches for messages which match the query filter options.

message.find(query, returnFields [,options])

parameters

query object Contains filter requirements for the messages returned
ids array of integers returns messages with these ids
targets array of strings returns messages sent to these users. the targets must be children of the currently authed user. a target of '_self' can be used to retrieve messages for the currently authed user.
statuses array of integers returns messages with these statuses.

returnFields

Takes an array of strings (or tuples for advanced return options) specifying the fields you wish to be returned.

id integer id of the message.
target string login of the recipient
code integer unique code that identifies this message
sender string login of the sender
body string optional more detailed message.
video_id string video the message is associated with, if any
status: integer message status 0 - unread, 1 - read, 2 - deleted. default is unread
created_on ISO 8601 timestamp for when the message was created

options

limit integer Limit the number of results returned to this number - same effect as "LIMIT" keyword in SQL. There is currently a hard maximum limit of 50.
offset integer Skip the first specified number of results - same effect as "OFFSET" keyword in SQL
count boolean Whether to include a count of the total results that would have been returned ignoring the supplied limit/offset. Default is False.
orderBy array (string, boolean) Returns users ordered by the field specified. If the supplied boolean is True, the results will be in ascending order, otherwise descending order. Available sort fields are: created and status.

return

If the supplied count option and final option is false, an array of details defined by the returnFields specified is returned for each media matched.

If count is True a tuple(two element array) is returned: (count, [viddetails, …])

message.get

This is a shortcut to calling message.find with a single id. There are no options for this function.

message.get(id, returnFields)

parameters

id integer id of message

returnFields

The returnFields are the same as those for message.find.

errors

The errors are the same as those for message.find.

message.count

Returns the number of results of a query.

message.count(query)

parameters

query object query object suitable for passing to message.find

return

Integer. Returns the number of items matched by the query.

message.update

Updates an existing message with status (only). Users can only update messages targeting themselves or their children.

message.update(id,status)

parameters

id integer id of the message to update.
status integer new status for the message. 0 - unread, 1 - read, 2 - deleted.

return

True on success

errors

In addition to the global API errors, this function can return the following local errors:
1101 Invalid message id
1103 Insufficient privileges

message.bulkUpdate

Updates existing messages with status (only). Users can only bulkUpdate messages targeting themselves or their children.

message.bulkUpdate(ids, status)

parameters

ids array of integers ids of the messages to update.

return

True on success

errors

In addition to the global API errors, this function can return the following local errors:

1101 Username does not exist
1104 User already deleted.