Upload files (POST)

Description

URL

scheme://domain:port/platform/ws/jobfiles/upload/{id}

Description

Uploads data for a job to the job directory on the web server or the remote directory on a specific host.

By default, if a job ID is specified but no directory is specified, files are uploaded to the job directory on the web server.

The job can be in any status.

HTTP Method

POST

Parameters

Name Description
 

id

Mandatory.

Only used to upload files to the job directory on the web server. The ID of the job for which to upload files. The ID must be a positive integer and must match an LSF® job ID.

The job ID cannot be 0.

To get a list of jobs and their ID, use: /platform/ws/jobs or platform/ws/jobs/getbasicinfo

 

chunkid

Optional.

Used for large files. Allows to split large files into parts. The chunk ID is the part number for the file. Indicates how many parts the file is divided into.

Used with chunkbase and chunkamount. Platform Application Center uses the information you provide to put the file parts together into one file once uploaded.

For example, you want to split a large file into 6 parts. The chunk IDs are from 1 to 6. The file name is specified with chunkbase and the total number of chunks with chunkamount.

  chunkbase

Mandatory if chunkid is used.

Used with chunkid. Name of the file. Specified to identify all parts in the same file.

  chunkamount

Mandatory if chunkid is used.

Used with chunkid and chunkbase.

Number of chunks in which the file is split.

Request

Request-Method

POST

Request-URI

/platform/ws/jobfiles/upload/{id}

OR

/platform/ws/jobfiles/upload/{id}?chunkid=%d&chunkbase=%s&chunkamount=%d

Request-Header

Name

Value

Accept

application/xml or application/json

Content-Type multipart/mixed;boundary=XXX

Message-body

[--boundary <Directory Name>]
--boundary <File Attachment>
--boundary <File Attachment>
--boundary ...

Boundary can be any random unique string. For details, see additional tables.

  • <dir_name>: Mandatory. Uploads files to the specified directory on the web server. The directory can be an absolute path on the web server or a relative path to the job directory on the web server.
  • <file_name>: Optional. Files to upload. To specify multiple files, separate with a space. If no path is specified for the file, the job directory on the web server is used as the location of the file. If no file is specified, all files in the directory are uploaded.
  • <host_name><dir_name>: Uploads files to the specified job directory on the specified host. The directory must be an absolute path to the remote job directory on the host. The host can be any LSF server host.


Table 1. <Directory Name>
Field Name Field format/value Notes®
Content-Disposition Form-data;name="dir"  
Content <Dir_Name> <Dir_Name>: The directory on the web server. If the whole area is missing, the job directory on the web server.

Example: Directory Name
-----------------------------------
Content-Disposition: form-data; name=dir
Content-ID: <DirName>
"\r\n"
/shareDisk/jobRepo/lsfadmin/workspace_dept_00001B
-----------------------------------

Table 2. <File Attachment>
Field Name Field format/value Notes
Content-Disposition Form-data;name="fl"  
Content-Type application/octet-stream  
Content-ID <File name>  
Content-Transfer-Encoding UTF-8  
Content <File content in bytes>  

Example: <File Attachment>
-----------------------------------
Content-Disposition: form-data; name='f1'
Content-Type: application/octet-stream
Content-Transfer-Encoding: UTF-8
Content-ID: <examplefile.jou>
"\r\n"
PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aGUg
-----------------------------------

Response

Response-Code

  • 200 Successful: Request was successful.
  • 400 Bad Request: The ID is empty or not valid.
  • 403 Forbidden: Access restricted by role-based access control permissions.
  • 500 Internal Server Error: Exception occurred.

Response-Header

Name

Value

Content-Type

application/xml or application/json

Message-body

Failure Message

If not successful, returns an error message.

For additional information, refer to the schema file ./schemas/jobs/error.xsd.

<error>
  <message>
     %s
  </message>
</error>

Example: Upload a file for job with ID 221

# Request
POST /<context_path>/ws/jobfiles/upload/221 HTTP/1.1
Host: www.example.org
Content-Type:multipart/mixed; boundary= bqJky99mlBWa-ZuqjC53mG6EzbmlxB

--bqJky99mlBWa-ZuqjC53mG6EzbmlxB
Content-Disposition: form-data; name="dir"

/home/xawyong
--bqJky99mlBWa-ZuqjC53mG6EzbmlxB
Content-Disposition: form-data; name="/Users/user1/Documents/workspace/submit.txt"
Content-Type: application/octet-stream
Content-ID: <submit.txt>

hello world

--bqJky99mlBWa-ZuqjC53mG6EzbmlxB--

# Response
200 Successful
Content-Type: application/xml;

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Message>
<message>The files are successfully uploaded</message>
</Message>