TOKEN使用文档
2022-3-30 大约 1 分钟
# TOKEN使用文档
云存储 TOKEN 是您访问云存储空间的令牌,具有账户的完全权限,您可以远程管理云空间里的文件,请您务必妥善保管!不要以任何方式公开TOKEN到外部渠道,避免被他人利用造成损失。
https://dev-api.csdn.net/open/api/v1/oss/resource?token={token}
请求方式:post
请求参数:
bucketName:空间名称
objectName:要操作的对象名称
action: 操作类型,支持GET(下载),PUT(上传/修改),DELETE(删除)
返回参数:
publicUrl: 通过此链接操作对象,请求方式与传参action相同
请求示例:
curl --location --request POST 'https://dev-api.csdn.net/open/api/v1/oss/resource?token=vlJM1bVEDdeAhLJ9DKvo4CN0AhbnS0gXDQt5oh8ogc5ZDgkHZnVOu9q2sGVIeoxM6ecVcEjUdaCh5BWgujNSvH5l3IREF9A3vMeB' \
--header 'Content-Type: application/json' \
--data-raw '{
"bucketName":"testBucket",
"objectName":"test.xlsx",
"action":"delete"
}'
1
2
3
4
5
6
7
2
3
4
5
6
7
通过返回链接操作对象示例:
下载:
curl --location --request GET 'https://dev-api.csdn.net/ocrTest4.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220330T065306Z&X-Amz-SignedHeaders=host&X-Amz-Expires=115198&X-Amz-Credential=JDC_E02A435E5BB8E8FB59EF0CDB40BC%2F20220330%2Fcn-north-1%2Fs3%2Faws4_request&X-Amz-Signature=c0db0eb69bd6a3cdeacdfab1326cdc5ef767e518b72512870002845828a854d8'
1
上传/修改:
curl --location --request PUT 'https://dev-api.csdn.net/ocrTest4.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220330T065306Z&X-Amz-SignedHeaders=host&X-Amz-Expires=115198&X-Amz-Credential=JDC_E02A435E5BB8E8FB59EF0CDB40BC%2F20220330%2Fcn-north-1%2Fs3%2Faws4_request&X-Amz-Signature=c0db0eb69bd6a3cdeacdfab1326cdc5ef767e518b72512870002845828a854d8' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@/Users/Downloads/C0A848349E4718B4AAC22C9027380000-1631174086730'
1
2
3
2
3
删除:
curl --location --request DELETE 'https://dev-api.csdn.net/ocrTest4.xlsx?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220330T065306Z&X-Amz-SignedHeaders=host&X-Amz-Expires=115198&X-Amz-Credential=JDC_E02A435E5BB8E8FB59EF0CDB40BC%2F20220330%2Fcn-north-1%2Fs3%2Faws4_request&X-Amz-Signature=c0db0eb69bd6a3cdeacdfab1326cdc5ef767e518b72512870002845828a854d8'
1
返回状态码:
200: ok
200001: token不能为空
200002: token无效
200003: action不能为空
200004: action只支持GET,PUT,DELETE
200005: 当前token只支持[GET,PUT,DELETE]操作
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8