Upload Action

Upload Action currently mainly serves the front-end page of FE, and is used for users to load small test files.

Upload load file

Used to upload a file to the FE node, which can be used to load the file later. Currently only supports uploading files up to 100MB.

Request

  1. POST /api/<namespace>/<db>/<tbl>/upload

Path parameters

  • <namespace>

    Namespace, currently only supports default_cluster

  • <db>

    Specify database

  • <tbl>

    Specify table

Query parameters

  • column_separator

    Optional, specify the column separator of the file. Default is \t

  • preview

    Optional, if set to true, up to 10 rows of data rows split according to column_separator will be displayed in the returned result.

Request body

The content of the file to be uploaded, the Content-type is multipart/form-data

Response

  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": {
  5. "id": 1,
  6. "uuid": "b87824a4-f6fd-42c9-b9f1-c6d68c5964c2",
  7. "originFileName": "data.txt",
  8. "fileSize": 102400,
  9. "absPath": "/path/to/file/data.txt"
  10. "maxColNum" : 5
  11. },
  12. "count": 1
  13. }

Load the uploaded file

Request

  1. PUT /api/<namespace>/<db>/<tbl>/upload

Path parameters

  • <namespace>

    Namespace, currently only supports default_cluster

  • <db>

    Specify database

  • <tbl>

    Specify table

Query parameters

  • file_id

    Specify the load file id, which is returned by the API that uploads the file.

  • file_uuid

    Specify the file uuid, which is returned by the API that uploads the file.

Header

The options in the header are the same as those in the header in the Stream Load request.

Request body

None

Response

  1. {
  2. "msg": "success",
  3. "code": 0,
  4. "data": {
  5. "TxnId": 7009,
  6. "Label": "9dbdfb0a-120b-47a2-b078-4531498727cb",
  7. "Status": "Success",
  8. "Message": "OK",
  9. "NumberTotalRows": 3,
  10. "NumberLoadedRows": 3,
  11. "NumberFilteredRows": 0,
  12. "NumberUnselectedRows": 0,
  13. "LoadBytes": 12,
  14. "LoadTimeMs": 71,
  15. "BeginTxnTimeMs": 0,
  16. "StreamLoadPutTimeMs": 1,
  17. "ReadDataTimeMs": 0,
  18. "WriteDataTimeMs": 13,
  19. "CommitAndPublishTimeMs": 53
  20. },
  21. "count": 1
  22. }

Example

  1. PUT /api/default_cluster/db1/tbl1/upload?file_id=1&file_uuid=b87824a4-f6fd-42c9-b9f1-c6d68c5964c2