Skip to main content

Delete a document

This topic describes the syntax for deleting a document in Tongyi Data Mining and provides examples.

Request syntax

POST /zhiwen-file/delete_file HTTP/1.1

Request parameters

Name

Type

Required

Description

Example

fileId

string

Yes

The ID of the document to delete.

file_zhiwen_XXX

Response parameters

Name

Type

Description

code

int

The status code.

request_id

string

The request ID.

success

boolean

Indicates whether the request was successful.

message

string

The response message.

Examples

Request examples

import os
import requests
from http import HTTPStatus

'''
API name: Delete a document
API path: https://dashscope.aliyuncs.com/api/v2/apps/zhiwen-file/delete_file
Environment requirements: Python >= 3.7
'''

url = "https://dashscope.aliyuncs.com/api/v2/apps/zhiwen-file/delete_file"
request_headers = {
    "Authorization": os.environ.get("DASHSCOPE_API_KEY"),  # If you have not configured the environment variable, replace the variable with your API key.
    "Content-Type": "application/json"
}

response = requests.post(url,
                         json={
                             "fileId": "file_zhiwen_5f6e46d308a145b182c4bf1b788cea07_10035945"
                         },
                         headers=request_headers)

if response.status_code == HTTPStatus.OK:
    print(response.json())
else:
    print(f'response={response.json()}')
    print(f'code={response.status_code}')

Successful response example

JSON format
{
  "code": 200,
  "request_id": "1a022107-2b41-979f-a730-59b43d3ada2c",
  "success": true,
  "message": "Success"
}

Error codes

For more information, see Error codes for Tongyi Data Mining.
Agent Development
Agent Context
Agent Governance & Evolution
Store
Application Marketplace