# 云存储HTTP上传下载

>> 上传流程：1 > 2 
> 
>> 下载流程  3 > 5
> 
>> 下载缩略图流程  4 > 5

## 1、SDK 初始化文件上传
> InitHttpUploadWithCallBack(long int port, char* domain, char* thumbPath, char* fPath, char* outDir, short int isEncrypt, short int platform, char* callBackUrl)
***
+ **请求参数**

|    请求参数     | 必选  |  参数类型  | 说明                           |
|:-----------:|:---:|:------:|:-----------------------------|
|    port     |  是  |  int   | 异步返回端口                       |
|   domain    |  是  | string | 请求域名                         |
|  thumbPath  |  否  | string | 缩略图路径                        |
|    fPath    |  是  | string | 原文件路径                        |
|   outDir    |  否  | string | 新文件存放路径                      |
|  isEncrypt  |  是  |  int   | 是否加密：1加密，0不加密                |
|  platform   |  是  |  int   | 平台类型                         |
| callBackUrl |  否  | string | 需要回调url地址【文件上传成功，服务端自动请求该地址】 |



+ **请求示例**
~~~ text
//初始化文件上传，自动请求http

InitHttpUploadWithCallBack(30069, "https://node1.17qpb.com:2081", "", "C:\\Users\\Administrator\\Desktop\\mvs\\v24770.mp4", "", 1, 1, "")
~~~

+ **返回参数**

|          返回参数           |  参数类型  | 说明                                                 |
|:-----------------------:|:------:|:---------------------------------------------------|
|          code           |  int   | 200 成功 ， 500 失败                                    |
|          data           | string | 失败会放错误信息                                           |
|        data.data        |  obj   | http返回数据                                           |
|   data.data.Uploaded    |  int   | 已上传大小                                              |
|     data.data.Total     |  int   | 总大小                                                |
|   data.data.Progress    |  int   | 进度 0-100                                           |
|    data.data.Status     |  int   | //上传状态  1 上传完成，2 上传中， 3 上传失败                       |
|      data.data.Err      |  int   | 错误码 3000 分享索引信息失败, 3009 空间不足；需要申请空间, 3010 文件上传最大限制 |
|    data.data.Missing    |  obj   | 文件缺失部分                                             |
| data.data.Missing.start |  int   | 起始位置                                               |
|  data.data.Missing.end  |  int   | 结束位置                                               |
|       data.net_id       | string | 用户节点地址                                             |
|     data.file_hash      | string | 文件hash                                             |
|      data.password      | string | 文件密码                                               |
|       data.unique       | string | 唯一标识                                               |
|        data.sign        | string | 删除文件的签名信息                                          |
|      data.out_path      | string | 上传文件                                               |
|    data.upload_size     |  int   | 上传文件大小                                             |

+ **返回示例- 异步返回**

~~~ json

{
    "code": 200,
    "data": {
        "data": {
            "uploaded": 0,
            "file_size": 0,
            "progress": 0,
            "status": 2,
            "missing": [
                {
                    "start": 0,
                    "end": 94114944
                }
            ],
            "err": 0
        },
        "file_hash": "2p3WjDoW85LdgmVRB7WpQP8Bb6kLkmVct9V9cRz4pLmX",
        "net_id": "DrN25k5ezs7iUDjJFMZbM3EGMYs8HR6pAy4FpCygmd3J",
        "out_path": "download\\tmp\\http_6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so_",
        "password": "111111",
        "sign": "{\"Category\":\"FqTKfDp5r1vyxK1EGgKrj2djvsmLZuyfasKybXMBJmV4\",\"Address\":\"FL5Yt7DBNiLVqpu6uMVwhAr3dvtPKipw3wiKhg8d4kDm\",\"Data\":[{\"Unique\":\"5waMGZefpmsHN3FEcd74rAb8YWFZAqcheXKfxZcxA1jS\",\"Hash\":\"24Maxuk9Mt4oWH39WaQ7FfomPbCF6We3XKGgCvw7t5x3\",\"Platform\":1}],\"Content\":null,\"Sign\":\"OX7PwbItJX/UwRDkbP09CjJ+ITQDnZ7fyOrHlYPWERgXsVjzGkkWvh9ZCxdTtXDTrAUNW+3vQQK13PNIbFEYCA==\",\"PubKey\":\"S+tmi0blryRPCQpbFJpjJlGNXtFW+1ojjq+SmtP4+Hk=\"}",
        "unique": "6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so",
        "upload_size": 94114944
    }
}

~~~


## 1.1、SDK 初始化文件上传
> InitHttpUploadWithCallBackV1(long int port, char* domain, char* thumbPath, char* fPath, char* outDir, char* pwd, short int platform, char* callBackUrl)
***
+ **请求参数**

|    请求参数     | 必选  |  参数类型  | 说明                           |
|:-----------:|:---:|:------:|:-----------------------------|
|    port     |  是  |  int   | 异步返回端口                       |
|   domain    |  是  | string | 请求域名                         |
|  thumbPath  |  否  | string | 缩略图路径                        |
|    fPath    |  是  | string | 原文件路径                        |
|   outDir    |  否  | string | 新文件存放路径                      |
|     pwd     |  否  | string | 密码                           |
|  platform   |  是  |  int   | 平台类型                         |
| callBackUrl |  否  | string | 需要回调url地址【文件上传成功，服务端自动请求该地址】 |



+ **请求示例**
~~~ text
//初始化文件上传，自动请求http

InitHttpUploadWithCallBackV1(30069, "https://node1.17qpb.com:2081", "", "C:\\Users\\Administrator\\Desktop\\mvs\\v24770.mp4", "", "123546", 1, "")
~~~

+ **返回参数**

|          返回参数           |  参数类型  | 说明                                                 |
|:-----------------------:|:------:|:---------------------------------------------------|
|          code           |  int   | 200 成功 ， 500 失败                                    |
|          data           | string | 失败会放错误信息                                           |
|        data.data        |  obj   | http返回数据                                           |
|   data.data.Uploaded    |  int   | 已上传大小                                              |
|     data.data.Total     |  int   | 总大小                                                |
|   data.data.Progress    |  int   | 进度 0-100                                           |
|    data.data.Status     |  int   | //上传状态  1 上传完成， 2 上传中，3 上传失败                       |
|      data.data.Err      |  int   | 错误码 3000 分享索引信息失败, 3009 空间不足；需要申请空间, 3010 文件上传最大限制 |
|    data.data.Missing    |  obj   | 文件缺失部分                                             |
| data.data.Missing.start |  int   | 起始位置                                               |
|  data.data.Missing.end  |  int   | 结束位置                                               |
|       data.net_id       | string | 用户节点地址                                             |
|     data.file_hash      | string | 文件hash                                             |
|      data.password      | string | 文件密码                                               |
|       data.unique       | string | 唯一标识                                               |
|        data.sign        | string | 删除文件的签名信息                                          |
|      data.out_path      | string | 上传文件                                               |
|    data.upload_size     |  int   | 上传文件大小                                             |

+ **返回示例- 异步返回**

~~~ json

{
    "code": 200,
    "data": {
        "data": {
            "uploaded": 0,
            "file_size": 0,
            "progress": 0,
            "status": 2,
            "missing": [
                {
                    "start": 0,
                    "end": 94114944
                }
            ],
            "err": 0
        },
        "file_hash": "2p3WjDoW85LdgmVRB7WpQP8Bb6kLkmVct9V9cRz4pLmX",
        "net_id": "DrN25k5ezs7iUDjJFMZbM3EGMYs8HR6pAy4FpCygmd3J",
        "out_path": "download\\tmp\\http_6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so_",
        "password": "111111",
        "sign": "{\"Category\":\"FqTKfDp5r1vyxK1EGgKrj2djvsmLZuyfasKybXMBJmV4\",\"Address\":\"FL5Yt7DBNiLVqpu6uMVwhAr3dvtPKipw3wiKhg8d4kDm\",\"Data\":[{\"Unique\":\"5waMGZefpmsHN3FEcd74rAb8YWFZAqcheXKfxZcxA1jS\",\"Hash\":\"24Maxuk9Mt4oWH39WaQ7FfomPbCF6We3XKGgCvw7t5x3\",\"Platform\":1}],\"Content\":null,\"Sign\":\"OX7PwbItJX/UwRDkbP09CjJ+ITQDnZ7fyOrHlYPWERgXsVjzGkkWvh9ZCxdTtXDTrAUNW+3vQQK13PNIbFEYCA==\",\"PubKey\":\"S+tmi0blryRPCQpbFJpjJlGNXtFW+1ojjq+SmtP4+Hk=\"}",
        "unique": "6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so",
        "upload_size": 94114944
    }
}

~~~

## 1.2、SDK Socialfi初始化文件上传
> InitHttpSocialfiUpload(long long int port, char* domain, char* thumbPath, char* fPath, char* outDir, char* pwd, short int platform, char* callBackUrl, char* extend, short int isTranscode, char* transcodeCallback)
***
+ **请求参数**

|       请求参数        | 必选  |  参数类型  | 说明                           |
|:-----------------:|:---:|:------:|:-----------------------------|
|       port        |  是  |  int   | 异步返回端口                       |
|      domain       |  是  | string | 请求域名                         |
|     thumbPath     |  否  | string | 缩略图路径                        |
|       fPath       |  是  | string | 原文件路径                        |
|      outDir       |  否  | string | 新文件存放路径                      |
|        pwd        |  否  | string | 密码                           |
|     platform      |  是  |  int   | 平台类型                         |
|    callBackUrl    |  否  | string | 需要回调url地址【文件上传成功，服务端自动请求该地址】 |
|    isTranscode    |  否  |  int   | 是否转码：1 需要转码，0不转码             |
| transcodeCallback |  否  | string | 转码回调                         |



+ **请求示例**
~~~ text
//初始化文件上传，自动请求http

InitHttpSocialfiUpload(30069, "https://node1.17qpb.com:2081", "", "C:\\Users\\Administrator\\Desktop\\mvs\\v24770.mp4", "", "123546", 1, "", 0, "")
~~~

+ **返回参数**

|          返回参数           |  参数类型  | 说明                                                 |
|:-----------------------:|:------:|:---------------------------------------------------|
|          code           |  int   | 200 成功 ， 500 失败                                    |
|          data           | string | 失败会放错误信息                                           |
|        data.data        |  obj   | http返回数据                                           |
|   data.data.Uploaded    |  int   | 已上传大小                                              |
|     data.data.Total     |  int   | 总大小                                                |
|   data.data.Progress    |  int   | 进度 0-100                                           |
|    data.data.Status     |  int   | //上传状态  1 上传完成， 2 上传中，3 上传失败                       |
|      data.data.Err      |  int   | 错误码 3000 分享索引信息失败, 3009 空间不足；需要申请空间, 3010 文件上传最大限制 |
|    data.data.Missing    |  obj   | 文件缺失部分                                             |
| data.data.Missing.start |  int   | 起始位置                                               |
|  data.data.Missing.end  |  int   | 结束位置                                               |
|       data.net_id       | string | 用户节点地址                                             |
|     data.file_hash      | string | 文件hash                                             |
|      data.password      | string | 文件密码                                               |
|       data.unique       | string | 唯一标识                                               |
|        data.sign        | string | 删除文件的签名信息                                          |
|      data.out_path      | string | 上传文件                                               |
|    data.upload_size     |  int   | 上传文件大小                                             |

+ **返回示例- 异步返回**

~~~ json

{
    "code": 200,
    "data": {
        "data": {
            "uploaded": 0,
            "file_size": 0,
            "progress": 0,
            "status": 2,
            "missing": [
                {
                    "start": 0,
                    "end": 94114944
                }
            ],
            "err": 0
        },
        "file_hash": "2p3WjDoW85LdgmVRB7WpQP8Bb6kLkmVct9V9cRz4pLmX",
        "net_id": "DrN25k5ezs7iUDjJFMZbM3EGMYs8HR6pAy4FpCygmd3J",
        "out_path": "download\\tmp\\http_6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so_",
        "password": "111111",
        "sign": "{\"Category\":\"FqTKfDp5r1vyxK1EGgKrj2djvsmLZuyfasKybXMBJmV4\",\"Address\":\"FL5Yt7DBNiLVqpu6uMVwhAr3dvtPKipw3wiKhg8d4kDm\",\"Data\":[{\"Unique\":\"5waMGZefpmsHN3FEcd74rAb8YWFZAqcheXKfxZcxA1jS\",\"Hash\":\"24Maxuk9Mt4oWH39WaQ7FfomPbCF6We3XKGgCvw7t5x3\",\"Platform\":1}],\"Content\":null,\"Sign\":\"OX7PwbItJX/UwRDkbP09CjJ+ITQDnZ7fyOrHlYPWERgXsVjzGkkWvh9ZCxdTtXDTrAUNW+3vQQK13PNIbFEYCA==\",\"PubKey\":\"S+tmi0blryRPCQpbFJpjJlGNXtFW+1ojjq+SmtP4+Hk=\"}",
        "unique": "6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so",
        "upload_size": 94114944
    }
}
~~~

## 2、向服务器推送文件内容 put

> /api/v1/upload/range/:netId/:unique

***
+ **URL参数**

|  请求参数   | 必选  |  参数类型  | 说明     |
|:-------:|:---:|:------:|:-------|
| :netId  |  是  | string | 用户节点地址 |
| :unique |  是  | string | 唯一标识   |

***
+ **请求头**

|     请求参数      | 必选  |  参数类型  | 说明                                       |
|:-------------:|:---:|:------:|:-----------------------------------------|
| Content-Range |  是  | string | bytes 0-65169/65169 【推送内容起始位置、结束位置、文件大小】 |
| Content-Type  |  是  | string | application/octet-stream 【使用流方式】         |

+ **请求参数**

|  请求参数  | 必选  |  参数类型  | 说明        |
|:------:|:---:|:------:|:----------|
| 请求body |  是  | stream | 需要推送的文件内容 |

+ **请求示例**
~~~ text
//请求内容为推送的文件内容

curl --location --request PUT 'https://node1.17qpb.com:2081/api/v1/upload/range/Ea3uDjMB4aJ4qVFgUnuuxP4mMy6wssYuTMjY1ivUDicc/8FiTDxt7Gi1LmGxGvAfpBWRy3sjtB5gKr6oxRpGBi8LB' \
--header 'Content-Range: bytes 0-65169/65169' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@/E:/workspace/p2p-utils/demo/upload_node/upload/9wyLucGrkYV8v29dbKQ2SV6hLwogztwiKGGFpXMAnPpT/9wyLucGrkYV8v29dbKQ2SV6hLwogztwiKGGFpXMAnPpT.0'

~~~
+ **响应参数**

|  返回参数   |  参数类型  | 说明      |
|:-------:|:------:|:--------|
|  data   |  bool  | true 成功 |
| errCode |  int   | 错误码     |
| message | string | 错误信息    |


+ **返回示例**
~~~ json
{
    "data": true,
    "errCode": 0,
    "message": ""
}
~~~

## 3、下载文件信息 get

> /api/v1/download/range/:file_hash
> 
> /api/v1/download/range/:file_hash/:password
> 
> /api/v1/download/range/:file_hash/:net_id/:password

***
+ **URL参数**

|    请求参数    | 必选  |  参数类型  | 说明       |
|:----------:|:---:|:------:|:---------|
| :file_hash |  是  | string | 文件Hash   |
|  :net_id   |  否  | string | 上传用户节点地址 |
| :password  |  否  | string | 上传用户密码   |

***
+ **请求头**

| 请求参数  | 必选  |  参数类型  | 说明                            |
|:-----:|:---:|:------:|:------------------------------|
| Range |  是  | string | bytes=0-65169 【下载内容起始位置、结束位置】 |


+ **请求示例**
~~~ text
//状态为200或206 响应body为下载内容
//状态为404；不存在
//状态为401；密码错误

curl --location 'https://node1.17qpb.com:2081/api/v1/download/range/9ue7aqbqvx7MMW5Xn2miePg9R44xhAp8pnPvCB428uwX' \
--header 'Range: bytes=0-65169'

~~~

## 4、下载缩略图信息 get

> /api/v1/download/thumbnail/range/:file_hash
>
> /api/v1/download/thumbnail/range/:file_hash/:password
>
> /api/v1/download/thumbnail/range/:file_hash/:net_id/:password

***
+ **URL参数**

|    请求参数    | 必选  |  参数类型  | 说明       |
|:----------:|:---:|:------:|:---------|
| :file_hash |  是  | string | 文件Hash   |
|  :net_id   |  否  | string | 上传用户节点地址 |
| :password  |  否  | string | 上传用户密码   |

***
+ **请求头**

| 请求参数  | 必选  |  参数类型  | 说明                            |
|:-----:|:---:|:------:|:------------------------------|
| Range |  是  | string | bytes=0-65169 【下载内容起始位置、结束位置】 |


+ **请求示例**
~~~ text
//状态为200或206 响应body为下载内容
//状态为404；不存在
//状态为401；密码错误

curl --location 'http://172.28.0.124:2089/api/v1/download/thumbnail/range/7nC1DSvXHix4t2v1dvvfSmxFLcGnF7sfyGDvSxeh4MDW' \
--header 'Range: bytes=0-651690'

~~~

## 5、解码文件SDK【文件下载完成后，调用SDK解码】
> DecodeDownloadFile(long int port, char* domain, char* fileHash, char* fPath, char* outDir, char* uPwd)
***
+ **请求参数**

|   请求参数   | 必选  |  参数类型  | 说明               |
|:--------:|:---:|:------:|:-----------------|
|   port   |  是  |  int   | 异步返回端口           |
|  domain  |  是  | string | 下载文件时域名【文件解码时需要】 |
| fileHash |  是  | string | 文件hash           |
|  fPath   |  是  | string | 需要解码的文件路径        |
|  outDir  |  否  | string | 新文件存放路径          |
|   uPwd   |  否  | string | 文件密码             |

+ **请求示例**
~~~ text
//该方法会生成一个新的文件和初始化上传时需要的信息，上传时使用该文件

DecodeDownloadFile(30068, "https://node1.17qpb.com:2081","9ue7aqbqvx7MMW5Xn2miePg9R44xhAp8pnPvCB428uwX", "./v24770.mp4",  "", "123456")
~~~

+ **返回参数**

|       返回参数       |  参数类型  | 说明              |
|:----------------:|:------:|:----------------|
|       code       |  int   | 200 成功 ， 500 失败 |
|       data       | string | 解码后的文件路径        |

+ **返回示例- 异步返回**

~~~ json

{
    "code": 200,
    "data": "download\\v24770.mp4"
}

~~~

## 10、检测文件密码是否正确 get

> /api/v1/file/check_pwd/:file_hash
> /api/v1/file/check_pwd/:file_hash/:password
> /api/v1/file/check_pwd/:file_hash/:net_id/:password

***
+ **URL参数**

|    请求参数    | 必选  |  参数类型  | 说明       |
|:----------:|:---:|:------:|:---------|
| :file_hash |  是  | string | 文件Hash   |
|  :net_id   |  否  | string | 上传用户节点地址 |
| :password  |  是  | string | 上传用户密码   |


+ **请求示例**
~~~ text

//http状态码：200 表示密码正确， 400 表示参数错误， 401 密码错误， 404 表示不存在，

curl --location 'https://node1.17qpb.com:2081/api/v1/file/check_pwd/9ue7aqbqvx7MMW5Xn2miePg9R44xhAp8pnPvCB438uwX/123123'

~~~

## 11、检测文件Hash是否存在 get
> /api/v1/file/check_hash/:file_hash

***
+ **URL参数**

|    请求参数    | 必选  |  参数类型  | 说明     |
|:----------:|:---:|:------:|:-------|
| :file_hash |  是  | string | 文件Hash |

+ **请求示例**
~~~ text

//http状态码：200 表示存在， 400 表示参数错误， 404 表示不存在，

curl --location 'https://node1.17qpb.com:2081/api/v1/file/check_hash/9ue7aqbqvx7MMW5Xn2miePg9R44xhAp8pnPvCB438uwX'

~~~

## 12、获取上传进度 get

> /api/v1/upload/progress/:netId/:unique

***
+ **URL参数**

|  请求参数   | 必选  |  参数类型  | 说明     |
|:-------:|:---:|:------:|:-------|
| :netId  |  是  | string | 用户节点地址 |
| :unique |  是  | string | 唯一标识   |


+ **请求示例**
~~~ text
//请求内容为推送的文件内容
curl --location 'https://node1.17qpb.com:2081/api/v1/upload/progress/FL5Yt7DBNiLVqpu6uMVwhAr3dvtPKipw3wiKhg8d4kDm/6KDdA4CXMShp9S6P6Jis8oTA7aLu8d8Q9J452q1vpW7W'
~~~

+ **响应参数**

|        返回参数        |  参数类型  | 说明                                                 |
|:------------------:|:------:|:---------------------------------------------------|
|      errCode       |  int   | 错误码                                                |
|      message       | string | 错误信息                                               |
|        data        |  obj   | 响应数据                                               |
|   data.Uploaded    |  int   | 已上传大小                                              |
|     data.Total     |  int   | 总大小                                                |
|   data.Progress    |  int   | 进度 0-100                                           |
|    data.Status     |  int   | //上传状态  1 上传完成，2 上传中， 3 上传失败                       |
|      data.Err      |  int   | 错误码 3000 分享索引信息失败, 3009 空间不足；需要申请空间, 3010 文件上传最大限制 |
|    data.Missing    |  obj   | 文件缺失部分                                             |
| data.Missing.start |  int   | 起始位置                                               |
|  data.Missing.end  |  int   | 结束位置                                               |


+ **返回示例**
~~~ json
{
    "data": {
        "Uploaded": 34406400,
        "Total": 220617422,
        "Progress": 15.595504510971939,
        "Status": 2,
        "Err": 0,
        "Missing": [
            {
                "start": 34406400,
                "end": 220617421
            }
        ]
    },
    "errCode": 0,
    "message": ""
}
~~~

## 13、取消上传文件 delete

> /api/v1/upload/cancel/:netId/:unique

***
+ **URL参数**

|  请求参数   | 必选  |  参数类型  | 说明     |
|:-------:|:---:|:------:|:-------|
| :netId  |  是  | string | 用户节点地址 |
| :unique |  是  | string | 唯一标识   |

+ **请求示例**
~~~ text
//请求内容为推送的文件内容
curl --location --request DELETE 'https://node1.17qpb.com:2081/api/v1/upload/cancel/FL5Yt7DBNiLVqpu6uMVwhAr3dvtPKipw3wiKhg8d4kDm/CKvhE51SBuorvja2JJAwuSmCLKRqwowJLP8qJfwDgHQM'
~~~

+ **响应参数**

|        返回参数        |  参数类型  | 说明                                                 |
|:------------------:|:------:|:---------------------------------------------------|
|      errCode       |  int   | 错误码                                                |
|      message       | string | 错误信息                                               |
|        data        |  bool  | true 取消成功                                          |

+ **返回示例**
~~~ json
{
    "data": true,
    "errCode": 0,
    "message": ""
}
~~~

## 14、获取空间使用信息 get

> /api/v1/user/space/:netId

***
+ **URL参数**

|  请求参数   | 必选  |  参数类型  | 说明             |
|:-------:|:---:|:------:|:---------------|
| :netId  |  是  | string | 用户节点地址【IM节点地址】 |

+ **请求示例**
~~~ text
curl --location 'https://node1.17qpb.com:2081/api/v1/user/space/HhCwN3Ctn8gAnH6JrZrXnEyCiwg6m4YdSurs3myPPAcM'
~~~

+ **响应参数**

|     返回参数      |  参数类型  | 说明     |
|:-------------:|:------:|:-------|
|    errCode    |  int   | 错误码    |
|    message    | string | 错误信息   |
|     data      |  obj   | 空间实用信息 |
| data.Platform |  int   | 平台类型   |
|   data.Size   |  int   | 空间使用大小 |

+ **返回示例**
~~~ json
{
    "data": [
        {
            "Platform": 0,
            "Size": 9237
        }
    ],
    "errCode": 0,
    "message": ""
}
~~~



## 0、保存文件
> HttSaveFile(port C.longlong, domain, fileHash, filePwd, userPwd *C.char, platform C.short)
***
+ **请求参数**

|   请求参数   | 必选  |  参数类型  | 说明     |
|:--------:|:---:|:------:|:-------|
|   port   |  是  |  int   | 异步返回端口 |
|  domain  |  是  | string | 请求域名   |
| fileHash |  是  | string | 文件Hash |
| filePwd  |  否  | string | 文件密码   |
| userPwd  |  否  | string | 用户密码   |
| platform |  是  |  int   | 平台类型   |



+ **请求示例**
~~~ text
//初始化文件上传，自动请求http

HttSaveFile(30069, "https://node1.17qpb.com:2081", "2p3WjDoW85LdgmVRB7WpQP8Bb6kLkmVct9V9cRz4pLmX", "111", "111", 1)
~~~

+ **返回参数**

|      返回参数      |  参数类型  | 说明              |
|:--------------:|:------:|:----------------|
|      code      |  int   | 200 成功 ， 500 失败 |
|      data      | string | 失败会放错误信息        |
|   data.data    |  obj   | http返回数据        |
| data.file_hash | string | 文件hash          |
| data.password  | string | 文件密码            |
|  data.unique   | string | 唯一标识            |
|   data.sign    | string | 签名信息【用于删除文件】    |

+ **返回示例- 异步返回**

~~~ json

{
    "code": 200,
    "data": {
        "file_hash": "2p3WjDoW85LdgmVRB7WpQP8Bb6kLkmVct9V9cRz4pLmX",
        "password": "111111",
        "unique": "6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so",
        "sign": "6xknfkGebMhZYNUfP9hsNtH1KLJ3Ujm2MRCweHMZm2so",
    }
}

~~~


## 0、云存储ping
> CloudHttpPing(port C.longlong, proxyStr *C.char)
***
+ **请求参数**

|   请求参数   | 必选  |  参数类型  | 说明                        |
|:--------:|:---:|:------:|:--------------------------|
|   port   |  是  |  int   | 异步返回端口                    |
| proxyStr |  是  | string | 代理节点信息【配置信息里面的proxy_addr】 |



+ **请求示例**
~~~ text
//初始化文件上传，自动请求http

CloudHttpPing(30069, `[{"code":"SG_test","host":"47.237.115.37:39965","cloud_domain":"https://node8.17qpb.com:3365","nodeId":"5CGffsVg9uv8T5t6sJsGZfa4NetbyaSVg4DS2QuZuBUy"},{"code":"HK_test","host":"8.217.180.56:39965","cloud_domain":"https://node5.17qpb.com:3365","nodeId":"zJRFmABeg5BrJcqLCQaiUMvBeQwGRqBQ2CiD8LD8SeC"},{"code":"SG_test","host":"47.237.28.186:39965","cloud_domain":"https://node9.17qpb.com:3365","nodeId":"HSthkFTruUDQnvrKt6JLh15HqHhxdtY2DocGQtPxcn9E"}]`)
~~~

+ **返回参数**

|       返回参数        |  参数类型  | 说明              |
|:-----------------:|:------:|:----------------|
|       code        |  int   | 200 成功 ， 500 失败 |
|       data        | string | 失败会放错误信息        |
| data.cloud_domain | string | 云存储域名           |
|    data.nodeId    | string | 节点地址            |
|     data.host     | string | host            |
|     data.ttl      |  int   | 响应毫秒            |
|    data.state     |  int   | 状态：1 可用， 0 不可用  |

+ **返回示例- 异步返回**

~~~ json

{
  "code": 200,
  "data": {
    "cloud_domain": "https://node8.17qpb.com:3365",
    "nodeId": "5CGffsVg9uv8T5t6sJsGZfa4NetbyaSVg4DS2QuZuBUy",
    "host": "47.237.115.37:39965",
    "code": "SG_test",
    "ttl": 86,
    "state": 1
  }
}

~~~


## 10、检测文件密码是否正确 get

> /store/file/:file_hash/:password

***
+ **URL参数**

|    请求参数    | 必选  |  参数类型  | 说明       |
|:----------:|:---:|:------:|:---------|
| :file_hash |  是  | string | 文件Hash   |
| :password  |  是  | string | 上传用户密码   |


+ **请求示例**
~~~ text

//http状态码：200 || 206 表示密码正确， 400 表示参数错误， 401 密码错误， 404 表示不存在，

curl --location 'https://node1.17qpb.com:2081/store/file/9ue7aqbqvx7MMW5Xn2miePg9R44xhAp8pnPvCB438uwX/123123'

~~~