cancel
Showing results for 
Search instead for 
Did you mean: 

Service Layer: batch operations

CarlesCostaMun
Participant

Hi everyone,

I try to CREATE TWO BUSINESSPARTNERS IN A SINGLE BATCH REQUEST, but i recieve this error:

--batchresponse_9fmXUprC-We1M-Hp8F-kZ52-rRJnN06M6gxQ
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=utf-8
Content-Length: 129

{
"error" : {
"code" : -1,
"message" : {
"lang" : "en-us",
"value" : "BadFormat"
}
}
}
--batchresponse_9fmXUprC-We1M-Hp8F-kZ52-rRJnN06M6gxQ--

I've just copied the sample of documentation:

POST https://server:port/b1s/v1/$batch

Header: Content-Type - multipart/mixed;boundary=batch_MyBatch1

Body:

--batch_MyBatch1

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

POST /b1s/v1/BusinessPartners
Content-Type: application/json
{"CardCode": "B1DevELB1", "CardName": "B1 Development eLearning batch B1", "CardType": "cCustomer"}

--batch_MyBatch1

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

POST /b1s/v1/BusinessPartners
Content-Type: application/json
{"CardCode": "B1DevELB2", "CardName": "B2 Development eLearning batch B2", "CardType": "cCustomer"}

--batch_MyBatch1--

The response Status is “202 Accepted”, but I have this error and any of customers have been created.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

CarlesCostaMun
Participant
0 Kudos

It needs a blank line between two lines:

Content-Type: application/json

{"CardCode": "B1DevELB1", "CardName": "B1 Development eLearning batch B1", "CardType": "cCustomer"}

Answers (2)

Answers (2)

adrien_lochon
Explorer
0 Kudos

What about creating a document and then a second document, based on the first?

Let's say I wanted to create a Sales Quotation, then a Sales Order, based on the quotation I've just created. How can I link the documents in a batch request?

Thanks!

former_member197733
Contributor
0 Kudos

Hello, Here is a working example.

POST /b1s/v1/$batch HTTP/1.1
Host: HANASERVER:50000
Content-Type: multipart/mixed;boundary=batch_36522ad7-fc75-4b56-8c71-56071383e77c
Cache-Control: no-cache
Postman-Token: fe829407-c62e-4c91-eab8-14f985f8f7e4

--batch_36522ad7-fc75-4b56-8c71-56071383e77c
Content-Type: application/http 
Content-Transfer-Encoding:binary

POST /b1s/v1/BusinessPartners
Content-Type: application/json

{"CardCode":"TestBatch001", "CardName":"Test Batch 01", "CardType": "C"}



--batch_36522ad7-fc75-4b56-8c71-56071383e77c
Content-Type: multipart/mixed;boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbc
Content-Type: application/http 
Content-Transfer-Encoding: binary 
Content-ID: 1 

POST /b1s/v1/BusinessPartners
Content-Type: application/json

{"CardCode":"TestBatch002", "CardName":"Test Batch 02", "CardType": "C"}

--changeset_77162fcd-b8da-41ac-a9f8-9357efbbc--
--batch_36522ad7-fc75-4b56-8c71-56071383e77c--