Class Socialveo\WebApi\Controllers\NetworksController

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

Class NetworksController

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
connectionsAction() Returns a lists of connections associated with the network of any type (group, profile, conversation) Socialveo\WebApi\Controllers\NetworksController
createAction() Creates a network Socialveo\WebApi\Controllers\NetworksController
decrypt() Decrypt value Socialveo\WebApi\Controllers\RestApiController
deleteAction() Removes a network (soft-delete) Socialveo\WebApi\Controllers\NetworksController
encrypt() Encrypt value Socialveo\WebApi\Controllers\RestApiController
getAction() Returns a network Socialveo\WebApi\Controllers\NetworksController
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 networks Socialveo\WebApi\Controllers\NetworksController
meAction() Returns the currently logged-in user's profile network Socialveo\WebApi\Controllers\NetworksController
notFoundAction() Not found action Socialveo\WebApi\Controllers\RestApiController
paymentCreateAction() Returns a premium network payment redirect link Socialveo\WebApi\Controllers\NetworksController
posts() Gets posts Socialveo\WebApi\Controllers\RestApiController
postsAction() Returns a lists of associated posts Socialveo\WebApi\Controllers\NetworksController
provideAction() Provides network files including images, cover images and media Socialveo\WebApi\Controllers\NetworksController
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 network Socialveo\WebApi\Controllers\NetworksController
uploadAvatarAction() Uploads network profile avatar Socialveo\WebApi\Controllers\NetworksController
uploadCoverAction() Uploads network profile cover Socialveo\WebApi\Controllers\NetworksController
usersAction() Returns a lists of users associated with the given network Socialveo\WebApi\Controllers\NetworksController

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

connectionsAction() public method

Returns a lists of connections associated with the network of any type (group, profile, conversation)

/networks/{network_uuid}/connections

Method: GET

Access: Owner || UserHasAccess

Parameters:

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

Sample response:

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

public mixed connectionsAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

createAction() public method

Creates a network

/networks/create

Method: POST

Access: Logged

Parameters:

network_type required string type of network: profile or group or conversation
url required string url of the network
name required string name of the network
description required string short description of the network
status required integer status of the network: STATUS_PUBLIC = 0; STATUS_PROTECTED = 1; STATUS_PRIVATE = 2; STATUS_PREMIUM = 3;
attributes optional mixed Network attributes

Notes: If network status is set to '3' (premium network), the nested premium properties become mandatory.

Affects: Network

Returns: Network

Sample response:

{
    "status": "OK",
    "data":{
        "type": "network",
        "uuid": "cda051be-6d94-11e7-a267-54bef75c7a3f",
        "user_uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f",
        "network_type": "group",
        ...
    },
    "timestamp": 1234567890
}

public mixed createAction ( )
deleteAction() public method

Removes a network (soft-delete)

/networks/{network_uuid}/delete

Method: POST

Access: Owner

Parameters:

{network_uuid} required string network uuid

Affects: Network

Sample response:

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

public mixed deleteAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

getAction() public method

Returns a network

/networks/{network_uuid}

Method: GET

Access: UserHasAccess

Parameters:

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

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '32885ab2-b5e7-11e4-b16d-b88d1200a92c',
        'user_uuid': '31fb181e-b5e7-11e4-83d7-b88d1200a92c',
        'network_type': 'group',
        'name': 'Bikers Club',
        ...
    },
    "timestamp": 1234567890
}

public mixed getAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

listAction() public method

Returns a list of networks

/networks

Method: GET

Access: Public

Parameters:

page or offset optional integer page start or offset
limit optional integer page limit
sortby[property]=order optional array sort by property value, order either desc or asc
filterby[property][operator]=value optional array filter by given property, operator eq (=), gt (>), ge(>=), lt(<), le(<=), ne(<>), like
uuids optional string or array 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

Notes: When uuids param used then will be ignored others filter params

Filter by: Network

Returns: Network []

Sample response:

{
    "status": "OK",
    "data":[
        {"type": "network", "uuid": "a479b438-14a8-11e6-ac83-54bef75c7a3f", "network_uuid": "a66b8654-14a8-11e6-af87-54bef75c7a3f",…},
        {"type": "network", "uuid": "5a15e760-27ed-11e6-8d4a-54bef75c7a3f", "network_uuid": "5ac94e9a-27ed-11e6-9916-54bef75c7a3f",…},
        {"type": "network", "uuid": "0449c1f2-27f8-11e6-be68-54bef75c7a3f", "network_uuid": "04577e6e-27f8-11e6-b0cf-54bef75c7a3f",…},
        {"type": "network", "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 ( )
meAction() public method

Returns the currently logged-in user's profile network

/networks/me

Method: GET

Access: Logged

Parameters:

language optional string, language code

Returns: Network

Sample response:

{
    "status": "OK",
    "data":[
        'uuid': '32885ab2-b5e7-11e4-b16d-b88d1200a92c',
        'user_uuid': '31fb181e-b5e7-11e4-83d7-b88d1200a92c',
        'network_type': 'profile',
        'name': 'Mike Brown',
        ...
    ],
    "timestamp": 1234567890
}

public mixed meAction ( )
paymentCreateAction() public method

Returns a premium network payment redirect link

Notice. This action is disabled, the reasons can be: not implemented, unsafe, duplicated or deprecated (autodetect: disabled in the router)
/networks/{network_uuid}/payments

Method: GET

Access: Logged

Parameters:

{network_uuid} required string network uuid

Sample response:

{
    "status": "OK",
    "paymentRedirectUrl": "http://www.paypal.com/pau?79475r0984232342232"
}

public mixed paymentCreateAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

postsAction() public method

Returns a lists of associated posts

/networks/{network_uuid}/posts

Method: GET

Access: Owner || UserHasAccess

Parameters:

{network_uuid} required string network uuid
page or offset optional integer page start or offset
limit optional integer page limit
sortby[property]=order optional array sort by property value, order either desc or asc
filterby[property][operator]=value optional array filter by given property, operator eq (=), gt (>), ge(>=), lt(<), le(<=), ne(<>), like
uuids optional string or array 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: Post

Returns: Post []

Sample response:

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

public mixed postsAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

provideAction() public method

Provides network files including images, cover images and media

public mixed provideAction ( $network_uuid, $folder, $file )
$network_uuid string

Network UUID is passed in the request URI

$folder string

The type of media (image, cover_image, media)

$file string

The name of the file

updateAction() public method

Updates a network

/networks/{network_uuid}/update

Method: POST

Access: Owner

Parameters:

{network_uuid} required string network uuid
attributes optional mixed Network attributes

Affects: Network

Returns: Network

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '32885ab2-b5e7-11e4-b16d-b88d1200a92c',
        'user_uuid': '31fb181e-b5e7-11e4-83d7-b88d1200a92c',
        'network_type': 'group',
        'name': 'Bikers Club',
        ...
    },
    "timestamp": 1234567890
}

public mixed updateAction ( $network_uuid )
$network_uuid string
uploadAvatarAction() public method

Uploads network profile avatar

/networks/{network_uuid}/upload-avatar

Method: POST

Access: Owner

There are two ways to uploading images

1) Regular uploading with Content-Type: multipart/form-data

Parameters:

{network_uuid} required string network uuid
avatar required file image file

Sample request:

Headers:
Content-Type: multipart/form-data; boundary=----RandomFormBoundaryEk21BCjGskAweNnK

Body:
------RandomFormBoundaryEk21BCjGskAweNnK
Content-Disposition: form-data; name="avatar"; filename="basename.png"
Content-Type: image/png

------RandomFormBoundaryEk21BCjGskAweNnK
[raw file contents]

------RandomFormBoundaryEk21BCjGskAweNnK--

2) Putting file into body and sending with the file content type

Parameters:

{network_uuid} required string network uuid
filename optional string image basename via GET query

Sample request:

Headers:
Content-Type: image/png

Body:
[raw file contents]

Affects: Network

Returns: Network

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '32885ab2-b5e7-11e4-b16d-b88d1200a92c',
        'user_uuid': '31fb181e-b5e7-11e4-83d7-b88d1200a92c',
        'network_type': 'group',
        'name': 'Bikers Club',
        ...
    },
    "timestamp": 1234567890
}

public mixed uploadAvatarAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

uploadCoverAction() public method

Uploads network profile cover

/networks/{network_uuid}/upload-cover

Method: POST

Access: Owner

There are two ways to uploading images

1) Regular uploading with Content-Type: multipart/form-data

Parameters:

{network_uuid} required string network uuid
cover required file image file

Sample request:

Headers:
Content-Type: multipart/form-data; boundary=----RandomFormBoundaryEk21BCjGskAweNnK

Body:
------RandomFormBoundaryEk21BCjGskAweNnK
Content-Disposition: form-data; name="cover"; filename="basename.png"
Content-Type: image/png

------RandomFormBoundaryEk21BCjGskAweNnK
[raw file contents]

------RandomFormBoundaryEk21BCjGskAweNnK--

2) Putting file into body and sending with the file content type

Parameters:

{network_uuid} required string network uuid
filename optional string image basename via GET query

Sample request:

Headers:
Content-Type: image/png

Body:
[raw file contents]

Affects: Network

Returns: Network

Sample response:

{
    "status": "OK",
    "data":{
        'uuid': '32885ab2-b5e7-11e4-b16d-b88d1200a92c',
        'user_uuid': '31fb181e-b5e7-11e4-83d7-b88d1200a92c',
        'network_type': 'group',
        'name': 'Bikers Club',
        ...
    },
    "timestamp": 1234567890
}

public mixed uploadCoverAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI

usersAction() public method

Returns a lists of users associated with the given network

/networks/{network_uuid}/users

Method: GET

Access: Owner || UserHasAccess

Parameters:

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

Filter by: User

Returns: User []

Sample response:

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

public mixed usersAction ( $network_uuid )
$network_uuid string

Network UUID is passed in the request URI