简体   繁体   English

POST JSON数据以增强Bi API 404错误

[英]POST JSON data to power bi api 404 ERROR

I'm pushing a csv, converted to a JSON file, to my power bi api. 我正在将csv(转换为JSON文件)推送到我的Power Bi API。 Each individual column is shown correctly on power bi, however, when confronting the code with adding rows to the column, I receive a 404 error: 在power bi上正确显示了每个单独的列,但是,在面对向该列添加行的代码时,我收到404错误:

Succes:  200
Succes:  200
response status dataset:  201 
dataset responses:  200

response status rows:  404 {"error":{"code":"ItemNotFound","message":"Column '<pi>event_name</pi>' was not found in specified table, dataset 'sobe_wowvirtualserver|*somenumberhere*'"}}

These are the columns that were uploaded with success: 这些是成功上传的列:

columns_body_raw = {"name": "test", "tables":
    [
        {"name": "test", "columns": 
            [
                { "name": "id", "dataType": "Int64"},
                { "name": "status", "dataType": "string"},
                { "name": "location", "dataType": "string"},
                { "name": "reportLocation", "dataType": "Int64"},
                { "name": "preferences", "dataType": "Int64"},
                { "name": "activity_description", "dataType": "string"},
                { "name": "activity_qualification", "dataType": "string"},
                { "name": "activity_businessActivity", "dataType": "string"},
                { "name": "activity_abbreviation", "dataType": "string"},
                { "name": "planned_start_date", "dataType": "string"},
                { "name": "planned_start_time", "dataType": "string"},
                { "name": "planned_end_date", "dataType": "string"},
                { "name": "planned_end_time", "dataType": "string"},
                { "name": "planned_duration", "dataType": "Int64"},
                { "name": "projected_cost", "dataType": "Int64"},
                { "name": "clock_in_date", "dataType": "string"},
                { "name": "clock_in_time", "dataType": "string"},
                { "name": "clock_out_date", "dataType": "string"},
                { "name": "clock_out_time", "dataType": "string"},
                { "name": "clocked_duration", "dataType": "string"},
                { "name": "break_duration", "dataType": "Int64"},
                { "name": "price", "dataType": "Int64"},
                { "name": "order_no", "dataType": "Int64"},
                { "name": "event_id", "dataType": "Int64"},
                { "name": "department", "dataType": "string"},
                { "name": "department_cost_center", "dataType": "Int64"},
                { "name": "worker_first_name", "dataType": "string"},
                { "name": "worker_preposition", "dataType": "string"},
                { "name": "worker_last_name", "dataType": "string"},
                { "name": "worker_full_name", "dataType": "string"},
                { "name": "personnel_number", "dataType": "Int64"},
                { "name": "partner", "dataType": "string"},
                { "name": "employee_type", "dataType": "string"},
                { "name": "employee_default_cost_center", "dataType": "Int64"},
                { "name": "authorized_partner", "dataType": "string"},
                { "name": "incident", "dataType": "Int64"},
                { "name": "tags", "dataType": "Int64"},
                { "name": "sketch_start_date", "dataType": "string"},
                { "name": "sketch_start", "dataType": "string"},
                { "name": "sketch_end_date", "dataType": "string"},
                { "name": "sketch_end", "dataType": "string"},
                { "name": "delta_time", "dataType": "string"},
                { "name": "delta_plan", "dataType": "Int64"},
                { "name": "delta_clock", "dataType": "Int64"},
                { "name": "event_name", "dataType": "string"} #this is one of the columns that gives an error

            ]
        }
dataset_body = json.dumps(columns_body_raw)

And this these are some of the rows where my error occurs: 这是发生我的错误的一些行:

dataset_body_raw = { "rows": [{
            "sketch_end": "0",
            "order_no": "2017",
            "activity_qualification": "TEST",
            "clock_out_date": "0",
            "activity_businessActivity": "BUSINESS NAME TEST",
            "clock_in_time": "0",
            "partner": "COMPANY",
            "event_name": "EVENT"
            }]}
    dataset_body = json.dumps(dataset_body_raw)

The 404 error states that there is no event_name column, though it is listed in the columns_body_raw and I can see it in my power bi environment. 404错误指出虽然没有column_body_raw中列出的event_name列,但我在power bi环境中可以看到它。

This is a screenshot of power bi: 这是power bi的屏幕截图: event_name列

I used the wrong response dataset id, therefore the dataset linked to an older version of a dataset in power bi, which did not include that specific column. 我使用了错误的响应数据集ID,因此该数据集链接到Power Bi中较旧版本的数据集,其中不包含该特定列。 Concluding: the code above is the correct way to post rows in a column with the power bi API. 结论:上面的代码是使用power bi API在列中发布行的正确方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM