SamTn
SamTn

Reputation: 3

does anyone know how to batch insert to azure table storage using post man

I would like to perform entity group transactions to azure table storage using postman. please let me know the sample request body to perform the batch operation. I tried to hit the endpoint using the sample request body mentioned in this link still no luck.

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

Header: enter image description here

Parameters: enter image description here

Body:

 `
--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", "Rating":9, "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

` Response: enter image description here

Upvotes: 0

Views: 735

Answers (1)

Jim Xu
Jim Xu

Reputation: 23141

According to my test, the request body should be like

--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--

For example

Request

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

Header

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

Request Body

--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", "Rating":9, "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

Upvotes: 0

Related Questions