cancel
Showing results for 
Search instead for 
Did you mean: 

Working with service layer batches

mario_galeano
Participant
292

I am trying to create a multi-endpoint push using the service layer push batches, however I am getting this error:

the body of my request is this:

--batch_36522ad7-fc75-4b56-8c71-56071383e77c
content-type: multipart/mixed;boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
content-type: application/http
content-transfer-encoding:
Content-ID=1
POST /b1s/v1/Items
{
    "ItemCode": "GY127011",
    "ItemName": "EMGRAND GX3 NAFTERO MOTOR 1,5AUT GF",
    "ItemsGroupCode": "110",
    "IndirectTax":  "tYES",
    "ArTaxCode": "IVA_10",
    "ApTaxCode": "IVA_10",
    "ItemType": "itItems"
}
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
content-type: application/http
content-transfer-encoding:binary
Content-ID=2
POST /b1s/v1/Items
{
    "ItemCode": "GY127012",
    "ItemName": "EMGRAND GX3 NAFTERO MOTOR 1,5AUT GF",
    "ItemsGroupCode": "110",
    "IndirectTax":  "tYES",
    "ArTaxCode": "IVA_10",
    "ApTaxCode": "IVA_10",
    "ItemType": "itItems"
}
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
content-type: application/http
content-transfer-encoding:binary
Content-ID=3
POST /b1s/v1/Items
{
    "ItemCode": "GY127013",
    "ItemName": "EMGRAND GX3 NAFTERO MOTOR 1,5AUT GF",
    "ItemsGroupCode": "110",
    "IndirectTax":  "tYES",
    "ArTaxCode": "IVA_10",
    "ApTaxCode": "IVA_10",
    "ItemType": "itItems"
}
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd--
--batch_36522ad7-fc75-4b56-8c71-56071383e77c--<br>
View Entire Topic
ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi mario.galeano,

The error message is self explanatory.

Refer to the highlighted part:

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

mario_galeano
Participant
0 Kudos

Hi ankit.chauhan1

Thank you very much for the reply

I did a test following an example already mentioned in this note: https://answers.sap.com/questions/417028/how-to-use-batch-operation-of-sap-hana-service-lay.html

However, I still get the following error


--batchresponse_tV6nviZ8-Bh3K-G0AW-vCFq-L7y5xa4PV10f
Content-Type: application/http
Content-Transfer-Encoding: binary

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

{
   "error" : {
      "code" : -1,
      "message" : {
         "lang" : "en-us",
         "value" : "BadFormat"
      }
   }
}

--batchresponse_tV6nviZ8-Bh3K-G0AW-vCFq-L7y5xa4PV10f--

In the response header I am sending the value of "Content-Type"

I attach the body of the submission that I am using, and at that point, how can I correctly add more lines that are required?

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

POST /b1s/v1/Items
{
    "ItemCode": "GY127012",
    "ItemName": "EMGRAND GX3 NAFTERO MOTOR 1,5AUT GF",
    "ItemsGroupCode": "110",
    "IndirectTax":  "tYES",
    "ArTaxCode": "IVA_10",
    "ApTaxCode": "IVA_10",
    "ItemType": "itItems"
}

--batch_36522ad7-fc75-4b56-8c71-56071383e77c

Content-Type: multipart/mixed;boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
--changeset_77162fcd-b8da-41ac-a9f8-9357efbbd
Content-Type: application/http 
Content-Transfer-Encoding: binary 
Content-ID: 1 

POST /b1s/v1/Items

{
    "ItemCode": "GY127013",
    "ItemName": "EMGRAND GX3 NAFTERO MOTOR 1,5AUT GF",
    "ItemsGroupCode": "110",
    "IndirectTax":  "tYES",
    "ArTaxCode": "IVA_10",
    "ApTaxCode": "IVA_10",
    "ItemType": "itItems"
}

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