{"openapi":"3.0.2","info":{"title":"Service Data Upload","description":"Service for data upload usage","version":"2.2.15"},"paths":{"/":{"get":{"summary":"Root","description":"Healthcheck route.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/health":{"get":{"summary":"Health check for RDS, Redis and Kafka","operationId":"check_db_connection_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/files/jobs":{"post":{"tags":["V1 Upload"],"summary":"Always would be called first when upload,                  Init an async upload job, returns list of job identifier.","description":"Summary:\n    This is the first api the client side will call before upload\n    Its allow to create an async upload job(s) for all upload files.\n    It will make following checks for uploaded file(s):\n        1. check if project exist\n        2. check if the root folder is duplicate\n        3. normalize the filename with different client(firefox/chrome)\n        4. initialize the job for ALL upload files\n        5. lock all file/node will be\nHeader:\n    - session_id(string): The unique session id from client side\nPayload:\n    - project_code(string): the target project will upload to\n    - operator(string): the name of operator\n    - job_type(str): either can be file upload or folder upload\n    - data(SingleFileForm):\n        - resumable_filename(string): the name of file\n        - resumable_relative_path: the relative path of the file\n    - upload_message(string):\n    - current_folder_node(string): the root level folder that will be\n        uploaded\n    - incremental(integer):\nSpecial Note:\n    the folder upload & file upload has different payload structure.\n    When the file upload, the current_folder_node will be '' (empty string)\n    When the folder uplaod, the current_folder_node will be the root folder\nReturn:\n    - 200, job list","operationId":"upload_pre_v1_files_jobs_post","parameters":[{"required":false,"schema":{"title":"Session-Id"},"name":"session-id","in":"header"},{"required":false,"schema":{"title":"Authorization","type":"string"},"name":"Authorization","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreUploadPOST"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/files/chunks":{"post":{"tags":["V1 Upload"],"summary":"upload chunks process.","description":"Summary:\n    The second api that the client side will call during the file\n     upload. The data is uploaded throught the <Multipart Upload>.\n    The api will create the temp folder if it does not exist. Then\n     the chunk_data will be saved into the temp folder.\nHeader:\n    - session_id(string): The unique session id from client side\nForm:\n    - project_code(string): the target project will upload to\n    - operator(string): the name of operator\n    - resumable_filename(string): the name of file\n    - resumable_relative_path(string): the relative path of the file\n    - resumable_identifier(string): The job identifier for each file\n    - resumable_chunk_number(string): The integer id for each chunk\nReturn:\n    - 200, Succeed","operationId":"upload_chunks_v1_files_chunks_post","parameters":[{"required":false,"schema":{"title":"Session-Id","type":"string"},"name":"session-id","in":"header"}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_chunks_v1_files_chunks_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChunkUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/files/chunks/presigned":{"get":{"tags":["V1 Upload"],"summary":"upload chunks process.","description":"Summary:\n    The second api that the client side will call during the file\n     upload. I will return presigned upload url for EACH chunk. Then\n     client side will upload content throught it direcly into minio\nParameter:\n    - bucket(string): the unique bucket name\n    - key(string): the path of object\n    - upload_id(string): The job identifier for each file\n    - chunk_number(string): The integer id for each chunk\nReturn:\n    - 200, presigned url(str)","operationId":"generate_presigned_url_chunks_v1_files_chunks_presigned_get","parameters":[{"required":true,"schema":{"title":"Bucket","type":"string"},"name":"bucket","in":"query"},{"required":true,"schema":{"title":"Key","type":"string"},"name":"key","in":"query"},{"required":true,"schema":{"title":"Upload Id","type":"string"},"name":"upload_id","in":"query"},{"required":true,"schema":{"title":"Chunk Number","type":"integer"},"name":"chunk_number","in":"query"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChunkUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/files":{"post":{"tags":["V1 Upload"],"summary":"create a background worker to combine chunks, transfer file to the destination namespace","description":"Summary:\n    The third api will be called by client side. The client send\n    the acknoledgement for all chunks uploaded by signaling this\n    api. Once the upload service recieve the api calling, it will\n    start a background job to combine the chunks and process the\n    metadata\nForm:\n    - project_code(string): the target project will upload to\n    - operator(string): the name of operator\n    - resumable_filename(string): the name of file\n    - resumable_relative_path(string): the relative path of the file\n    - resumable_identifier(string): The job identifier for each file\n    - resumable_total_chunks(string): The number of total chunks\n    - resumable_total_size(float): the file size\n    - process_pipeline(string optional): default is None  # cli\n    - from_parents(list optional): default is None  # cli\n    - upload_message(string optional): default is ''  # cli\nReturn:\n    - 200, Succeed","operationId":"on_success_v1_files_post","parameters":[{"required":false,"schema":{"title":"Session-Id","type":"string"},"name":"session-id","in":"header"},{"required":false,"schema":{"title":"Authorization","type":"string"},"name":"Authorization","in":"header"},{"required":false,"schema":{"title":"Refresh-Token","type":"string"},"name":"refresh-token","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnSuccessUploadPOST"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/POSTCombineChunksResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/files/resumable":{"post":{"summary":"allow user to retrive the uploaded chunk number","description":"Summary:\n    The api to retrieve the uploaded parts. afterwards, client\n    side will call /v1/chunks and /v1/files to continue upload\nParameter:\n    - bucket(str): the unique code of bucket\n    - object_infos(List[ObjectInfo]): the list of pairs contains following:\n        - object_path(str): the unique path in object storage\n        - resumable_id(str): the unique identifier for resumable upload\nreturn:\n    - result(list):\n        - object_path(str): the unique path in object storage\n        - resumable_id(str): the unique identifier for resumable upload\n        - chunks_info(dict[str: str]): the pair of chunk_number: etag","operationId":"resumable_upload_v1_files_resumable_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResumableUploadPOST"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResumableUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Body_upload_chunks_v1_files_chunks_post":{"title":"Body_upload_chunks_v1_files_chunks_post","required":["project_code","operator","resumable_identifier","resumable_filename","resumable_chunk_number","chunk_data"],"type":"object","properties":{"project_code":{"title":"Project Code","type":"string"},"operator":{"title":"Operator","type":"string"},"resumable_identifier":{"title":"Resumable Identifier","type":"string"},"resumable_filename":{"title":"Resumable Filename","type":"string"},"resumable_relative_path":{"title":"Resumable Relative Path","type":"string","default":""},"resumable_chunk_number":{"title":"Resumable Chunk Number","type":"integer"},"chunk_data":{"title":"Chunk Data","type":"string","format":"binary"}}},"ChunkUploadResponse":{"title":"ChunkUploadResponse","type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/EAPIResponseCode"}],"default":200},"error_msg":{"title":"Error Msg","type":"string","default":""},"page":{"title":"Page","type":"integer","default":0},"total":{"title":"Total","type":"integer","default":1},"num_of_pages":{"title":"Num Of Pages","type":"integer","default":1},"result":{"title":"Result","type":"object","default":{},"example":{"msg":"Succeed"}}},"description":"Chunk upload response class."},"EAPIResponseCode":{"title":"EAPIResponseCode","enum":[200,500,400,404,403,401,409],"description":"An enumeration."},"HTTPValidationError":{"title":"HTTPValidationError","type":"object","properties":{"detail":{"title":"Detail","type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}}},"ObjectInfo":{"title":"ObjectInfo","required":["object_path","resumable_id"],"type":"object","properties":{"object_path":{"title":"Object Path","type":"string"},"resumable_id":{"title":"Resumable Id","type":"string"}}},"OnSuccessUploadPOST":{"title":"OnSuccessUploadPOST","required":["project_code","operator","job_id","item_id","resumable_identifier","resumable_filename","resumable_relative_path","resumable_total_chunks","resumable_total_size"],"type":"object","properties":{"project_code":{"title":"Project Code","type":"string"},"operator":{"title":"Operator","type":"string"},"job_id":{"title":"Job Id","type":"string"},"item_id":{"title":"Item Id","type":"string"},"resumable_identifier":{"title":"Resumable Identifier","type":"string"},"resumable_filename":{"title":"Resumable Filename","type":"string"},"resumable_relative_path":{"title":"Resumable Relative Path","type":"string"},"resumable_total_chunks":{"title":"Resumable Total Chunks","type":"integer"},"resumable_total_size":{"title":"Resumable Total Size","type":"number"},"tags":{"title":"Tags","type":"array","items":{"type":"string"},"default":[]},"metadatas":{"title":"Metadatas","type":"object"},"process_pipeline":{"title":"Process Pipeline","type":"string"},"from_parents":{"title":"From Parents","type":"array","items":{}},"upload_message":{"title":"Upload Message","type":"string","default":""}},"description":"Merge chunks payload model."},"POSTCombineChunksResponse":{"title":"POSTCombineChunksResponse","type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/EAPIResponseCode"}],"default":200},"error_msg":{"title":"Error Msg","type":"string","default":""},"page":{"title":"Page","type":"integer","default":0},"total":{"title":"Total","type":"integer","default":1},"num_of_pages":{"title":"Num Of Pages","type":"integer","default":1},"result":{"title":"Result","type":"object","default":{},"example":{"session_id":"unique_session","job_id":"upload-0a572418-7c2b-11eb-8428-be498ca98c54-1614780986","target_names":"<path>","action":"data_upload","status":"PRE_UPLOADED | SUCCEED","project_code":"em0301","operator":"zhengyang","progress":0,"payload":{"resumable_identifier":"upload-0a572418-7c2b-11eb-8428-be498ca98c54-1614780986","parent_folder_geid":"1e3fa930-8b41-11eb-845f-eaff9e667817-1616439736"},"update_timestamp":"1614780986"}}},"description":"Get Job status response class."},"PreUploadPOST":{"title":"PreUploadPOST","required":["project_code","operator","data","parent_folder_id"],"type":"object","properties":{"project_code":{"title":"Project Code","type":"string"},"operator":{"title":"Operator","type":"string"},"job_type":{"title":"Job Type","type":"string","default":"AS_FOLDER | AS_FILE"},"data":{"title":"Data","type":"array","items":{"$ref":"#/components/schemas/SingleFileForm"}},"current_folder_node":{"title":"Current Folder Node","type":"string","default":""},"parent_folder_id":{"title":"Parent Folder Id","type":"string"},"incremental":{"title":"Incremental","type":"boolean","default":false}},"description":"Pre upload payload model."},"PreUploadResponse":{"title":"PreUploadResponse","type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/EAPIResponseCode"}],"default":200},"error_msg":{"title":"Error Msg","type":"string","default":""},"page":{"title":"Page","type":"integer","default":0},"total":{"title":"Total","type":"integer","default":1},"num_of_pages":{"title":"Num Of Pages","type":"integer","default":1},"result":{"title":"Result","type":"object","default":{},"example":[{"session_id":"unique_session_2021","job_id":"1bfe8fd8-8b41-11eb-a8bd-eaff9e667817-1616439732","target_names":"file1.png","action":"data_upload","status":"PRE_UPLOADED","project_code":"gregtest","operator":"zhengyang","progress":0,"payload":{"resumable_identifier":"1bfe8fd8-8b41-11eb-a8bd-eaff9e667817-1616439732","parent_folder_geid":"1bcbe182-8b41-11eb-bf7a-eaff9e667817-1616439732"},"update_timestamp":"1616439731"}]}},"description":"Pre upload response class."},"ResumableUploadPOST":{"title":"ResumableUploadPOST","required":["bucket","object_infos"],"type":"object","properties":{"bucket":{"title":"Bucket","type":"string"},"object_infos":{"title":"Object Infos","type":"array","items":{"$ref":"#/components/schemas/ObjectInfo"}}},"description":"Pre upload payload model."},"ResumableUploadResponse":{"title":"ResumableUploadResponse","type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/EAPIResponseCode"}],"default":200},"error_msg":{"title":"Error Msg","type":"string","default":""},"page":{"title":"Page","type":"integer","default":0},"total":{"title":"Total","type":"integer","default":1},"num_of_pages":{"title":"Num Of Pages","type":"integer","default":1},"result":{"title":"Result","type":"array","items":{},"default":[]}}},"SingleFileForm":{"title":"SingleFileForm","required":["resumable_filename"],"type":"object","properties":{"resumable_filename":{"title":"Resumable Filename","type":"string"},"resumable_relative_path":{"title":"Resumable Relative Path","type":"string","default":""}}},"ValidationError":{"title":"ValidationError","required":["loc","msg","type"],"type":"object","properties":{"loc":{"title":"Location","type":"array","items":{"anyOf":[{"type":"string"},{"type":"integer"}]}},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}}}}}}