REST API  14
REST API for Luna Network HSMs
POST /users/{userid}/files

POST /users/{userid}/files

Upload the file to the appliance by the currently logged in user. You may change the value of maxFileSize of webserver to this resource. See webServer Configuration
Uploading of file will take less time when performed in good network.

User Privileges

Users with the following role privileges can perform this command:

  • admin
  • operator
  • monitor

Parameters

The request takes in a file.

Note:

  1. The length of fileName should not exceed 64 characters.
  2. The fileName can contain characters from following categories:
    • Uppercase letters (A through Z)
    • Lowercase letters (a through z)
    • Numbers (0 through 9)
    • Non-alphanumeric characters (special characters allowed for fileName are -, ., _)
  3. File cannot be uploaded without extension.
  4. Files of following extensions can be uploaded:
    • pem
    • spkg
    • auth
    • lic
    • tar.gz
    • log
    • txt
    • tgz
    • pid
    • bin
  5. The fileName should not be "server.pem".
  6. Spaces are allowed in file name.
  7. File name should not start with dot character(.) and end with space( )

userid

The identifier of a user.

Use: Required

JSON Schema:

   Object
   type: string
   minLength: 1
   maxLength: 32
   pattern: [a-zA-Z_][a-zA-Z0-9._-]{0,31}

Responses

204

No Content, Success

400

SERVER_REQUEST_NOT_APPROPRIATE

If user has not used multipart request.

SERVER_REQUEST_NOT_APPROPRIATE

If user has not used multipart request.

SERVER_FILE_UPLOAD_LIMIT_EXCEED

If user tries to upload multiple files at a time

SERVERPLUGIN_INTERNAL_ERROR

Unexpected error

403

SERVERPLUGIN_USERID_NOT_AUTHORIZED

Loggedin user isn't allowed to perform this action for this userid.

SERVERPLUGIN_USERID_RESERVED_FOR_SYSTEM_USE

Operation can not be done for system level users.

SERVERPLUGIN_SERVER.PEM_CANNOT_BE_OVERWRITTEN

Server.pem can not be overwritten.

404

SERVERPLUGIN_USERID_DOES_NOT_EXIST

User does not exist.

SERVERPLUGIN_FILE_NOT_FOUND

If file is not attached with the request.

405

SERVERPLUGIN_FILE_NOT_ALLOWED

If user tries to upload file of restricted extension

413

SERVER_REQUEST_TOO_LARGE

Request Header Or Body Too Large

Example Request

The content type of the request needs to be application/vnd.safenetinc.luna+multipart to notify the server that it will be receiving a file. Attach the file with the request.

Header format:

    headers = {'Content-Type': "application/vnd.safenetinc.lunasa+multipart;version="}

    POST
    https://1.2.3.4:8443/users/admin/files
    { }

Example Result

Result may also be a task.

{
}

Note: Before calling this API, it is advised to check maxFileSize using GET /api/lunasa/webServer and update via PATCH /api/lunasa/webServer based on the file size.