API Reference

Media.addToFavorites

This method adds a media item to the list of a user's favorites and may be called either with an API key having the media.addToFavorites permission or without an API key.

Using an API key with the media.addToFavorites permission a user ID may be provided as the owner of the favorite. Without an API key, the owner of the favorite will be the logged in user.

If a user ID is provided and the API key is missing or does not have the correct permission the call will fail with an exception (Sabre_ServiceMap_PermissionDeniedException).

If a user ID is not provided and a user is not logged in the call will fail with an exception (Sabre_ServiceMap_PermissionDeniedException).

If the media is not a part of the project the user is registered in the call will fail with an exception (FileMobile_Storage_InvalidArgumentException).


Syntax

void media.addToFavorites ( mixed mid, int uid = NULL )

Arguments

NameTypeRequiredDefault valueDescription
midmixedRequirednoneThe ID of the media item you are going to add to your favourites.
uidintOptionalNULLIf a users UID is omitted the current logged in user will be used and the media item will be added to their favourites.

Response

In the response you will receive either a 1 for a success or you will be notified if the user ID or media ID passes were invalid.

NameTYPEDescriptionPossible Values
resultINTThis will return 1 if the request was a success.empty, 1, error result

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/media/addToFavorites?mid=[MID]&uid=1927861&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>1</result>
Sample JSON Response
{
    "status": true,
    "result": 1
}

Code examples

0 comments

Be the first to comment on addToFavorites.

Add a Comment

  • captcha