File REST Reference

/file/upload

Methods
POST

Uploads a File.

NOTE: The filename and tailoringFilename fields should contain the value of the same parameter passed back on a */file/upload::POST* if they are provided. The tailoringOriginalFilename field should contain the value of the tailoring file's original name, prior to upload if it is provided.

Request Payload
Expand
POST /file/upload HTTP/1.1
Host: <destinationHost>[:<destinationPort>]
Origin: http://<formHost>[:<formPort>]
Content-Length: <contentLength>
Content-Type: multipart/form-data; boundary=<dataBoundary>
...
<dataBoundary>
Content-Disposition: form-data; name="Filedata"; filename="<baseName>"
Content-Type: <contentType>
 
<fileData>
<dataBoundary>
...

returnContent is provided

...
<dataBoundary>
Content-Disposition: form-data; name="returnContent"

<returnContent>
...

context is provided

...
<dataBoundary>
Content-Disposition: form-data; name="context"

<context>
...

MAX_FILE_SIZE is specified

...
<dataBoundary>
Content-Disposition: form-data; name="MAX_FILE_SIZE"

<maxFileSize>
...

Types and values:

  • destinationHost = <string>
  • destinationPort = <number> OPTIONAL (do not provide the preceding colon if not specified)
  • formHost = <string>
  • formPort = <number> OPTIONAL (do not provide the preceding colon if not specified)
  • contentLength = <number>
  • dataBoundary = <string>
  • maxFileSize = <number> (maximum size allowed for an uploaded file; It is best to check this on the client first if possible)
  • fileData = <string>
  • baseName = <string>
  • returnContent = <string> "false" | "true" DEFAULT "false"
  • context = <string> "auditfile" | "tailoringfile"
Example Response
Expand
{
	"type" : "regular",
	"response" : {
		"filename" : "4fk1r0",
		"originalFilename" : "filename.zip",
		"content" : "",
		"context" : [
			{
				"dataStreamName" : "scap_gov.nist_datastream_USGCB-ie8-1.2.3.1.zip"
			}
		],
		"benchmarkName" : "benchmarkname",
		"profileName" : "profilename",
		"version" : "1.2",
		"type" : ""
	}
	"error_code" : 0,
	"error_msg" : "",
	"warnings" : [],
	"timestamp" : 1404308740
}