Start Batch

Creates service appointment bundles automatically. The resource uses appointment bundle policies that are marked for automatic bundling. Service appointments that are already bundled manually stay untouched by this API. The resource returns the success or failure message of starting the batch process of automatic bundling. This API is not supported in Gov Cloud. This endpoint is available in version 54.0 and later of the Salesforce API.

Add a Remote Site 

  1. From Setup, in the Quick Find box, enter Security, and then select Remote Site Settings.

  2. Click New Remote Site.

  3. Enter a name.

  4. For Remote Site URL, enter https://api.salesforce.com/

  5. Save your changes.

Syntax 

URI: HOST/bundleflow/api/v1.0/startbatch

Where HOST is a variable.

Format: JSON

HTTP Method: POST

Authentication: Authorization: Bearer TOKEN

Where TOKEN is a variable.

If the authentication token isn’t valid, a 401 HTTP status is returned.

Headers:

  • request.setHeader('x-sfdc-tenant-id', 'core/prod/ORG-ID_18_Characters');—Field Service functional domain
  • sf_api_version—Salesforce API version. Minimum version is 53.0.
  • Authorization—Authorization token.
  • Content-Type—File format. Valid value is JSON.
  • Referer—Org domain URL.

Request Body 

The request body contains these properties.

FieldTypeDescription
operationStringThe bundling operation. Valid value: start-batch-processing.

Example 

This example shows an automated bundling request of service appointments.

1{
2    "operation": "start-batch-processing"
3}

Response Body 

The response body contains these properties.

FieldTypeDescription
httpStatusNumberResponse HTTP status.
statusDescriptionStringResponse status description.
responsePayloadStringMessage about the batch status. If it’s successful, the payload is null. If the batch bundling fails, the payload shows an error message, such as, “Wrong API version” or “Failed to start batch agent”.
messageCodeNumberMessage code is always 0.
messageAdditionalInfoStringMore information provided by Salesforce.

Example: Successful Response 

This example shows the output of a batch process of automatic bundling that started successfully.

1{
2   "httpStatus":200,
3   "statusDescription":null,
4   "responsePayload":null,
5   "messageCode":"NONE"}
6}

Example: Fail Response 

This example shows the output of a batch process that failed to start because the operation parameter of the request is null or empty.

1{
2   "httpStatus":400,
3   "statusDescription":null,
4   "responsePayload":"Failed to start batch agent",
5   "messageCode":"NONE"
6   "messageAdditionalInfo": ""
7}