LogoLogo
LogoLogo
  • Welcome
  • Details
  • Editions
  • UNIFIED CONTACTS DEPLOYMENT
    • Getting Started
      • Unified Contacts Pro
      • Unified Contacts CE
      • Unified Contacts Free
    • Deinstallation
      • Unified Contacts Pro
      • Unified Contacts Free
    • Deployment
  • Advanced Configuration
    • Backend Permissions
    • Custom Domain
    • License Key
    • Logs & Telemetry
    • SBC Number Lookup
    • SharePoint Online Lists
    • UC Database
      • Sync Data with Azure Data Factory
      • CRUD operations with REST API
      • Updating to Unified Contacts Pro 1.5.0
    • Update Strategy
      • Updating from older versions (<=1.5.1)
      • Release Channels
  • OTHERS
    • FAQ
    • Changelog
    • Feedback
    • Important Links
  • Legal
    • Licensing
      • Azure Marketplace
    • Privacy
    • Support
    • Terms of Use
  • Unified Contacts Website
Powered by GitBook
On this page

Was this helpful?

  1. Advanced Configuration
  2. UC Database

CRUD operations with REST API

Documentation for the usage of the customer facing REST API for Database Contact insertion

Last updated 1 year ago

Was this helpful?

Authentication

To access the API endpoints you need to acquire a Bearer token. The API uses Microsoft as an Identity Provider with Application permissions. Therefore the access can be managed similarily to the the access of the Microsoft Graph API.

Prerequisites

If you have used UnifiedContactsPS with version lower than 1.1.0 to install Unified Contacts, you first have to perform the additional steps explained .

NOTE: If you have initially installed Unified Contacts Pro before version 1.5.0, this is very likely the case.

Permission Setup

  1. Select an existing App Registration or that will be used to authenticate you when accessing the Unified Contacts REST API.

  2. Navigate to API permissions > Add a permission > My APIs then select the Unified Contacts Admin AppRegistration. If you have not changed the default naming when deploying Unified Contacts via the ARM template the name will be in the following format: admin-app-reg-uc-<13 random alphanumeric characters>

  3. Select Application permissions on the top and activate the checkbox next to Contacts.Database.ReadWrite.All. Finalize the assignment by clicking "Add permissions" on the bottom.

  4. A Cloud Application-, Application-, or Global-Admin now has to Grant admin consent for the tenant. This is done by clicking the Grant admin consent for <Tenant> button and confirming the action by clicking on Yes.

  5. After the Admin consent is granted the AppRegistration is ready for usage.

Acquiring a token

In the following example we will configure Postman to acquire a valid token with an Application Secret. However we recommend the usage of a Managed Identity (when applicable) or with Certificates when creating a productive/regularly running process or sync.

  1. Copy and store the freshly generated client secret somewhere secure (e.g. a credential manager). NOTE: Once you leave this page you will only be able to see a censored shortened version of the secret. So if you do not store the secret properly and forget it you'll need to create a new one

  2. Navigate to the Overview tab of the AppRegistration. Copy the ClientId for later use. Click on Endpoints and copy the OAuth 2.0 token endpoint (v2) for later use.

  3. Navigate to API permissions select the Contacts.Database.ReadWrite.All permission and Copy the scope for later use.

  4. Create a new Postman Collection and navigate to the Authentication tab. There select OAuth 2.0 as Type

  5. Fill out the Configure new token category

    • Token Name: Any custom Name

    • Grant Type: Client Credentials

    • Access Token URL: Paste the token URL copied in Step 3

    • Client ID: Paste the Client Id copied in Step 3

    • Client Secret: Paste Secret copied in Step 2

    • Scope: Paste scope copied in step 4. Replace Contacts.Database.ReadWrite.All with .default

    • Client Authentication: Send as Basic Auth header

  6. Your result should look something like this:

  7. If you have configured everything correctly, you can now scroll to the bottom and click on "Get New Access Token" to acquire a new access token. All requests within the Collection can now be authenticated with that token.

API Documentation

You can download a sample Postman Collection here:

A detailed explanation on acquiring tokens against an AppRegistration can be found .

More details on certificate authentication can be found .

More details on Managed Identity authentication can be found .

Open the AppRegistration . Navigate to Certificates & secrets > Client secrets > New client secret. Set a description and configure the Expiry date (max. 2 years). Finalize the process by clicking "Add".

here (Microsoft docs)
here (Microsoft docs)
here (Microsoft docs)
from before
here
create a new one
22KB
Unified Contacts Documentation.postman_collection.json

Gets a contact with all meta data that is stored in the database

get
Path parameters
contactIdstringRequired

Id of the contact

Responses
200
Contact successfully found and returned
404
Contact with id not found
get
GET /api/v1/contacts/{contactId} HTTP/1.1
Host: 
Accept: */*
{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP",
  "id": "text"
}

Deletes an existing contact

delete
Path parameters
contactIdstringRequired

Id of the contact

Responses
200
Success
204
Contact was successfully deleted
404
Contact with id not found
delete
DELETE /api/v1/contacts/{contactId} HTTP/1.1
Host: 
Accept: */*

No content

  • Authentication
  • Prerequisites
  • Permission Setup
  • Acquiring a token
  • API Documentation
  • GETGets a contact with all meta data that is stored in the database
  • POSTCreates a new contact
  • PUTOverwrites the meta information of an existing contact
  • PATCHUpdates provided meta information of an existing contact
  • DELETEDeletes an existing contact

Creates a new contact

post
Body

Model that contains meta information about a contact that are necessary for CRUD operations

displayNamestring | nullableOptional

DisplayName of the contact

Example: John Doe
jobTitlestring | nullableOptional

JobTitle of the contact

Example: Software Developer
departmentstring | nullableOptional

Department of the contact

Example: Development
companyNamestring | nullableOptional

Name of company assosiated with the contact

Example: Fantastic Company Inc.
mailAddressesstring[] | nullableOptional

Email addresses of the contact

Example: ["john.doe@example.test"]
imAddressesstring[] | nullableOptional

Instant messaging addresses of the contact. Used for initiating a chat in Teams. If multiple imAddresses provided, the first one is used for intite a chat. If not provided the first eMail address of the contact is used.

Example: ["john.doe@example.test"]
mobilePhoneNumbersstring[] | nullableOptional

Mobile phone numbers of the contact

Example: ["+123456789"]
businessPhoneNumbersstring[] | nullableOptional

Business phone numbers of the contact

Example: ["+123456789"]
homePhoneNumbersstring[] | nullableOptional

Home phone numbers of the contact

Example: ["+123456789"]
addressFullStringstring | nullableOptional

Full address of the contact. If this is set it is used for displaying the address in the contact card. If not set the address is build from the other address properties.

Example: Any Street 1, 12345 Any City, Any Country
addressStreetAddressstring | nullableOptional

Street address of the contact

Example: Any Street 1
addressPostalCodestring | nullableOptional

Postal code of the contact

Example: 12345
addressCitystring | nullableOptional

City of the contact

Example: Any City
addressCountrystring | nullableOptional

Country of the contact

Example: Any Country
sourcestring | nullableOptional

Sub source of the contact. This is used to identify the source of the contact if you are using multiple sources, that are synced into the database.

Example: SAP
idstring | nullableOptional

Unique identifier of the contact

Example: sap_28648f3b-8a60-4ded-a2df-5f303a74a17a
Responses
200
Success
201
Contact was successfully created
409
Contact with id already exists
post
POST /api/v1/contacts HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 563

{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP",
  "id": "sap_28648f3b-8a60-4ded-a2df-5f303a74a17a"
}
{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP",
  "id": "text"
}

Overwrites the meta information of an existing contact

put
Path parameters
contactIdstringRequired

Id of the contact

Body

Model that contains meta information about a contact that are necessary for CRUD operations

displayNamestring | nullableOptional

DisplayName of the contact

Example: John Doe
jobTitlestring | nullableOptional

JobTitle of the contact

Example: Software Developer
departmentstring | nullableOptional

Department of the contact

Example: Development
companyNamestring | nullableOptional

Name of company assosiated with the contact

Example: Fantastic Company Inc.
mailAddressesstring[] | nullableOptional

Email addresses of the contact

Example: ["john.doe@example.test"]
imAddressesstring[] | nullableOptional

Instant messaging addresses of the contact. Used for initiating a chat in Teams. If multiple imAddresses provided, the first one is used for intite a chat. If not provided the first eMail address of the contact is used.

Example: ["john.doe@example.test"]
mobilePhoneNumbersstring[] | nullableOptional

Mobile phone numbers of the contact

Example: ["+123456789"]
businessPhoneNumbersstring[] | nullableOptional

Business phone numbers of the contact

Example: ["+123456789"]
homePhoneNumbersstring[] | nullableOptional

Home phone numbers of the contact

Example: ["+123456789"]
addressFullStringstring | nullableOptional

Full address of the contact. If this is set it is used for displaying the address in the contact card. If not set the address is build from the other address properties.

Example: Any Street 1, 12345 Any City, Any Country
addressStreetAddressstring | nullableOptional

Street address of the contact

Example: Any Street 1
addressPostalCodestring | nullableOptional

Postal code of the contact

Example: 12345
addressCitystring | nullableOptional

City of the contact

Example: Any City
addressCountrystring | nullableOptional

Country of the contact

Example: Any Country
sourcestring | nullableOptional

Sub source of the contact. This is used to identify the source of the contact if you are using multiple sources, that are synced into the database.

Example: SAP
Responses
200
Contact was successfully updated - full contact info is returned
404
Contact with id not found
put
PUT /api/v1/contacts/{contactId} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 515

{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP"
}
{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP",
  "id": "text"
}

Updates provided meta information of an existing contact

patch
Path parameters
contactIdstringRequired

Id of the contact

Body

Model that contains meta information about a contact that are necessary for CRUD operations

displayNamestring | nullableOptional

DisplayName of the contact

Example: John Doe
jobTitlestring | nullableOptional

JobTitle of the contact

Example: Software Developer
departmentstring | nullableOptional

Department of the contact

Example: Development
companyNamestring | nullableOptional

Name of company assosiated with the contact

Example: Fantastic Company Inc.
mailAddressesstring[] | nullableOptional

Email addresses of the contact

Example: ["john.doe@example.test"]
imAddressesstring[] | nullableOptional

Instant messaging addresses of the contact. Used for initiating a chat in Teams. If multiple imAddresses provided, the first one is used for intite a chat. If not provided the first eMail address of the contact is used.

Example: ["john.doe@example.test"]
mobilePhoneNumbersstring[] | nullableOptional

Mobile phone numbers of the contact

Example: ["+123456789"]
businessPhoneNumbersstring[] | nullableOptional

Business phone numbers of the contact

Example: ["+123456789"]
homePhoneNumbersstring[] | nullableOptional

Home phone numbers of the contact

Example: ["+123456789"]
addressFullStringstring | nullableOptional

Full address of the contact. If this is set it is used for displaying the address in the contact card. If not set the address is build from the other address properties.

Example: Any Street 1, 12345 Any City, Any Country
addressStreetAddressstring | nullableOptional

Street address of the contact

Example: Any Street 1
addressPostalCodestring | nullableOptional

Postal code of the contact

Example: 12345
addressCitystring | nullableOptional

City of the contact

Example: Any City
addressCountrystring | nullableOptional

Country of the contact

Example: Any Country
sourcestring | nullableOptional

Sub source of the contact. This is used to identify the source of the contact if you are using multiple sources, that are synced into the database.

Example: SAP
Responses
200
Contact was successfully updated - full contact info is returned
404
Contact with id not found
patch
PATCH /api/v1/contacts/{contactId} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 515

{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP"
}
{
  "displayName": "John Doe",
  "jobTitle": "Software Developer",
  "department": "Development",
  "companyName": "Fantastic Company Inc.",
  "mailAddresses": [
    "john.doe@example.test"
  ],
  "imAddresses": [
    "john.doe@example.test"
  ],
  "mobilePhoneNumbers": [
    "+123456789"
  ],
  "businessPhoneNumbers": [
    "+123456789"
  ],
  "homePhoneNumbers": [
    "+123456789"
  ],
  "addressFullString": "Any Street 1, 12345 Any City, Any Country",
  "addressStreetAddress": "Any Street 1",
  "addressPostalCode": "12345",
  "addressCity": "Any City",
  "addressCountry": "Any Country",
  "source": "SAP",
  "id": "text"
}