User Tools

Site Tools


api:pbx:phonebook:create

API : PBX : Phonebook Create

Request

This request will create a new contact in the phonebook.

Shared contacts can be created by everybody, personal contacts can be created by the user for the employee self or by another employee who has the group right 'writePhonebook' on the employee.

URL https://api.telecomx.dk/pbx/phonebook
Method POST
Access level PERSONAL if contact is personal or has group right 'writePhonebook' on the employee or contact is shared
VIEWER, MANAGER, OWNER if contact is personal and user has group right 'writePhonebook' or contact is shared
RESELLER, RESELLER_ADMIN or ADMIN if contact is shared.
Body customer Id Id of the customer the entry belongs to, defaults to users customer (RESELLER/RESELLER_ADMIN/ADMIN only).
employee Id Id of the employee the entry belongs to, defaults to the employee self.
personal Boolean True if the contact belongs to the user, and can only be seen by the user.
type String Type of contact: PERSON, COMPANY.
givenName String Given name.
familyName String Family name.
company String Company name.
title String Title of person.
department String Department of person.
addresses Array List of addresses.
addresses[].type String Type of address: HOME, WORK.
addresses[].street String Street, housenumber, floor, door.
addresses[].zip String Zip code.
addresses[].city String City.
addresses[].state String State.
adressses[].country String ISO3166-2 country code.
phoneNumbers Array Phone numbers
phoneNumbers[].type String Number type: HOME, WORK, MOBILE, MAIN, OTHER.
phoneNumbers[].number String Phone number in E.164 format.
emailAddresses Array E-mail addresses
emailAddresses[].type String Type: HOME, WORK, MAIN, OTHER.
emailAddresses[].address String E-mail address.
shortNumber String Optional short number, 1-7 digits, that will call this contact. Only available on shared contacts.
notes String Notes about the contact.
externalId String External ID, can be used to reference phonebook contacts from another system

Request body example

{
  "customer": "12345678901234567890AAAA",
  "personal": true,
  "type": "PERSON",
  "givenName": "Peter",
  "familyName": "Hansen",
  "company": "Acme Soap & Rope ApS",
  "title": "Generel manager",
  "department": "Sales",
  "addresses": [
    {
      "type": "WORK",
      "street": "Paradise Apple Road 23",
      "zip": "2450",
      "city": "Copenhagen",
      "country": "DK"
    }
  ],
  "phoneNumbers": [
    {
      "type": "WORK",
      "number": "+4588888888"
    },
    {
      "type": "MOBILE",
      "number": "+4580808080"
    }
  ],
  "emailAddresses": [
    {
      "type": "HOME",
      "address": "myself@gmail.com"
    },
    {
      "type": "WORK",
      "address": "ph@acmesoapandrope.com"
    }
  ],
  "notes": "Some note about the contact",
  "picture": null,
  "externalId": "42"
}

Response

The response will be the newly created contact, if no errors occurred.

JSON object
_id Id Unique id of the phonebook entry.
customer Id Id of the customer the entry belongs to.
employee Id If the entry belongs to a single employee, this is the id of the employee, otherwise null for shared.
type String Type of contact: PERSON, COMPANY.
givenName String Given name.
familyName String Family name.
company String Company name.
title String Title of person.
department String Department of person.
addresses Array List of addresses.
addresses[].type String Type of address: HOME, WORK.
addresses[].street String Street, housenumber, floor, door.
addresses[].zip String Zip code.
addresses[].city String City.
addresses[].state String State.
adressses[].country String ISO3166-2 country code.
phoneNumbers Array Phone numbers
phoneNumbers[].type String Number type: HOME, WORK, MOBILE, MAIN, OTHER.
phoneNumbers[].number String Phone number in E.164 format.
emailAddresses Array E-mail addresses
emailAddresses[].type String Type: HOME, WORK, MAIN, OTHER.
emailAddresses[].address String E-mail address.
shortNumber String Optional short number, 1-7 digits, that will call this contact. Only available on shared contacts.
notes String Notes about the contact.

Example

{
  "_id": "12345678901234567890ABCD",
  "customer": "12345678901234567890AAAA",
  "employee": "12345678901234567890BBBB",
  "type": "PERSON",
  "givenName": "Peter",
  "familyName": "Hansen",
  "company": "Acme Soap & Rope ApS",
  "title": "Generel manager",
  "department": "Sales",
  "addresses": [
    {
      "type": "WORK",
      "street": "Paradise Apple Road 23",
      "zip": "2450",
      "city": "Copenhagen",
      "country": "DK"
    }
  ],
  "phoneNumbers": [
    {
      "type": "WORK",
      "number": "+4588888888"
    },
    {
      "type": "MOBILE",
      "number": "+4580808080"
    }
  ],
  "emailAddresses": [
    {
      "type": "HOME",
      "address": "myself@gmail.com"
    },
    {
      "type": "WORK",
      "address": "ph@acmesoapandrope.com"
    }
  ],
  "notes": "Some note about the contact"
}

Errors

Error code Message Description
404 customer Customer not found
404 employee Employee not found
422 type Type is missing or invalid
404 givenName Given name or Company is required
422 addresses[x].type Invalid type
422 addresses[x].street Missing or invalid street
422 addresses[x].zip Missing or invalid zip
422 addresses[x].country Missing or invalid country
422 phoneNumbers[].type Invalid type
422 phoneNumbers[].number Missing or invalid phone number
422 emailAddresses[].type Invalid type
422 emailAddresses[].address Missing or invalid e-mail address
422 externalId.personal This externalId is already in use
422 externalId.shared This externalId is already in use
403 personal Personal contacts can not be created for other employees
422 shortNumber Short number is invalid
409 shortNumber Short number is already in use
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/pbx/phonebook/create.txt · Last modified: 2025/01/10 12:32 by Per Møller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki