BatchResult 类

执行批处理请求的结果。

每个提交的 HTTP 操作都包含一个 BatchItemResponse 。 扩展到多个 HTTP 请求的操作(例如 add_columns 包含三列)贡献了三个条目。

示例:


   result = client.batch.new().execute()
   print(f"Succeeded: {len(result.succeeded)}, Failed: {len(result.failed)}")
   for guid in result.entity_ids:
       print(f"[OK] entity_id: {guid}")

构造函数

BatchResult(responses: ~typing.List[~PowerPlatform.Dataverse.models.batch.BatchItemResponse] = <factory>)

参数

名称 说明
responses

提交顺序中的所有响应。

默认值: <factory>

属性

entity_ids

OData-EntityId 成功响应的标头中提取的 GUID。

从包含标头的任何成功 (2xx) 响应中返回实体 OData-EntityId ID。 单个 POST (create)和 PATCH (update)操作都返回具有记录 GUID 的此标头。 GETDELETE 操作不。

注释

CreateMultiple 和 UpsertMultiple 操作响应不

返回每条记录 OData-EntityId 标头。 他们的 ID 位于

JSON 响应正文(data[“Ids”])。 通过:

for resp in result.succeeded:

if resp.data and "Ids" in resp.data:

    bulk_ids = resp.data["Ids"]

failed

包含非 2xx 状态代码的响应。

has_errors

如果任何响应具有非 2xx 状态代码,则为 True。

succeeded

具有 2xx 状态代码的响应。

responses

responses: List[BatchItemResponse]