See the [Server Discovery doc](./server-discovery.md) for more info on how LFS
builds the LFS server URL.
All Batch API requests use the POST verb, and require the following HTTP
headers. The request and response bodies are JSON.
Accept: application/vnd.git-lfs+json
Content-Type: application/vnd.git-lfs+json
See the [Authentication doc](./authentication.md) for more info on how LFS
gets authorizes Batch API requests.
## Requests
The client sends the following information to the Batch endpoint to transfer
some objects:
*`operation` - Should be `download` or `upload`.
*`transfers` - An optional Array of String identifiers for transfer adapters
that the client has configured. If omitted, the `basic` transfer adapter MUST
be assumed by the server.
*`objects` - An Array of objects to download.
*`oid` - String OID of the LFS object.
*`size` - Integer byte size of the LFS object.
Note: Git LFS currently only supports the `basic` transfer adapter. This
property was added for future compatibility with some experimental transfer
adapters. See the [API README](./README.md) for a list of the documented
transfer adapters.
```js
// POST https://lfs-server.com/objects/batch
// Accept: application/vnd.git-lfs+json
// Content-Type: application/vnd.git-lfs+json
// Authorization: Basic ... (if needed)
{
"operation": "download",
"transfers": [ "basic" ],
"objects": [
{
"oid": "12345678",
"size": 123,
}
]
}
```
### Successful Responses
The Batch API should always return with a 200 status, unless there are some
issues with the request (bad authorization, bad json, etc). See below for examples of response errors. Check out the documented transfer adapters in the
[API README](./README.md) to see how Git LFS handles successful Batch responses.
Successful responses include the following properties:
*`transfer` - String identifier of the transfer adapter that the server
prefers. This MUST be one of the given `transfer` identifiers from the request.
Servers can assume the `basic` transfer adapter if none were given. The Git LFS
client will use the `basic` transfer adapter if the `transfer` property is
omitted.
*`objects` - An Array of objects to download.
*`oid` - String OID of the LFS object.
*`size` - Integer byte size of the LFS object.
*`authenticated` - Optional boolean specifying whether the request for this
specific object is authenticated. If omitted or false, Git LFS will attempt
to [find credentials for this URL](./authentication.md).
*`actions` - Object containing the next actions for this object. Applicable