是否可以通过 API 设置 RingCentral 用户的时区? [英] Is it possible to set a RingCentral user's timezone through the API?

查看:44
本文介绍了是否可以通过 API 设置 RingCentral 用户的时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 API 查找如何设置时区,但找不到它.有没有办法通过 API 设置时区?

I was looking thru the API for how to set timezone and cannot find it. Is there not a way to set the timezone thru the API?

推荐答案

用户的时区设置为其扩展属性的一部分,使用扩展信息 API 读取并通过更新扩展信息端点设置,而不是特定的时区端点.我将从读取开始,因为响应提供了一种创建更新时区请求的简单方法.

A user's timezone is set as part of their extension properties and is read using the Extension Info API and set via the Update Extension Info endpoint, not a specific timezone endpoint. I'll start with the read because the response provides an easy way to create the update timezone request.

读取时区

要读取用户的当前时区,请使用以下端点检索用户的设置信息.你会得到很多属性.从响应中,您可以看到如何创建更新请求.

To read the user's current timezone, retrieve the user's settings info using the following endpoint. You will get a lot of properties. From the response, you can see how to create the update request.

GET /restapi/v1.0/account/{accountId}/extension/{extensionId}

响应将包含大量信息,包括如图所示的时区.在您的更新请求中使用此 JSON 路径,时区 ID 稍后显示.

The response will contain a lot of information including the timezone as shown. Use this JSON path in your update request with a timezone id shown later below.

{
    "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222",
    "id": 22222222,
    "extensionNumber": "101",
    ...
    "regionalSettings": {
        "timezone": {
            "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/60",
            "id": "60",
            "name": "Pacific/Honolulu",
            "description": "Hawaii",
            "bias": "-600"
        },...
    }
}

在 API 参考中查看更多信息:

See more in the API Reference:

https://developer.ringcentral.com/api-reference#User-Settings-loadExtensionInfo

设置时区

要设置用户的时区,请使用 PUT 方法更新用户的扩展端点,并在正文中指定时区 ID,如图所示.时区 ID 可以在接下来显示的时区端点中找到.

To set a user's timezone, update the user's extension endpoint using the PUT method and specify the timezone id in the body as shown. The timezone ids can be found in the timezone endpoint shown next.

PUT /restapi/v1.0/account/{accountId}/extension/{extensionId}

{
    "regionalSettings": {
        "timezone": {
            "id": "58"
        }
    }
}

https://developer.ringcentral.com/api-reference#User-设置-更新扩展

列出时区

要获取时区列表,请调用时区端点:

To get a list of timezones, call the timezone endpoint:

GET /restapi/v1.0/dictionary/timezone

响应提供时区列表,其中包含更新用户设置请求中使用的描述和时区 ID.

The response provides a list of timezones with description and a timezone id that is used in the update user settings request.

{
    "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone?page=1&perPage=100",
    "records": [
        {
            "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/1",
            "id": "1",
            "name": "GMT",
            "description": "Casablanca, Monrovia, Reykjavik",
            "bias": "0"
        },
        {
            "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/2",
            "id": "2",
            "name": "Europe/Lisbon",
            "description": "Dublin, Edinburgh, Lisbon, London",
            "bias": "0"
        },
        ...
        {
            "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/dictionary/timezone/91",
            "id": "91",
            "name": "Asia/Pyongyang",
            "description": "Pyongyang",
            "bias": "510"
        }
    ],
    "paging": {...},
    "navigation": {...}
}

有关详细信息,请参阅 API 参考:

See the API Reference for more information:

https://developer.ringcentral.com/api-reference#Regional-Settings-listTimezones

这篇关于是否可以通过 API 设置 RingCentral 用户的时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆