API Docs for: 2.6
Show:

plugin_rest_phonebook Class

Module: plugins_rest
Parent Module: com_phonebook_rest

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

GET requests

  1. phonebook/search/:term
  2. phonebook/speeddials
  3. phonebook/cticontact/:id
  4. phonebook/searchstartswith/:term
  5. phonebook/searchstartswith_digit

phonebook/search/:term

The client receives all phonebook contacts found in the centralized and NethCTI phonebooks. It returns all database entries that contain the specified term in the fields name, company, workphone, homephone and cellphone.

Example JSON response:

{
     "centralized": [
         {
             "id": 1672,
             "owner_id": "",
             "type": "Cliente",
             "homeemail": null,
             "workemail": "user@company.com",
             "homephone": null,
             "workphone": "0512993322",
             "cellphone": "",
             "fax": "0512993322",
             "title": null,
             "company": "Ufficio sviluppatori",
             "notes": "",
             "name": "",
             "homestreet": null,
             "homepob": null,
             "homecity": null,
             "homeprovince": null,
             "homepostalcode": null,
             "homecountry": null,
             "workstreet": "S.S.PONTI, 1",
             "workpob": null,
             "workcity": "Pesaro",
             "workprovince": null,
             "workpostalcode": null,
             "workcountry": null,
             "url": "http://www.nethesis.it"
         }
     ],
     "nethcti": [
         {
             "id": 2,
             "owner_id": "alessandro",
             "type": "public",
             "homeemail": "",
             "workemail": "",
             "homephone": "",
             "workphone": "",
             "cellphone": "1233245",
             "fax": "",
             "title": "",
             "company": "",
             "notes": "",
             "name": "alessandro",
             "homestreet": "",
             "homepob": "",
             "homecity": "",
             "homeprovince": "",
             "homepostalcode": "",
             "homecountry": "",
             "workstreet": "",
             "workpob": "",
             "workcity": "",
             "workprovince": "",
             "workpostalcode": "",
             "workcountry": "",
             "url": "",
             "extension": "",
             "speeddial_num": "1233245"
         }
     ]
 }

phonebook/speeddials

The client receives all speeddial contacts owned by him. The contacts are in the NethCTI phonebook. It returns all database entries that have the field type equal to "speeddial".

Example JSON response:

[
       {
             "id": 1
             "owner_id": "alessandro"
             "type": "speeddial"
             "homeemail": ""
             "workemail": ""
             "homephone": ""
             "workphone": ""
             "cellphone": "123456"
             "fax": ""
             "title": ""
             "company": ""
             "notes": ""
             "name": "ale"
             "homestreet": ""
             "homepob": ""
             "homecity": ""
             "homeprovince": ""
             "homepostalcode": ""
             "homecountry": ""
             "workstreet": ""
             "workpob": ""
             "workcity": ""
             "workprovince": ""
             "workpostalcode": ""
             "workcountry": ""
             "url": ""
             "extension": ""
             "speeddial_num": "123456"
       }
 ]

phonebook/cticontact/:id

The client receives the details of the contact that is in the NethCTI phonebook. The parameter id is the database identifier of the contact.

Example JSON response:

{
   "id": 1,
   "owner_id": "alessandro",
   "type": "speeddial",
   "homeemail": "",
   "workemail": "",
   "homephone": "",
   "workphone": "",
   "cellphone": "123456",
   "fax": "",
   "title": "",
   "company": "",
   "notes": "",
   "name": "ale",
   "homestreet": "",
   "homepob": "",
   "homecity": "",
   "homeprovince": "",
   "homepostalcode": "",
   "homecountry": "",
   "workstreet": "",
   "workpob": "",
   "workcity": "",
   "workprovince": "",
   "workpostalcode": "",
   "workcountry": "",
   "url": "",
   "extension": "",
   "speeddial_num": "123456"

}


phonebook/searchstartswith/:term

The client receives all phonebook contacts found in the centralized and NethCTI phonebooks. It returns all database entries whose name and company fields starts with the specified term.

Example JSON response:

{
     "centralized": [
         {
             "id": 488,
             "owner_id": "",
             "type": "Reseller",
             "homeemail": null,
             "workemail": "ale@nethesis.it",
             "homephone": null,
             "workphone": "",
             "cellphone": "",
             "fax": "",
             "title": null,
             "company": "Nethesis srl",
             "notes": "some notes",
             "name": "alert ",
             "homestreet": null,
             "homepob": null,
             "homecity": null,
             "homeprovince": null,
             "homepostalcode": null,
             "homecountry": null,
             "workstreet": "Strada degli Olmi",
             "workpob": null,
             "workcity": "Pesaro",
             "workprovince": null,
             "workpostalcode": null,
             "workcountry": null,
             "url": "http://www.nethesis.it"
         }
     ],
     "nethcti": [
         {
             "id": 1,
             "owner_id": "alessandro",
             "type": "speeddial",
             "homeemail": "",
             "workemail": "",
             "homephone": "",
             "workphone": "",
             "cellphone": "123456",
             "fax": "",
             "title": "",
             "company": "",
             "notes": "",
             "name": "ale",
             "homestreet": "",
             "homepob": "",
             "homecity": "",
             "homeprovince": "",
             "homepostalcode": "",
             "homecountry": "",
             "workstreet": "",
             "workpob": "",
             "workcity": "",
             "workprovince": "",
             "workpostalcode": "",
             "workcountry": "",
             "url": "",
             "extension": "",
             "speeddial_num": "123456"
         }
     ]
 }

phonebook/searchstartswith_digit

The client receives all phonebook contacts found in the centralized and NethCTI phonebooks. It returns all database entries whose name and company fields starts with a digit.

Example JSON response:

{
     "centralized": [
         {
             "id": 2223,
             "owner_id": "",
             "type": "Developer",
             "homeemail": null,
             "workemail": "ale@nethesis.it",
             "homephone": null,
             "workphone": "0721405516",
             "cellphone": "",
             "fax": "",
             "title": null,
             "company": "3 Nethesis",
             "notes": "",
             "name": "",
             "homestreet": null,
             "homepob": null,
             "homecity": null,
             "homeprovince": null,
             "homepostalcode": null,
             "homecountry": null,
             "workstreet": "Strada degli Olmi",
             "workpob": null,
             "workcity": "Pesaro",
             "workprovince": null,
             "workpostalcode": null,
             "workcountry": null,
             "url": "www.nethesis.it"
         }
     ],
     "nethcti": [
         {
             "id": 2,
             "owner_id": "alessandro",
             "type": "public",
             "homeemail": "",
             "workemail": "",
             "homephone": "",
             "workphone": "",
             "cellphone": "1233245",
             "fax": "",
             "title": "",
             "company": "",
             "notes": "",
             "name": "1alessandro",
             "homestreet": "",
             "homepob": "",
             "homecity": "",
             "homeprovince": "",
             "homepostalcode": "",
             "homecountry": "",
             "workstreet": "",
             "workpob": "",
             "workcity": "",
             "workprovince": "",
             "workpostalcode": "",
             "workcountry": "",
             "url": "",
             "extension": "",
             "speeddial_num": "1233245"
         }
     ]
 }

POST requests

  1. phonebook/create
  2. phonebook/delete_cticontact
  3. phonebook/modify_cticontact

phonebook/create

Creates a contact in the NethCTI phonebook. The contact information must be specified in the POST request in JSON format and must contain at least the following parameters:

  • type: ("speeddial | "private" | "public"): the visibility of the contact
  • name: the name of the contact
  • [homeemail]
  • [workemail]
  • [homephone]
  • [workphone]
  • [cellphone]
  • [fax]
  • [title]
  • [company]
  • [notes]
  • [homestreet]
  • [homepob]
  • [homecity]
  • [homeprovince]
  • [homepostalcode]
  • [homecountry]
  • [workstreet]
  • [workpob]
  • [workcity]
  • [workprovince]
  • [workpostalcode]
  • [workcountry]
  • [url]
  • [extension]
  • [speeddial_num]

Example JSON request parameters:

{ "creator": "alessandro", "type": "type", ... }

phonebook/delete_cticontact

Deletes a contact from the NethCTI phonebook. The request must contains the following parameter:

  • id: the contact identifier in the NethCTI phonebook database

Example JSON request parameters:

{ "id": "74" }

The NethCTI phonebook is the nethcti.cti_phonebook database table.


phonebook/modify_cticontact

Modify a contact in the NethCTI phonebook. The request must contains the following parameters:

  • id: the contact identifier in the NethCTI phonebook database
  • [type]: ("speeddial | "private" | "public"): the visibility of the contact
  • [name]: the name of the contact
  • [homeemail]
  • [workemail]
  • [homephone]
  • [workphone]
  • [cellphone]
  • [fax]
  • [title]
  • [company]
  • [notes]
  • [homestreet]
  • [homepob]
  • [homecity]
  • [homeprovince]
  • [homepostalcode]
  • [homecountry]
  • [workstreet]
  • [workpob]
  • [workcity]
  • [workprovince]
  • [workpostalcode]
  • [workcountry]
  • [url]
  • [extension]
  • [speeddial_num]

Example JSON request parameters:

{ "creator": "alessandro", "type": "type", ... }

The NethCTI phonebook is the nethcti.cti_phonebook database table.

Methods

create

(
  • req
  • res
  • next
)

Create a contact in the NethCTI phonebook with 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_cticontact

(
  • req
  • res
  • next
)

Deletes a contact from the NethCTI phonebook.

delete_cticontact

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

modify_cticontact

(
  • req
  • res
  • next
)

Modify a contact in the NethCTI phonebook.

modify_cticontact

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

searchstartswith

(
  • req
  • res
  • next
)

Searches all phonebook contacts found in the centralized and NethCTI phonebooks. It returns all database entries whose name and company fields starts with the specified term.

searchstartswith/:term

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

searchstartswith_digit

(
  • req
  • res
  • next
)

Searches all phonebook contacts found in the centralized and NethCTI phonebooks. It returns all database entries whose name and company fields starts with a digit.

searchstartswith_digit

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

setCompPhonebook

(
  • cp
)

Set phonebook architect component used by phonebook functions.

Parameters:

  • cp Object

    The phonebook 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.

speeddials

(
  • req
  • res
  • next
)

Returns all the speeddial contacts of the user. The contacts are in the NethCTI phonebook. It returns all database entries that have the field type equal to "speeddial".

speeddials

Parameters:

  • req Object

    The client request

  • res Object

    The client response

  • next Function

    Function to run the next handler in the chain

Properties

compPhonebook

Object private

The phonebook architect component used for phonebook functions.

compUtil

Object private

The utility architect component.

get

Array

REST API to be requested using HTTP GET request.

Sub-properties:

  • speeddials String

    To get all the speeddial contacts of the user from the NethCTI phonebook

  • search/:term String

    To get the centralized and cti phonebook contacts that contains the term

  • cticontact/:id String

    To get the the details of the contact that is in the cti phonebook

  • searchstartswith/:term String

    To get the centralized and cti phonebook contacts whose name starts with the specified term

  • searchstartswith_digit String

    To get the centralized and cti phonebook contacts whose name starts with a digit

IDLOG

String private final

The module identifier used by the logger.

Default: [plugins_rest/phonebook]

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

    Creates a contact in the NethCTI phonebook

  • delete_cticontact String

    Deletes a contact from the NethCTI phonebook

  • modify_cticontact String

    Modify a contact in the NethCTI phonebook