I am sending the file to tape via API without any problems
but when I try to view the file on tape itself it displays the message āfailed to load PDF documentā
but when I download the file and upload it again to tape manually the display works perfectly
Hi Joao,
Maybe this has to do with the fact that your pdf already has the pdf extension in the filename and there is an additional .pdf being appended. Have you noticed this (the two .pdf in the filename)? Maybe this could be producing the issue.
Have you tried simply changing the name deleting one of the ā.pdfā? This can be happening because somehow the extension is not being shown on upload and .pdf is automatically being added (but not at all sure without more info). If this is the case try to clearly show the extension in the filename before upload and then retest.
I hope this helps you.
Best,
R.J.
I just noticed another dot in the ā4.00ā, maybe this is producing the problem, you could try to remove it or changing it with another character before the upload and then retest.
Thanks for the help, Iāll try to review the code for testing but using the same file that I downloaded directly from tape and itās not being displayed, and uploading it again the visualization works, see example
Hi Joao,
I am not sure I understand your reply correctly. Maybe the uploads are being treated differently (more strictly, or literally) depending on where the upload is being made through the API or manually. Although I would strongly recommend to check the code and make more tests with the filename. Donāt forget to check different browsers (with different cores ideally, chromium, firefoxā¦) in order to discard some random browser bugs.
Best,
R.J.
sorry for the delay and thanks for the help, but I just ran the test using a file with a normal name via API and I had the same result, I used a test field for validation
Here is the code I used with the security information properly hidden
url = āhttps://api.tapeapp.com/v1/file/uploadā
headers = {}
auth_token = token
most_recent_file = r"C:\Users\joaom\Downloads\1107 t4.pdf"
with open(most_recent_file, ārbā) as file:
files = {āfileā: file}
response = requests.post(
url,
headers=headers,
auth=(auth_token, āā),
files=files
)
response_json = response.json()
file_id = response_json.get('file_id')
url2 = f"https://api.tapeapp.com/v1/record/{record_ID}"
headers = {"Content-Type": "application/json"}
data = {
"fields": {
"file_test": file_id
}
}
response = requests.put(
url2,
headers=headers,
auth=(auth_token, ''),
json=data
)
Hi Joao,
You are welcome. If so, Iām sorry, but Iām not sure what to suggest next.
Best,
R.J.