API Docs for: 2.6
Show:

plugin_rest_postit Class

Module: plugins_rest
Parent Module: com_postit_rest

REST plugin that provides postit functions through the following REST API:

GET requests

  1. postit/new
  2. postit/read/:id

postit/new

Gets all the new post-it messages of the user.

Example JSON response:

{
    "recipient": "alessandro",
    "new": [
         {
             "creationdate": "17/01/2014",
             "creationtime": "08:59:31",
             "readdate": null,
             "timeread": null,
             "id": 18,
             "text": "3333333333",
             "creator": "giovanni",
             "recipient": "alessandro"
         },
         {
             "creationdate": "17/01/2014",
             "creationtime": "08:59:28",
             "readdate": null,
             "timeread": null,
             "id": 17,
             "text": "22222",
             "creator": "giovanni",
             "recipient": "alessandro"
         }
    ]
}

postit/read/:id

Gets the specified post-it. This call update the read date status of the post-it. The id is the unique identifier of the message.

Example JSON response:

{
    "id": 17,
    "text": "22222",
    "creator": "giovanni",
    "readdate": null,
    "recipient": "alessandro",
    "creation": "2014-01-17T08:59:28.000Z"
}

POST requests

  1. postit/create
  2. postit/remote_create
  3. postit/modify
  4. postit/delete

postit/create

The client crete a new post-it for the recipient.

  • text: the text of the post-it
  • recipient: the destination user of the message
  • [creator]: the username of the creator. It is needed for requests coming from remote users of remote sites

Example JSON request parameters:

{ "text": "message text", "recipient": "john" }
{ "text": "message text", "recipient": "john", "creator": "user" }

postit/remote_create

The client crete a new post-it for a recipient of a remote site. It is callable only from a local clients.

  • text: the text of the post-it
  • recipient: the destination user of the message
  • site: the name of the remote site

Example JSON request parameters:

{ "text": "message text", "recipient": "john", "site": "ranocchi" }

postit/modify

The client changes his post-it.

  • id: the database identifier of the post-it
  • text: the text of the post-it

Example JSON request parameters:

{ "id": "76", text": "modified text" }

postit/delete

Deletes the specified post-it.

  • id: the unique identifier of the post-it

Example JSON request parameters:

{ "id": "76" }

Methods

create

(
  • req
  • res
  • next
)

Create a new post-it by the following REST API:

create

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

delete

(
  • req
  • res
  • next
)

Deletes the specified post-it by the following REST API:

delete

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

deletePostit

(
  • id
  • username
  • res
)
static

Delete the specified post-it.

Parameters:

  • id String

    The unique identifier of the post-it

  • username String

    The name of the user

  • res Object

    The client response

modify

(
  • req
  • res
  • next
)

Changes the specified post-it by the following REST API:

modify

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

modifyPostit

(
  • id
  • text
  • username
  • res
)
static

Modify the specified post-it.

Parameters:

  • id String

    The unique identifier of the post-it

  • text String

    The replacing text of the post-it

  • username String

    The name of the user

  • res Object

    The client response

new

(
  • req
  • res
  • next
)

Returns all the new post-it messages by the following REST API:

new

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

read

(
  • req
  • res
  • next
)

Returns the specified post-it message by its unique identifier by the following REST API:

read

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

remote_create

(
  • req
  • res
  • next
)

Create a new post-it for a recipient of a remote site by the following REST API:

remote_create

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

setCompAuthorization

(
  • comp
)
static

Set the authorization architect component.

Parameters:

  • comp Object

    The architect authorization component

setCompComNethctiRemotes

(
  • comp
)

Set remote sites communication architect component.

Parameters:

  • comp Object

    The remote sites communication architect component.

setCompPostit

(
  • cp
)

Set postit architect component used by postit functions.

Parameters:

  • cp Object

    The postit architect component.

setCompUtil

(
  • comp
)

Sets the utility architect component.

Parameters:

  • comp Object

    The utility architect component.

setLogger

(
  • log
)
static

Set the logger to be used.

Parameters:

  • log Object

    The logger object. It must have at least three methods: info, warn and error as console object.

Properties

compAuthorization

Object private

The architect component to be used for authorization.

compComNethctiRemotes

Object private

The remote sites communication architect component.

compPostit

Object private

The postit architect component used for postit functions.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • new String

    To get all the new post-it messages

  • read/:id String

    To get a specific post-it message

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/postit]

logger

Object private

The logger. It must have at least three methods: info, warn and error.

Default: console

post

Array

REST API to be requested using HTTP POST request.

Sub-properties:

  • create String

    To create a new post-it for a user

  • remote_create String

    To create a new post-it for a user of a remote site

  • modify String

    To modify a post-it of a user

  • delete String

    To delete the post-it