To retrieve the summary of a text file by providing its `file_id`
GEThttps://api.knowbase.ai/api/v1/get_summary
Headers
Name
Type
Description
access-token*
string
Required. Your API access token
Request Body
Name
Type
Description
file_id*
string
The ID of the file to summarize
{
"summary": "string"
}
{
"detail": "string"
}
{
"error": "string"
}
Example usage
import requests
import json
# The URL for the get_summary endpoint
url = 'https://api.knowbase.ai/api/v1/get_summary'
# Replace 'your_access_token_here' with the actual access token you received from the API
headers = {
'access-token': 'your_access_token_here',
'Content-Type': 'application/json' # Specify the content type as JSON
}
# Replace 'your_file_id_here' with the actual file ID you want to get the summary for
data = {
'file_id': 'your_file_id_here'
}
# Make the POST request to get the summary of the file
response = requests.post(url, headers=headers, data=json.dumps(data))
# Check the response
if response.status_code == 200:
print("Successfully retrieved the summary of the file.")
print(response.json()) # This will print the summary of the file
elif response.status_code == 202:
print("Summary processing.")
print(response.json()) # This will print the message indicating that the summary is being processed
else:
print("Failed to retrieve the summary.")
print(response.json()) # This will print the error message