Powerbi 电力BI REST API请求采取措施

Powerbi 电力BI REST API请求采取措施,powerbi,Powerbi,我创建了一个没有重大影响的数据集 {\"tableName\": \"Sales\" ,\"columns\": [ {\"name\":\"ProductID\", \"dataType\":\"int64\", \"summarizeBy\":\"none\", \"isHidden\":\"True\", \"formatString\":\"#,##0\"} , {\"name\":\"Date\", \"dataType\":\"DateTime\", \"forma

我创建了一个没有重大影响的数据集

{\"tableName\": \"Sales\"
,\"columns\": [ 
    {\"name\":\"ProductID\", \"dataType\":\"int64\", \"summarizeBy\":\"none\", \"isHidden\":\"True\", \"formatString\":\"#,##0\"}
    , {\"name\":\"Date\", \"dataType\":\"DateTime\", \"formatString\":\"dd/mm/yyyy\"}
    , {\"name\":\"TipID\", \"dataType\":\"int64\", \"summarizeBy\":\"none\", \"isHidden\":\"True\", \"formatString\":\"#,##0\"}
    , {\"name\":\"Sales\", \"dataType\":\"double\", \"formatString\":\"#,##0\"}
    ]
}
,但当我尝试采取一些措施时,总是会收到一个“坏请求”

我创建了一个“”仅在其中添加度量值,但出现了相同的错误

        HttpContent body = new StringContent(postBody);
        body.Headers.ContentType = new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json");
        HttpClient client = new HttpClient();
        client.DefaultRequestHeaders.Add("Accept", "application/json");
        client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
        HttpResponseMessage response = client.PutAsync(restUri, body).Result;
JSON

{\"tableName\": \"Sales\"
, \"measures\": [
    {\"name\": \"TrySales\", \"expression\": \"CALCULATE(SUM(Ventas[Venta]);SUM(Sales[Sales])\"}
  ]
}
我只找到了一个示例代码

PUT的结果

标题

 {StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Pragma: no-cache
  Transfer-Encoding: chunked
  Strict-Transport-Security: max-age=31536000; includeSubDomains
  X-Frame-Options: deny
  X-Content-Type-Options: nosniff
  RequestId: 6aa4198c-8315-4517-8f78-b5f90e6d1375
  Access-Control-Expose-Headers: RequestId
  request-redirected: true
  home-cluster-uri: https://wabi-europe-north-b-redirect.analysis.windows.net/
  Cache-Control: no-store, must-revalidate, no-cache
  Date: Fri, 15 Nov 2019 13:08:36 GMT
  Content-Type: application/json; charset=utf-8
}}
请求消息

 {Method: PUT, RequestUri: 'https://api.powerbi.com/v1.0/myorg/groups/1cd4f3cf-xxxx-41dd-83e4-c17708511d79/datasets/35b36723-ed24-xxxx-8e54-fc8e3a1503fe/tables/Sales'
, Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
  Accept: application/json
  Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkJCOE...
  Content-Type: application/json
  Content-Length: 147
}}
有什么建议吗

编辑 回应


这似乎是由于文档中的错误导致的拼写错误。在中,它显示为“tableName”,我没有找到更多的示例。

这是文档中的一个错误。 文档中的这一点在json中有
tableName
。但是,当您单击主体时,主体具有
名称


使用
name
而不是
tableName
对我来说很有效。

这是文档中的一个错误。 文档中的这一点在json中有
tableName
。但是,当您单击主体时,主体具有
名称


使用
name
而不是
tableName
对我来说很有效。

当你收到一个错误的请求时,响应内容中有什么内容?@AndreyNikolov,我已经用PUT响应内容完成了问题,但是响应内容不在这里。正如您在响应头中看到的,有一些内容:
content-Type:application/json;字符集=utf-8
。错误的原因很可能就在那里。@AndreyNikolov,是一个拼写错误,在问题的末尾,我已经详细说明了。谢谢你的时间。当你收到一个不好的请求时,响应内容中有什么?@AndreyNikolov,我已经用PUT响应内容完成了问题,但是响应内容不在这里。正如您在响应头中看到的,有一些内容:
content-Type:application/json;字符集=utf-8
。错误的原因很可能就在那里。@AndreyNikolov,是一个拼写错误,在问题的末尾,我已经详细说明了。谢谢你抽出时间。
 {Method: PUT, RequestUri: 'https://api.powerbi.com/v1.0/myorg/groups/1cd4f3cf-xxxx-41dd-83e4-c17708511d79/datasets/35b36723-ed24-xxxx-8e54-fc8e3a1503fe/tables/Sales'
, Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
  Accept: application/json
  Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkJCOE...
  Content-Type: application/json
  Content-Length: 147
}}
Id = 37, Status = RanToCompletion
, Method = "{null}"
, Result = "{\"error\":{
    \"code\":\"BadRequest\"
    ,\"message\":\"Bad Request\"
    ,\"details\":[
        {\"message\":\"The property 'tableName' does not exist on type 'Microsoft.PowerBI.ServiceContracts.Api.Table'
        . Make sure to only use property names that are defined by the type.\"
        ,\"target\":\"tableSchema\"}
        ]
    }
    }