Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Batch response

former_member674253
Discoverer
0 Likes
3,917

Hi,

I am requested OData service with the batch request, which includes multiply POST requests in separated changesets.

How it looks:

--batchContent-Type: multipart/mixed; boundary=changeset--changesetContent-Type: application/httpContent-Transfer-Encoding: binaryPOST Entity HTTP/1.1Content-type: application/json{   <JSON BODY>}--changeset----batchContent-Type: multipart/mixed; boundary=changeset--changesetContent-Type: application/httpContent-Transfer-Encoding: binaryPOST Entity HTTP/1.1
Content-type: application/json

{
   <JSON BODY>
}--changeset----batch--


Response structure:

--7070D8610D18DD62D307574F0D9BD4A30Content-Type: multipart/mixed; boundary=7070D8610D18DD62D307574F0D9BD4A31Content-Length:      7416--7070D8610D18DD62D307574F0D9BD4A31Content-Type: application/httpContent-Length: 7247content-transfer-encoding: binaryHTTP/1.1 201 CreatedContent-Type: application/atom+xml;type=entryContent-Length: 6975dataserviceversion: 2.0location: <path><xml entry>--7070D8610D18DD62D307574F0D9BD4A31----7070D8610D18DD62D307574F0D9BD4A30Content-Type: multipart/mixed; boundary=7070D8610D18DD62D307574F0D9BD4A31Content-Length:      7416--7070D8610D18DD62D307574F0D9BD4A31Content-Type: application/httpContent-Length: 7247content-transfer-encoding: binaryHTTP/1.1 201 CreatedContent-Type: application/atom+xml;type=entryContent-Length: 6975dataserviceversion: 2.0location: <path><xml entry>--7070D8610D18DD62D307574F0D9BD4A31----7070D8610D18DD62D307574F0D9BD4A30--



QUESTIONS:

1)Is it possible to parse the response body to an array of separated objects?

2)Are the any options to define key, which returns in response(my case: 7070D8610D18DD62D307574F0D9BD4A30, 7070D8610D18DD62D307574F0D9BD4A31)

Thanks.

7 REPLIES 7
Read only

evanireland
Product and Topic Expert
Product and Topic Expert
0 Likes
3,336

Hi Yauhen,

What language are you proposing to use to build the client application?

Read only

former_member674253
Discoverer
0 Likes
3,336

Hi Evan,

I am going to use English.

Thank for your response.

Read only

0 Likes
3,335

I'm facing the same problem, seems like SAPUI5 does not have a specific API to deal with it, so sad.

Here I need to read this message.

Read only

ThorstenHoefer
Active Contributor
0 Likes
3,335

Hi tonyhallow,

you can analyse the responses from the collection oData.__batchResponses

For example:

this.getModel().submitChanges({
  groupId: 'changes',
  success: oData => {
if (oData.__batchResponses.some(oResult => oResult.response && oResult.response.statusCode === '400')) {
RegardsThorsten
Read only

0 Likes
3,334

Hi, I did something like this, but it does not work.

Read only

0 Likes
3,334

Hi Zoe,

I assume you using this Method?
sap.ui.model.odata.v4.ODataContextBinding - API Reference - Demo Kit - SAPUI5 SDK (ondemand.com)

If you want to retrieve the message, you can check the Message Model

Message Model (ondemand.com)

			// set message model
			oMessageManager = sap.ui.getCore().getMessageManager();
			this.getView().setModel(oMessageManager.getMessageModel(), "message");

Basic OData Messages - Samples - Demo Kit - SAPUI5 SDK (ondemand.com)

Read only

0 Likes
3,334

Thanks, I can read the message through MessageManager now, but I have a new problem here, I need to access numericSeverity from the sap-message, cause I need this property to determine whether if it is a success message or an error message, do you how to do this?