I get this error, I’m new to Vectara
I’m trying to upload my data to the vectara API,
Failed to upload. Status code: 403, Response: {“messages”:[“Denied access to uploadFile.”],“request_id”:“9425e11a35562cf47b4d41e7dbfe7959”}
Hi @Mira_Melhem - can you please share your full request code or cURL (w/o API key please)?
the error changed it got to be this
- I changed the url and got this Failed to upload. Status code: 201, Response: {“id”:“Arabic7.pdf”,“metadata”:{“title”:“arabic07P2CS6.indd”,“author”:“”,“subject”:“”,“keywords”:“”,“creator”:“Adobe InDesign CS6 (Macintosh)”,“producer”:“iLovePDF”,“creationDate”:1614190754000,“modificationDate”:1614690806000},“storage_usage”:{“bytes_used”:180355,“metadata_bytes_used”:67967}}
and this is my code
import requests
url = “https://api.vectara.io/v2/corpora/---/upload_file”
files = {
‘file’: (‘Arabic7.pdf’, open(‘./Vectara/Arabic7.pdf’, ‘rb’), ‘application/pdf’)
}
headers = {
‘Accept’: ‘application/json’,
‘x-api-key’: ‘???’
}
response = requests.post(url, headers=headers, files=files)
if response.status_code == 200:
print(“Upload successful”)
else:
print(f"Failed to upload. Status code: {response.status_code}, Response: {response.text}")
Pls note that with file-upload API in APIv2, the 201 status code is not an error code, it rather means “document successfully added” (Add a document to a corpus | Vectara Docs)