Skip to main content

Upload Endpoint

Introduction

The POST /upload endpoint allows you to securely upload files to the server. This guide provides detailed instructions on how to use the upload endpoint, including required headers, request format, and example requests.

Endpoint

POST /upload

Request Headers

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

Request Body

The request body should be multipart form data containing the file to be uploaded.

Example Form Data

file=@/path/to/yourfile.txt

Response

  • 200 OK: If the file is successfully uploaded.
  • 400 Bad Request: If authentication fails or no file is provided.

Example Requests

Using curl

Uploading a File

curl -X POST http://yourserver.com/upload \
-H "x-auth-name: yourname" \
-H "x-auth-password: yourpassword" \
-F "file=@/path/to/yourfile.txt"

Example Response

Successful Upload

OK

Error Response

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

{
"statusCode": 400,
"error": "Bad Request",
"message": "No file"
}

Example Error Response

If no file is provided:

{
"statusCode": 400,
"error": "Bad Request",
"message": "No file"
}