Synchronize Contacts to Mobile Client
Synchronize the current user's contacts to the NovoOne Mobile Client for local storage and offline access.
Request URL
POST {base_url}/uc-ccontact/api/v1/contacts/sync
Request parameters
- Headers
-
Parameter Required Type Description Authorization Yes String The access token used for authentication. Format: Bearer
{access_token}.x-tenant-code Yes String The tenant name. Note: You can obtain tenant name using the Query Tenants interface.
- Body parameters
-
Parameter Required Type Description contactType Yes String The type of contacts to synchronize.
Valid value:
CONTACT_TYPE_USER: Internal users.CONTACT_TYPE_PERSONAL: Personal contacts.CONTACT_TYPE_COMPANY: Company contacts.
syncMode Yes String The synchronization mode.
Valid value:
SYNC_MODE_FULL: Full synchronization to synchronize contacts that exist within the snapshot time range.SYNC_MODE_INCREMENTAL: Incremental synchronization to synchronize contacts since the specified cursor.
dataKind Yes String The type of data to synchronize.
Valid value:
SYNC_DATA_KIND_BASE: Basic contact data.SYNC_DATA_KIND_FAVORITE: Favorite status changes.
cursor No String The timestamp cursor used to retrieve the next page of contacts, in milliseconds. Note: For the first request, pass0; For subsequent requests, pass thenextCursorvalue returned in the previous response.cursorId No String The record ID used with cursorto distinguish multiple records with the same timestamp.Note: For the first request, pass0; For subsequent requests, pass thenextCursorIdvalue returned in the previous response.snapshotTime No String The timestamp that defines the data range for a full synchronization, in milliseconds.
Note:- This parameter applies to full synchronization only.
- For the first full synchronization request, pass
0; For subsequent requests, pass thesnapshotTimevalue returned in the first response.
pageSize No Integer The number of records to retrieve per page.
Response parameters
| Parameter | Type | Description |
|---|---|---|
| requestId | String | The unique ID of the request, which can be used to quickly locate the request. |
| code | String | The HTTP status code of the request.
|
| message | String | The status message of the request. |
| detailMessage | String | The detailed error information. When the request is successful, this parameter returns empty. |
| result | Object<Sync_Result> | The synchronization result. |
- Sync_Result
-
Parameter Type Description items Array<Sync_Item> The contact records returned on the current page. nextCursor String The timestamp cursor for the next page, in Unix timestamp format (milliseconds). nextCursorId String The ID of the last record on the current page, used with nextCursorfor pagination.snapshotTime String The snapshot timestamp generated for full synchronization, in Unix timestamp format (milliseconds). hasNext Boolean Whether more records exist on the next page.
- Sync_Item
-
Parameter Type Description id String The unique identifier of the contact. type String The type of the contact.
CONTACT_TYPE_USER: Internal users.CONTACT_TYPE_PERSONAL: Personal contacts.CONTACT_TYPE_COMPANY: Company contacts.
deleted Boolean Whether the contact is deleted. deletedAt String The timestamp when the contact was deleted, in Unix timestamp format (milliseconds). firstName String The contact's first name. lastName String The contact's last name. namePinyin String The contact's name represented using Chinese phonetic spelling, with the last name followed by the first name. namePinyinReverse String The contact's name represented using Chinese phonetic spelling, with the first name followed by the last name. extension String The extension number of the contact. Note: This parameter is returned with a value only whentypeisCONTACT_TYPE_USER.currentPresence String The presence status of the contact.
Note: This parameter is returned with a value only whentypeisCONTACT_TYPE_USER.AVAILABLEAWAYDNDLUNCHBUSINESS_TRIPOFF_WORK
isFavorited Boolean Whether the current user has added the contact to favorites. avatarUrl String The URL of the contact avatar. Note: This parameter returns with a value only when the contact type isCONTACT_TYPE_USER.online Boolean Whether the contact is online. Note: This parameter is returned with a value only whentypeisCONTACT_TYPE_USER.
Example
Request example
POST /uc-ccontact/api/v1/contacts/sync HTTP/1.1
Host: api.cn.novoone.com
Authorization: Bearer eyJraWQiOiJjbi0wLWtleS0xIiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJkaXN0cmlidXRvcmV4YW1wbGVAb3V0bG9vay5jb20iLCJncmFudF90eXBlIjoib3BlbmFwaSIsImNsaWVudF9leHQiOnsiZGVzY3JpcHRpb24iOiLnrKzkuInmlrnlkIjkvZzkvJnkvLTlupTnlKgiLCJwYXJ0bmVyIjoi56S65L6L5ZCI5L2c5LyZ5Ly0In0sImNsaWVudF90eXBlIjoib3BlbmFwaSIsImV4cCI6MTc5MTc5ODcyMSwiaWF0IjoxNzkxNzc3MTIxLCJqdGkiOiI3YjRmNDQ3MC1jZmI0LTQ3NTAtYTg4Zi01ZjIxNjY5ZDI3NzUiLCJjbGllbnRfaWQiOiJub3ZvLW9wZW4tcGxhdGZvcm0iLCJ1c2VyX2V4dCI6eyJyb2xlSWRzIjpbM10sInN0eXBlIjoiQURNSU4iLCJ0ZW5hbnRDb2RlIjpudWxsLCJ0eXBlIjoiUF9BQ0NPVU5UIiwidXNlcklkIjozMDc2OTEzNjQ0OTE1OTk4NzIwLCJlbWFpbCI6ImRpc3RyaWJ1dG9yZXhhbXBsZUBvdXRsb29rLmNvbSIsInVzZXJuYW1lIjoiZGlzdHJpYnV0b3JleGFtcGxlQG91dGxvb2suY29tIiwidWNJZCI6MzA3NjkxMzY0NDg5MDgzMjg5Nn19.Vb9Xw8-vvI689EzR9bl9jrH3BWBDrYPl9c10AzyTv-LjTxxbNdYiz-9k_FBhe3HSqSeLdDXb0py1fzUhJ-e2wIn9Sq2ZeOz4IQAJQwjmyG9-Kk0jy43iyLkcBO7LQxfVQksnKs7hB0cG9FIhoil-FiQL_mUwNHCVN-BnfoN4Dyiyp7BE8nHiehlng4SUQ5zxgQf_JlqALzcP6bNlvp4k1AfjoY2KKQ7H7g9nGSZZZ2fv_j65-j_XJKpLR4ujC7iDH6MezGg8RgOKwHE2HSgtxfiIrHF8wQVhrlKFgCGu1dvszp5mvXPXLy3WnMjuCCidLYI2NvRhfVHd1VzB13XteA
Content-Type: application/json
x-tenant-code: jint
{
"contactType": "CONTACT_TYPE_USER",
"syncMode": "SYNC_MODE_FULL",
"dataKind": "SYNC_DATA_KIND_BASE",
"cursor": "0",
"cursorId": "0",
"snapshotTime": "0",
"pageSize": 10
}
Response example
HTTP/1.1 200 OK { "requestId": "75aa26752d1a49ab60b0800b5eed61f6", "code": "200", "message": "SUCCESS", "detailMessage": "", "result": { "items": [ { "id": "355536619424391168", "type": "CONTACT_TYPE_USER", "deleted": false, "deletedAt": "0", "firstName": "3", "lastName": "1", "namePinyin": "", "extension": "1000", "namePinyinReverse": "", "currentPresence": "AVAILABLE", "isFavorited": false, "avatarUrl": "", "online": false }, { "id": "355545562435493888", "type": "CONTACT_TYPE_USER", "deleted": false, "deletedAt": "0", "firstName": "Leo", "lastName": "", "namePinyin": "", "extension": "1001", "namePinyinReverse": "", "currentPresence": "AVAILABLE", "isFavorited": false, "avatarUrl": "", "online": true } ], "nextCursor": "1788835873936", "hasNext": false, "nextCursorId": "355545562435493888", "snapshotTime": "1791777048449" } }