Download a sample file as an attachment
Sends Content-Disposition: attachment and supports single Range requests. HEAD returns the same headers without a body.
Parameters 1
| Name | Type | Description |
|---|---|---|
namerequired | path · string | File name from GET /api/files, e.g. sample.pdf. Case-insensitive.File name from GET …, e.g. sample.pdf. Case-insensitive. |
Responses
- 200
- The file.
- 206
- The requested byte range of the file.
- 404
- No such file.
Example
Request
curl -X GET "https://api.testingapis.com/api/files/sample.txt" \
-H "X-TestingApis-Key: YOUR_API_KEY"Response200 OK
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment; filename=sample.txt; filename*=UTF-8''sample.txt
TestingAPIs sample text file
=======================
This is plain text served for testing HTTP clients.
Line 4: The quick brown fox jumps over the lazy dog.
Line 5: 0123456789 !@#$%^&*()Sign in to see the details
The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.