Skip to Content
0

Service Layer: batch operations

Dec 06, 2017 at 02:59 PM

66

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Carles Costa Dec 06, 2017 at 03:08 PM
0

It needs a blank line between two lines:

Content-Type: application/json

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

Share
10 |10000 characters needed characters left characters exceeded
Ralph Oliveira
Dec 07, 2017 at 10:33 AM
0

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--
Share
10 |10000 characters needed characters left characters exceeded