知識庫文件轉換
更新時間:
excel轉docx文件上傳接口
HTTP接口
shell
curl --location 'https://nlp.aliyuncs.com/v2/api/common/file/asyn/upload' \
--header 'Expect;' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--header 'x-fag-servicename: aca-doc-converter-submit' \
--header 'x-fag-appcode: aca' \
--header 'Authorization: Bearer your-api-key' \
--data '{
"sourceUrl":"公網可訪問的xlsx文件url",
"type":"excelToDocx"
}'
python
import json
import requests
api_key = "your-api-key"
service_name = "aca-doc-converter-submit"
url = "https://nlp.aliyuncs.com/v2/api/common/file/asyn/upload"
headers = {
"Content-Type": "application/json",
"x-fag-servicename": "aca-doc-converter-submit",
"x-fag-appcode": "aca",
"Authorization": f"Bearer {api_key}"
}
payload = {
"sourceUrl":"公網可訪問的xlsx文件url",
"type":"excelToDocx"
}
response = requests.post(url, headers=headers, json=payload)
print(response.status_code)
print(json.loads(response.text))
excel轉docx文件結果下載接口
HTTP接口
shell
curl --location 'https://nlp.aliyuncs.com/v2/api/common/file/asyn/download?taskId=xxx' \
--header 'Expect;' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--header 'x-fag-servicename: aca-doc-converter-result' \
--header 'x-fag-appcode: aca' \
--header 'Authorization: Bearer your-api-key'
python
import json
import requests
api_key = "your-api-key"
service_name = "aca-doc-converter-result"
url = "https://nlp.aliyuncs.com/v2/api/common/file/asyn/download"
headers = {
"Content-Type": "application/json",
"x-fag-servicename": "aca-doc-converter-result",
"x-fag-appcode": "aca",
"Authorization": f"Bearer {api_key}"
}
payload = {
"taskId": xxx
}
response = requests.get(url, headers=headers, params=payload)
print(response.status_code)
print(json.loads(response.text))
文檔內容是否對您有幫助?