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 requestsimport json# The URL for the get_summary endpointurl ='https://api.knowbase.ai/api/v1/get_summary'# Replace 'your_access_token_here' with the actual access token you received from the APIheaders ={'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 fordata ={'file_id':'your_file_id_here'}# Make the POST request to get the summary of the fileresponse = requests.post(url, headers=headers, data=json.dumps(data))# Check the responseif response.status_code ==200:print("Successfully retrieved the summary of the file.")print(response.json())# This will print the summary of the fileelif response.status_code ==202:print("Summary processing.")print(response.json())# This will print the message indicating that the summary is being processedelse:print("Failed to retrieve the summary.")print(response.json())# This will print the error message