代码之家  ›  专栏  ›  技术社区  ›  Grokify Milad

如何设置RingCentral hold音乐?

  •  0
  • Grokify Milad  · 技术社区  · 6 年前

    API Reference

    以下是有关此功能的一些信息:

    enter image description here

    0 回复  |  直到 6 年前
        2
  •  0
  •   Grokify Milad    5 年前

    这有两个步骤:

    1. business-hours-rule 获取调用处理规则API 获取当前标准和自定义规则的列表。
    2. 更新问候API 具有 type 设置为 HoldMusic answeringRuleId 设置为要更新的id,例如。 营业时间规则

    1. multipart/form-data 有单独的弦乐部分。在这种方法中,单独的部分与名称一起发送 类型 , ,和 binary
    2. 多部分/表单数据 json 发送的有效载荷如下: {"type": "HoldMusic", "answeringRule": { "id": "12345678" }}
    3. multipart/mixed

    多部分/表单数据 因为它很容易与cURL和许多HTTP客户端等工具一起使用。

    package main
    
    import(
        "log"
        "net/http"
        "net/url"
        "os"
    
        "github.com/grokify/gotilla/mime/multipartutil"
        "github.com/grokify/oauth2more/ringcentral"
    )
    
    func main() {
    
        // Get the Client (*http.Client):
        client, err = ringcentral.NewClientPassword(
            ringcentral.ApplicationCredentials{
                ClientID:     os.Getenv("RINGCENTRAL_CLIENT_ID"),
                ClientSecret: os.Getenv("RINGCENTRAL_CLIENT_SECRET"),
                ServerURL:    os.Getenv("RINGCENTRAL_SERVER_URL")},
            ringcentral.PasswordCredentials{
                Username:  os.Getenv("RINGCENTRAL_USERNAME"),
                Extension: os.Getenv("RINGCENTRAL_EXTENSION"),
                Password:  os.Getenv("RINGCENTRAL_PASSWORD")})
        if err!=nil {
            log.Fatal(err)
        }
    
        // Create the HTTP Request (*http.Request)
        params := url.Values{}
        params.Set("type", "HoldMusic")
        params.Set("answeringRuleId", "business-hours-rule")
    
        req, err := multipartutil.NewRequest(
            http.MethodPost,
            "https://platform.ringcenral.com/restapi/v1.0/account/~/extension/~/greeting",
            params,
            []multipartutil.FileInfo{
                {
                    MIMEPartName: "binary",
                    Filepath:     "mygreeting.wav",
                },
            },
        )
    
        // Send the request
        resp, err = client.Do(req)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("STATUS: %v\n", resp.StatusCode) 
    }
    
    推荐文章