Ameling.BatchRequest 1.0.1

.NET Standard 2.0
dotnet add package Ameling.BatchRequest --version 1.0.1
NuGet\Install-Package Ameling.BatchRequest -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Ameling.BatchRequest" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Ameling.BatchRequest --version 1.0.1
#r "nuget: Ameling.BatchRequest, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Ameling.BatchRequest as a Cake Addin
#addin nuget:?package=Ameling.BatchRequest&version=1.0.1

// Install Ameling.BatchRequest as a Cake Tool
#tool nuget:?package=Ameling.BatchRequest&version=1.0.1


BatchRequest is NuGet package which opens up an endpoint within a Asp.Net Core application to make batch requests: multiple requests embedded within a single HTTP request. While REST API's are quite strong, sometimes lots of values have to be retrieved before proper UI can be shown. Launching multiple requests is definitely an option, but when the amount increases it is a good idea to bundle your requests to both make your UI code simpler and save some load on your server.


To add batch requests to your application, call the IServiceCollection extensions methond in ConfigureServices(IServiceCollection services):

public void ConfigureServices(IServicesCollection services) 
    // ..
    // ..

This method optionally takes an Action<BatchRequestOptions> parameter, to configure additional options:

  • EnableEndpoint: Whether to enable the /api/batch endpoint. Defaults to true. When set to false, one can still get the IBatchRequestService through dependency injection.
  • RequestHost: The request host which is set in HttpContext.Request, which could be used identify whether the current request is being executed in the context of a batch request. Defaults to https://batchrequest.
  • DefaultProtocol: The request protocol string which is set in HttpContext.Request. Defaults to BatchRequest.

Making a batch request

Each request is identified by the following model:

    "RelativeUri": "/api/batch", // The endpoint which has to be called on this server
    "Method": "Get", // The method to execute the endpoint with. Can be one of Delete, Get, Head, Options, Patch, Post or Put. When omitted (or null), defaults to Get
    "ContentType": "application/json", // The (optional) content type of the body which is posted
    "Body": "{\"my\": \"json object\"}", // The body to post
    "Base64Encoded": false // Whether the body is encoded with base64, for binary files. Defaults to false when omitted.

These objects are then put in an array, and if the endpoint is enabled can be posted to /api/batch. The response of this endpoint will be an array of the response objects, where each index corresponds with the same request. A response object is defined as:

    "StatusCode": 200, // the status code of the request
    "ContentType": "application/json; charset=utf-8;", // the response content type
    "Body": "5", // the response
    "Base64Encoded": false, // Whether the body was encoded with base64
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 369 10/22/2020
1.0.0 325 10/22/2020