cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud Platform SDK for Android - How to get a response for RequestBatch()

0 Kudos

Hello All,

How to get response object from RequestBatch() call or each changeset added to RequestBatch.

I see we can access the status of the request by accessing RequestBatch.Status but in my case I need response object returned by RequestBatch

public void processBatchAsync(@NonNull @NotNull final RequestBatch batch, @NonNull @NotNull Action0 successHandler, @NonNull @NotNull Action1<RuntimeException> failureHandler, @NonNull @NotNull final HttpHeaders headers, @NonNull @NotNull final RequestOptions options) {
this.asyncAction(new Action0() {
public void call() {
DataService.this.processBatch(batch, headers, options);
}
}, successHandler, failureHandler, options);
}

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Answering to my own question.

I see adding OperationResult inside successHandler returned the response.

We should pass relevant operation that we are performing with OperationResult call.

val operationResult: OperationResult<Entity> = OperationResult(newEntity, OperationResult.Operation.CREATE)

Answers (1)

Answers (1)

evanireland
Advisor
Advisor
0 Kudos

Have a look at the 'error' property in RequestBatch (applicable if the entire batch fails), or on ChangeSet.

It has type DataServiceException, which itself contains an optional response of type ErrorResponse.

0 Kudos

Thanks for you response.

In success scenario 'error' property always going to be null since my request is valid but in my case I just wanna access response object on success.