Skip to main content

Download Endpoint

Introduction

The GET /serve/:filename endpoint allows you to securely download files from the server. This guide provides detailed instructions on how to use the download endpoint, including required headers, parameters, and example requests.

Endpoint

GET /serve/:filename

Request Headers

  • x-auth-name: Your customer name.
  • x-auth-password: Your customer password.

URL Parameters

  • filename: The name of the file to be downloaded. This should be specified in the URL.

Response

  • 200 OK: If the file is found and successfully served.
  • 400 Bad Request: If authentication fails, the file is not found, or the filename parameter is missing.

Example Requests

Using curl

Downloading a File

curl -X GET http://yourserver.com/serve/yourfile.txt \
-H "x-auth-name: yourname" \
-H "x-auth-password: yourpassword" \
-O

Example Response

Successful Download

The file will be downloaded to your current directory with the specified filename.

Error Response

If the request is malformed, authentication fails, or the file is not found, the API will return an error message with a 400 Bad Request status.

Example Error Response

If the filename parameter is missing:

{
"statusCode": 400,
"error": "Bad Request",
"message": "No filename. Use /serve/<filename>"
}

If the file is not found:

{
"statusCode": 400,
"error": "Bad Request",
"message": "File not found"
}