table 存储上 azure REST 实体组事务的 InvalidInput
InvalidInput on azure REST entity group transaction on table storage
我不知道在这里做什么。根据文档
https://docs.microsoft.com/en-us/rest/api/storageservices/performing-entity-group-transactions
我向
发送了一个post请求
var url = 'https://$myaccount.table.core.windows.net/$batch?sv=($sasToken)'
headers:
var headers = {
"x-ms-date": "2021-12-06 22:12:15.862319Z"
"Accept-Charset": "UTF-8"
"x-ms-version": "2020-10-02"
"content-type": "multipart/mixed; boundary=batch_8360b73e-53ce-4ab8-8de8-3894086bd694"
"Connection": "Keep-Alive"
"DataServiceVersion": "3.0"
"MaxDataServiceVersion": "3.0;NetFx"
}
body:
var body = '''
--batch_8360b73e-53ce-4ab8-8de8-3894086bd694
content-type: multipart/mixed; boundary=changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
Connection: Keep-Alive
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0;NetFx
--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
Content-Type: application/http
Content-Transfer-Encoding: binary
DataServiceVersion: 3.0
POST https://stg1235.table.core.windows.net/Tahsel HTTP/1.1
Accept: application/json;odata=minimalmetadata
Accept-Encoding: identity
x-ms-date: 2021-12-06 22:12:15.862319Z
Accept-Charset: UTF-8
x-ms-version: 2020-10-02
content-type: application/json
content-length: 259
If-Match: *
{"PartitionKey":"info","RowKey":"session_e1a63e98-76f5-40e5-a529-bf065c025201","accId":"a9ee53f4-b61a-4bfa-a02a-378d45ce1996","accTitle":"147","amount":null,"userId":null,"userTitle":null,"pwd":null,"isAdmin":null,"accounts":null,"note":null,"TimeStamp":null}
--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
Content-Type: application/http
Content-Transfer-Encoding: binary
DataServiceVersion: 3.0
POST https://stg1235.table.core.windows.net/Tahsel HTTP/1.1
Accept: application/json;odata=minimalmetadata
Accept-Encoding: identity
x-ms-date: 2021-12-06 22:12:15.862319Z
Accept-Charset: UTF-8
x-ms-version: 2020-10-02
content-type: application/json
content-length: 259
If-Match: *
{"PartitionKey":"info","RowKey":"session_a9ee53f4-b61a-4bfa-a02a-378d45ce1996","accId":"a9ee53f4-b61a-4bfa-a02a-378d45ce1996","accTitle":"147","amount":null,"userId":null,"userTitle":null,"pwd":null,"isAdmin":null,"accounts":null,"note":null,"TimeStamp":null}
--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
--batch_8360b73e-53ce-4ab8-8de8-3894086bd694
''';
响应body是这样的:
--batchresponse_653e0e1c-9c26-4ae4-b719-73ac6941ea35
Content-Type: multipart/mixed; boundary=changesetresponse_88428c7e-a6c1-42b2-88d4-3e5302598b3e
--changesetresponse_88428c7e-a6c1-42b2-88d4-3e5302598b3e
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 400 Bad Request
DataServiceVersion: 1.0;
Content-Type: application/xml;charset=utf-8
<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>InvalidInput</code><message xml:lang="en-US">0:An error occurred while processing this request.
RequestId:423d29a2-f002-0060-6dee-eab0ca000000
Time:2021-12-06T22:12:19.5460529Z</message></error>
--changesetresponse_88428c7e-a6c1-42b2-88d4-3e5302598b3e--
--batchresponse_653e0e1c-9c26-4ae4-b719-73ac6941ea35--
我还尝试 http.MultipartRequest
一次将有效负载作为字段发送,另一次作为文件发送,但都失败了
我使用http.Request
发送和接收数据,所有CRUD操作都成功!
'--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987--'
收尾变更集必须有收尾--
我不知道在这里做什么。根据文档 https://docs.microsoft.com/en-us/rest/api/storageservices/performing-entity-group-transactions
我向
发送了一个post请求var url = 'https://$myaccount.table.core.windows.net/$batch?sv=($sasToken)'
headers:
var headers = {
"x-ms-date": "2021-12-06 22:12:15.862319Z"
"Accept-Charset": "UTF-8"
"x-ms-version": "2020-10-02"
"content-type": "multipart/mixed; boundary=batch_8360b73e-53ce-4ab8-8de8-3894086bd694"
"Connection": "Keep-Alive"
"DataServiceVersion": "3.0"
"MaxDataServiceVersion": "3.0;NetFx"
}
body:
var body = '''
--batch_8360b73e-53ce-4ab8-8de8-3894086bd694
content-type: multipart/mixed; boundary=changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
Connection: Keep-Alive
DataServiceVersion: 3.0
MaxDataServiceVersion: 3.0;NetFx
--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
Content-Type: application/http
Content-Transfer-Encoding: binary
DataServiceVersion: 3.0
POST https://stg1235.table.core.windows.net/Tahsel HTTP/1.1
Accept: application/json;odata=minimalmetadata
Accept-Encoding: identity
x-ms-date: 2021-12-06 22:12:15.862319Z
Accept-Charset: UTF-8
x-ms-version: 2020-10-02
content-type: application/json
content-length: 259
If-Match: *
{"PartitionKey":"info","RowKey":"session_e1a63e98-76f5-40e5-a529-bf065c025201","accId":"a9ee53f4-b61a-4bfa-a02a-378d45ce1996","accTitle":"147","amount":null,"userId":null,"userTitle":null,"pwd":null,"isAdmin":null,"accounts":null,"note":null,"TimeStamp":null}
--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
Content-Type: application/http
Content-Transfer-Encoding: binary
DataServiceVersion: 3.0
POST https://stg1235.table.core.windows.net/Tahsel HTTP/1.1
Accept: application/json;odata=minimalmetadata
Accept-Encoding: identity
x-ms-date: 2021-12-06 22:12:15.862319Z
Accept-Charset: UTF-8
x-ms-version: 2020-10-02
content-type: application/json
content-length: 259
If-Match: *
{"PartitionKey":"info","RowKey":"session_a9ee53f4-b61a-4bfa-a02a-378d45ce1996","accId":"a9ee53f4-b61a-4bfa-a02a-378d45ce1996","accTitle":"147","amount":null,"userId":null,"userTitle":null,"pwd":null,"isAdmin":null,"accounts":null,"note":null,"TimeStamp":null}
--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987
--batch_8360b73e-53ce-4ab8-8de8-3894086bd694
''';
响应body是这样的:
--batchresponse_653e0e1c-9c26-4ae4-b719-73ac6941ea35
Content-Type: multipart/mixed; boundary=changesetresponse_88428c7e-a6c1-42b2-88d4-3e5302598b3e
--changesetresponse_88428c7e-a6c1-42b2-88d4-3e5302598b3e
Content-Type: application/http
Content-Transfer-Encoding: binary
HTTP/1.1 400 Bad Request
DataServiceVersion: 1.0;
Content-Type: application/xml;charset=utf-8
<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>InvalidInput</code><message xml:lang="en-US">0:An error occurred while processing this request.
RequestId:423d29a2-f002-0060-6dee-eab0ca000000
Time:2021-12-06T22:12:19.5460529Z</message></error>
--changesetresponse_88428c7e-a6c1-42b2-88d4-3e5302598b3e--
--batchresponse_653e0e1c-9c26-4ae4-b719-73ac6941ea35--
我还尝试 http.MultipartRequest
一次将有效负载作为字段发送,另一次作为文件发送,但都失败了
我使用http.Request
发送和接收数据,所有CRUD操作都成功!
'--changeset_7d6bec6f-eced-4cd9-8b40-9f9c528fd987--'
收尾变更集必须有收尾--