batchPost
Send a group of requests
Group multiple requests into a single request payload, see [Batch Requests](https://www.odata.org/documentation/odata-version-2-0/batch-processing/) and [Batch and Bulk Persistence](https://help.sap.com/docs/SAP_COMMERCE_CLOUD_PUBLIC_CLOUD/bad9b0b66bac476f8a4a5c4a08e4ab6b/0d45f25361294a99997837ccbdf1fc0e.html).
/$batch
Usage and SDK Samples
curl -X POST\
-H "Authorization: Basic [[basicHash]]"\
-H "Accept: multipart/mixed; boundary=batch_some_identifier;charset=UTF-8,application/json"\
-H "Content-Type: multipart/mixed"\
"https://localhost:9002/odata2webservices/InboundDiscountRow/$batch"
import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.BatchRequestsApi;
import java.io.File;
import java.util.*;
public class BatchRequestsApiExample {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure HTTP basic authorization: basicAuthentication
HttpBasicAuth basicAuthentication = (HttpBasicAuth) defaultClient.getAuthentication("basicAuthentication");
basicAuthentication.setUsername("YOUR USERNAME");
basicAuthentication.setPassword("YOUR PASSWORD");
BatchRequestsApi apiInstance = new BatchRequestsApi();
Batch_body body = ; // Batch_body |
String contentType = contentType_example; // String | Content-Type header specifying the Media Type the request body is formatted in for batch request.
try {
'String' result = apiInstance.batchPost(body, contentType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BatchRequestsApi#batchPost");
e.printStackTrace();
}
}
}
import io.swagger.client.api.BatchRequestsApi;
public class BatchRequestsApiExample {
public static void main(String[] args) {
BatchRequestsApi apiInstance = new BatchRequestsApi();
Batch_body body = ; // Batch_body |
String contentType = contentType_example; // String | Content-Type header specifying the Media Type the request body is formatted in for batch request.
try {
'String' result = apiInstance.batchPost(body, contentType);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BatchRequestsApi#batchPost");
e.printStackTrace();
}
}
}
Configuration *apiConfig = [Configuration sharedConfig];
// Configure HTTP basic authorization (authentication scheme: basicAuthentication)
[apiConfig setUsername:@"YOUR_USERNAME"];
[apiConfig setPassword:@"YOUR_PASSWORD"];
Batch_body *body = ; //
String *contentType = contentType_example; // Content-Type header specifying the Media Type the request body is formatted in for batch request. (optional)
BatchRequestsApi *apiInstance = [[BatchRequestsApi alloc] init];
// Send a group of requests
[apiInstance batchPostWith:body
contentType:contentType
completionHandler: ^('String' output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error: %@", error);
}
}];
var InboundDiscountRow = require('inbound_discount_row');
var defaultClient = InboundDiscountRow.ApiClient.instance;
// Configure HTTP basic authorization: basicAuthentication
var basicAuthentication = defaultClient.authentications['basicAuthentication'];
basicAuthentication.username = 'YOUR USERNAME'
basicAuthentication.password = 'YOUR PASSWORD'
var api = new InboundDiscountRow.BatchRequestsApi()
var body = ; // {{Batch_body}}
var opts = {
'contentType': contentType_example // {{String}} Content-Type header specifying the Media Type the request body is formatted in for batch request.
};
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
api.batchPost(body, opts, callback);
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class batchPostExample
{
public void main()
{
// Configure HTTP basic authorization: basicAuthentication
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";
var apiInstance = new BatchRequestsApi();
var body = new Batch_body(); // Batch_body |
var contentType = contentType_example; // String | Content-Type header specifying the Media Type the request body is formatted in for batch request. (optional)
try
{
// Send a group of requests
'String' result = apiInstance.batchPost(body, contentType);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling BatchRequestsApi.batchPost: " + e.Message );
}
}
}
}
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure HTTP basic authorization: basicAuthentication
Swagger\Client\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
$api_instance = new Swagger\Client\ApiBatchRequestsApi();
$body = ; // Batch_body |
$contentType = contentType_example; // String | Content-Type header specifying the Media Type the request body is formatted in for batch request.
try {
$result = $api_instance->batchPost($body, $contentType);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling BatchRequestsApi->batchPost: ', $e->getMessage(), PHP_EOL;
}
?>
use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::BatchRequestsApi;
# Configure HTTP basic authorization: basicAuthentication
$WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME';
$WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD';
my $api_instance = WWW::SwaggerClient::BatchRequestsApi->new();
my $body = WWW::SwaggerClient::Object::Batch_body->new(); # Batch_body |
my $contentType = contentType_example; # String | Content-Type header specifying the Media Type the request body is formatted in for batch request.
eval {
my $result = $api_instance->batchPost(body => $body, contentType => $contentType);
print Dumper($result);
};
if ($@) {
warn "Exception when calling BatchRequestsApi->batchPost: $@\n";
}
from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure HTTP basic authorization: basicAuthentication
swagger_client.configuration.username = 'YOUR_USERNAME'
swagger_client.configuration.password = 'YOUR_PASSWORD'
# create an instance of the API class
api_instance = swagger_client.BatchRequestsApi()
body = # Batch_body |
contentType = contentType_example # String | Content-Type header specifying the Media Type the request body is formatted in for batch request. (optional)
try:
# Send a group of requests
api_response = api_instance.batch_post(body, contentType=contentType)
pprint(api_response)
except ApiException as e:
print("Exception when calling BatchRequestsApi->batchPost: %s\n" % e)
Parameters
Header parameters
| Name | Description |
|---|---|
| Content-Type |
String
Content-Type header specifying the Media Type the request body is formatted in for batch request.
|
Body parameters
| Name | Description |
|---|---|
| body * |