微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

有谁知道如何使用邮递员批量插入到 azure 表存储

如何解决有谁知道如何使用邮递员批量插入到 azure 表存储

我想使用邮递员对 Azure 表存储执行实体组事务。请让我知道示例请求正文以执行批处理操作。我尝试使用 this link 中提到的示例请求正文访问端点,但仍然没有运气。

网址:https://azautomationdiag.table.core.windows.net/$batch"?sp==SASTokenTest"

标题enter image description here

参数:enter image description here

身体:

 `
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce
Content-Type: multipart/mixed; boundary=changeset_8a28b620-b4bb-458c-a177-0959fb14c977  

--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-transfer-encoding: binary


POST https://azautomationdiag.table.core.windows.net/InstalledApplications HTTP/1.1  
Content-Type: application/json  
Content-Length: [1322] 
Accept: application/json;odata=minimalMetadata  
DataServiceVersion: 3.0;  

{"PartitionKey":"Channel_19","RowKey":"1","rating":9,"Text":".NET..."}  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-transfer-encoding: binary


POST https://azautomationdiag.table.core.windows.net/InstalledApplications HTTP/1.1  
Content-Type: application/json  
Accept: application/json;odata=minimalMetadata  
Prefer: return-no-content  
DataServiceVersion: 3.0;  
  
{"PartitionKey":"Channel_19","RowKey":"2","Text":"Azure..."}  
--changeset_8a28b620-b4bb-458c-a177-0959fb14c977  
Content-Type: application/http  
Content-transfer-encoding: binary

--changeset_8a28b620-b4bb-458c-a177-0959fb14c977--
--batch_f351702c-c8c8-48c6-af2c-91b809c651ce

` 回复enter image description here

解决方法

根据我的测试,请求正文应该是这样的

--batch_guid
Content-Type: multipart/mixed; boundary=changeset_guid

--changeset_guid
Content-Type: application/http
Content-Transfer-Encoding: binary

<your request>

--changeset_guid
Content-Type: application/http
Content-Transfer-Encoding: binary

<your request> 
--changeset_guid--
--batch_guid--

例如

请求

https://andyprivate.table.core.windows.net?$batch{sastoken}

标题

MaxDataServiceVersion: 3.0;NetFx
Accept: application/json; odata=minimalmetadata
DataServiceVersion: 3.0;
x-ms-version: 2017-07-29
Content-Type: multipart/mixed; boundary=batch_e4071276-6bca-459b-af6b-c18e5eb42106
Accept-Charset: UTF-8
Connection:Keep-Alive

请求正文

--batch_e4071276-6bca-459b-af6b-c18e5eb42106
Content-Type: multipart/mixed; boundary=changeset_52c5f249-48de-4ae5-89e6-b288a26099f1

--changeset_52c5f249-48de-4ae5-89e6-b288a26099f1
Content-Type: application/http
Content-Transfer-Encoding: binary

POST https://andyprivate.table.core.windows.net/test HTTP/1.1
Accept: application/json;odata=minimalmetadata
Content-Type: application/json
Prefer: return-no-content
DataServiceVersion: 3.0;

{"PartitionKey":"Channel_19","RowKey":"1","Rating":9,"Text":".NET..."} 
--changeset_52c5f249-48de-4ae5-89e6-b288a26099f1
Content-Type: application/http
Content-Transfer-Encoding: binary

POST https://andyprivate.table.core.windows.net/test HTTP/1.1
Accept: application/json;odata=minimalmetadata
Content-Type: application/json
Prefer: return-no-content
DataServiceVersion: 3.0;

{"PartitionKey":"Channel_19","RowKey":"2","Text":"Azure..."}  
--changeset_52c5f249-48de-4ae5-89e6-b288a26099f1
Content-Type: application/http
Content-Transfer-Encoding: binary

POST https://andyprivate.table.core.windows.net/test HTTP/1.1
Accept: application/json;odata=minimalmetadata
Content-Type: application/json
Prefer: return-no-content
DataServiceVersion: 3.0;

{"PartitionKey":"Channel_19","RowKey":"3","Rating":4,"Text":"Java..."}  
--changeset_52c5f249-48de-4ae5-89e6-b288a26099f1--
--batch_e4071276-6bca-459b-af6b-c18e5eb42106--

enter image description here enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。