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 can be any random unique string. For details, see additional tables.
|
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
-----------------------------------
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 |
|
|
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.
|
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>