Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/NetCoreForce.Client/ForceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,38 @@ public async Task<CompositeRequestResponse> ExecuteCompositeRecords(

}

/// <summary>
/// Execute multiple composite records.
/// The list can contain up to 200 objects.
/// The list can contain objects of different types, including custom objects.
/// </summary>
/// <param name="compositeRequest">The composite request</param>
/// <param name="customHeaders">Custom headers to include in request (Optional). await The HeaderFormatter helper class can be used to generate the custom header as needed.</param>
/// <returns>List of UpdateMultipleResponse objects, includes response for each object (id, success, errors)</returns>
/// <exception cref="ForceApiException">Thrown when request fails</exception>
public async Task<CompositeRequestResponse> ExecuteCompositeRecords(
CompositeRequest compositeRequest,
Dictionary<string, string> customHeaders = null)
{
Dictionary<string, string> headers = new Dictionary<string, string>();

//Add call options
Dictionary<string, string> callOptions = HeaderFormatter.SforceCallOptions(ClientName);
headers.AddRange(callOptions);

//Add custom headers if specified
if (customHeaders != null)
{
headers.AddRange(customHeaders);
}

var uri = UriFormatter.CompositeRequest(InstanceUrl, ApiVersion);

JsonClient client = new JsonClient(AccessToken, _httpClient);

return await client.HttpPostAsync<CompositeRequestResponse>(compositeRequest, uri, headers);
}

/// <summary>
/// Execute request against ApexRest custom endpoints.
/// </summary>
Expand Down