Class Socialveo\WebApi\Controllers\MediaController

InheritanceSocialveo\WebApi\Controllers\MediaController » Socialveo\WebApi\Controllers\RestApiController » Phalcon\Mvc\Controller
Uses TraitsSocialveo\Core\Translatable

Class MediaController

Public Methods

Hide inherited methods

MethodDescriptionDefined By
_handleException() Handle exceptions Socialveo\WebApi\Controllers\RestApiController
_t() Gets translations Socialveo\Core\Translatable
afterExecuteRoute() After execute route, change return value to json Socialveo\WebApi\Controllers\RestApiController
beforeExecuteRoute() Before execute route, remove extra params Socialveo\WebApi\Controllers\RestApiController
checkClientCredentials() Checks client credentials Socialveo\WebApi\Controllers\RestApiController
createAction() Create media Socialveo\WebApi\Controllers\MediaController
decrypt() Decrypt value Socialveo\WebApi\Controllers\RestApiController
deleteAction() Removes a media (soft-delete) Socialveo\WebApi\Controllers\MediaController
encrypt() Encrypt value Socialveo\WebApi\Controllers\RestApiController
getAction() Get a media Socialveo\WebApi\Controllers\MediaController
getArrayFromParam() Returns array from params Socialveo\WebApi\Controllers\RestApiController
getLanguage() Gets language code Socialveo\WebApi\Controllers\RestApiController
getParams() Gets request params for Socialveo::filteredFind() Socialveo\WebApi\Controllers\RestApiController
getRequestData() Returns request data Socialveo\WebApi\Controllers\RestApiController
getRequiredParam() Get required param Socialveo\WebApi\Controllers\RestApiController
getToken() Get token Socialveo\WebApi\Controllers\RestApiController
getTranslation() Gets translations Socialveo\WebApi\Controllers\RestApiController
handleError() Handle errors Socialveo\WebApi\Controllers\RestApiController
handleException() Handle exceptions Socialveo\WebApi\Controllers\RestApiController
initialize() Initialize controller Socialveo\WebApi\Controllers\RestApiController
invalidMethodAction() Action trigger when invalid action tried run Socialveo\WebApi\Controllers\RestApiController
listAction() Returns a list of media resources Socialveo\WebApi\Controllers\MediaController
notFoundAction() Not found action Socialveo\WebApi\Controllers\RestApiController
posts() Gets posts Socialveo\WebApi\Controllers\RestApiController
replaceParam() Replace param Socialveo\WebApi\Controllers\RestApiController
respondWithItem() Response with item // * @deprecated Socialveo\WebApi\Controllers\RestApiController
sendJsonContent() Send response as json content and exit Socialveo\WebApi\Controllers\RestApiController
sendJsonContentRaw() Send json content Socialveo\WebApi\Controllers\RestApiController
sendJsonContentRawStatic() Send json content static Socialveo\WebApi\Controllers\RestApiController
setDefaultParam() Set default option Socialveo\WebApi\Controllers\RestApiController
t() Gets translations Socialveo\Core\Translatable
unsetParam() Unset get param Socialveo\WebApi\Controllers\RestApiController
updateAction() Updates a media Socialveo\WebApi\Controllers\MediaController

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
checkAccess() Checks during the init of controller whether user is a guest. Socialveo\WebApi\Controllers\RestApiController
log() Log full request data for debug Socialveo\WebApi\Controllers\RestApiController
objectsToArray() Convert objects to arrays Socialveo\WebApi\Controllers\RestApiController

Method Details

createAction() public method

Create media

/media/create

Method: POST

Access: Logged

Note. For sending media files request content-type have to be *multipart/form-data*

Parameters:

file required file media file to be uploaded
name required string name of the media object
target_type required string target type: tmp, post, dialog, comment
network_uuid or dialog_uuid required string target network or dialog uuid
media_type optional string type of media: image, video, embed

Affects: Media

Returns: Media

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
        'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
        'media_type': 'image',
        'name': 'Our vacation',
        ...
    },
    "timestamp": 1234567890
}

public mixed createAction ( )
throws Socialveo\Core\exceptions\UploadException
throws Exception
deleteAction() public method

Removes a media (soft-delete)

/media/{media_uuid}/delete

Method: POST

Access: Owner

Affects: Media

Parameters:

{media_uuid} optional string media uuid

Sample response:

{
    "status": "OK",
    "timestamp": 1234567890
}

public mixed deleteAction ( $media_uuid )
$media_uuid string

Media uuid

throws Exception
getAction() public method

Get a media

/media/{media_uuid}

Method: GET

Access: Public

Parameters:

{media_uuid} required string post uuid
embed optional mixed allows to include one or more child resource(s) in the response

Returns: Media

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
        'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
        'media_type': 'local',
        'name': 'Our vacation',
        ...
    },
    "timestamp": 1234567890
}

public mixed getAction ( $media_uuid )
$media_uuid string

Media uuid

listAction() public method

Returns a list of media resources

/media

Method: GET

Access: Public

Parameters:

page or offset optional integer, page start or offset
limit optional integer, page limit
sortby[property]=order optional sort by property value, order either desc or asc
filterby[property][operator]=value optional filter by given property, operator eq (=), gt (>), ge(>=), lt(<), le(<=), ne(<>), like
uuids optional list of item UUIDs to fetch, array or string separated by commas, when it used other parameters will be ignored
language optional string, language code

Filter by: Media

Returns: Media []

Sample response:

{
    "status": "OK",
    "data":[
        {"type": "media", "uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f", "network_uuid": "a66b8654-14a8-11e6-af87-54bef75c7a3f",…},
        {"type": "media", "uuid": "5a15e760-27ed-11e6-8d4a-54bef75c7a3f", "network_uuid": "5ac94e9a-27ed-11e6-9916-54bef75c7a3f",…},
        {"type": "media", "uuid": "0449c1f2-27f8-11e6-be68-54bef75c7a3f", "network_uuid": "04577e6e-27f8-11e6-b0cf-54bef75c7a3f",…},
        {"type": "media", "uuid": "4622f77e-27f8-11e6-98d1-54bef75c7a3f", "network_uuid": "4631a06c-27f8-11e6-94b3-54bef75c7a3f",…},
        ...
    ],
    "count":{"offset": 0, "limit": 10, "total": 12},
    "timestamp": 1234567890
}

public mixed listAction ( )
updateAction() public method

Updates a media

/media/{media_uuid}/update

Method: POST

Access: Owner

Parameters:

{media_uuid} optional string media uuid
attributes optional mixed Media attributes

Affects: Media

Returns: Media

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '33c1f104-b5e7-11e4-9639-b88d1200a92c',
        'user_uuid': '3200e9d8-b5e7-11e4-be3b-b88d1200a92c',
        'media_type': 'local',
        'name': 'Our vacation',
        ...
    },
    "timestamp": 1234567890
}

public mixed updateAction ( $media_uuid )
$media_uuid string