upload

Upload files to the storage system.

There are two ways to upload files:

  1. Through a POST request (more info).
  2. Through a PUT request (more info).

Using a POST request it is possible to send multiple files at once, but the request must be encapsulated as multipart/form-data (Content-Type header must be multipart/form-data) and it is necessary to specify the destination directory where the files should be stored.

Using a PUT request, only one file at the time can be uploaded. The file content must be included in the request body and it is necessary to specify the full path (directory with file name) where the file should be stored.

Note

In order to upload files, the token used must be enabled for such task.

GET

Caution

Not implemented. Will return a status code of 501.

POST

POST /upload

The destination directory is taken from the data form sent. It first checks if a path parameter is available, otherwise it tries to build the destination path with the other form parameters in the following way: job/git_branch/kernel/arch/[defconfig_full | defconfig ][/lab_name]

Caution

Sending multiple times the same files will overwrite the previous ones.

Form Parameters:
 
  • path – The destination directory where files should be saved.
  • job – The job name.
  • git_branch – The branch name.
  • kernel – The kernel name.
  • defconfig – The defconfig value.
  • defconfig_full – The defconfig_full value.
  • arch – The architecture type.
  • lab_name – The boot lab name.
Response JSON Object:
 
  • code (int) – The status code of the request.
  • result (array) – An array with the results of each file saved.
Response JSON Array of Objects:
 
  • status (int) – The status of the file saving operation (can be 200, 201, 500).
  • bytes (int) – The bytes written to disk.
  • error (string) – A string with the error reason, in case of errors.
  • filename (string) – The name of the file as saved.
Request Headers:
 
Response Headers:
 
Status Codes:

Example Requests

POST /upload/ HTTP/1.1
Host: api.kernelci.org
Authorization: token
Accept: */*
Content-Type: multipart/form-data; boundary=----------------------------80aa05d1f94c

------------------------------80aa05d1f94c
Content-Disposition: form-data; name="path"

next/next-20150116/arm-allnoconfig/
------------------------------80aa05d1f94c
Content-Disposition: form-data; name="file01"; filename="zImage"
Content-Type: application/octet-stream
POST /upload/ HTTP/1.1
Host: api.kernelci.org
Authorization: token
Accept: */*
Content-Type: multipart/form-data; boundary=----------------------------80aa05d1f94c

------------------------------80aa05d1f94c
Content-Disposition: form-data; name="job"

next
------------------------------80aa05d1f94c
Content-Disposition: form-data; name="kernel"

next-20150116
------------------------------80aa05d1f94c
Content-Disposition: form-data; name="arch"

arm
------------------------------80aa05d1f94c
Content-Disposition: form-data; name="arch"

allnoconfig
------------------------------80aa05d1f94c
Content-Disposition: form-data; name="file01"; filename="zImage"
Content-Type: application/octet-stream

Example Responses

HTTP/1.1 200 OK
Vary: Accept-Encoding
Date: Fri, 16 Jan 2015 15:12:50 GMT
Content-Type: application/json; charset=UTF-8

{
    "code": 200,
    "result": [
        {
            "status": 200,
            "filename": "zImage",
            "error": null,
            "bytes": 6166840,
        }
    ]
}

PUT

PUT /upload/(string: path)

Upload a single file at the specified path location. path is the filename path where it should be stored. It will be treated like a file path. The file content should be sent in the request body.

Parameters:
  • path – The destination path where the file should be saved.
Response JSON Object:
 
  • code (int) – The status code of the request.
  • result (array) – An array with the results of each file saved.
Response JSON Array of Objects:
 
  • status (int) – The status of the file saving operation (can be 200, 201, 500).
  • bytes (int) – The bytes written to disk.
  • error (string) – A string with the error reason, in case of errors.
  • filename (string) – The name of the file as saved.
Request Headers:
 
Response Headers:
 
Status Codes:

Example Requests

PUT /upload/next/next-20150116/arm-allnoconfig/zImage HTTP/1.1
Host: api.kernelci.org
Authorization: token
Accept: */*
Content-Length: 6166840
Content-Type: application/x-www-form-urlencoded

.7zXZ......F..!.....GX:C..,..].....1.PX.3{...V...!...[.4....3..~
...

Example Responses

HTTP/1.1 200 OK
Vary: Accept-Encoding
Date: Fri, 16 Jan 2015 15:12:50 GMT
Content-Type: application/json; charset=UTF-8

{
    "code": 200,
    "result": [
        {
            "status": 200,
            "filename": "zImage",
            "error": null,
            "bytes": 6166840,
        }
    ]
}

DELETE

Caution

Not implemented. Will return a status code of 501.