Skip to Content

Sending Batch Request to External Applications from SAP C4C SDK

Dear Experts,

I have a scenario to transfer Tickets from C4C to another SAP system based on a specific criteria. I am consuming the Ticket O data and writing my logic to send the request to create a Ticket "POST" with the necessary access token & cookies from the previous "GET" method call.

I need to transfer the Ticket Header Data, Text Collection & attachments of the ticket, all 3 are different entities in the Odata. I need to do a Batch request to send all the data in a single call to the other SAP system. Even i need to send updates of the Ticket to the external system.

When i tried using the batch request in C4C, I am able to form the body in the JSON format by using the batch process, but i am not able to pass the Content Type of Batch while the Execution of the web service.

In my logic the Content-Type is hardcoded as multipart/mixed;boundary=batch_1, when we use the function WebServiceutilities.ExecuteRESTWebservice() to pass the necessary parameters with the Content type mentioned above, the content type is only passed as multipart/mixed and the boundary=batch_1 is ignored in the request.

Just because this boundary=batch_1 is ignored am getting a response HTTP 202 Accepted but with empty response payload and the Ticket is not created in the system.

I tried to replicate the same in POSTMAN by including the statement boundary=batch_1 in the Header Parameters of the Content-Type then it was successful with HTTP 201 (Created) with the response payload as well.

Anyone please share your ideas how to implement the batch request in C4C to send the data outbound.


Add a comment
10|10000 characters needed characters exceeded

  • JSON Request BODY:

    --batch_1

    Content-Type: multipart/mixed; boundary=changeset_1 -

    -changeset_1

    Content-Type: application/http

    Content-Transfer-Encoding: binary

    POST ServiceRequestCollection HTTP/1.1

    Content-Length: 9000

    Accept: application/json

    Content-Type: application/json

    {

    "Name" : "Check for Batch 172018_31",

    "ServiceRequestText":

    [

    {

    "Text":"1note",

    "TypeCode":"10011"

    }

    ]

    }

    --changeset_1--

    --batch_1--

Related questions

0 Answers

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.