Hello.
I just need to upload file like pdf, docx, pptx format to raw dataset through palantir rest api from external system.
I’m wondering which one I should use: upload file API or create file import API.
upload file API: Upload File • API Reference • Palantir
create file import API: Create File Import • API Reference • Palantir
Please let me know the answer.
Thanks regards.
I think upload file API is correct.
So, I tried to use upload file api with curl command.
curl -X POST
-H “Content-type: application/octet-stream”
-H “Authorization: Bearer $TOKEN”
“https://$HOSTNAME/api/v2/datasets/ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da/files/2020/09/30/trades.csv/upload?branchName=master&transactionType=APPEND&transactionRid=ri.foundry.main.transaction.0a0207cb-26b7-415b-bc80-66a3aa3933f4”
-d ‘@/path/to/file’
And response was likes as below.
{“path”:“a.pdf”,“transactionRid”:“ri.foundry.main.transaction.00000046-ec75-3530-a037-0af985a094a4”,“sizeBytes”:“9”,“updatedTime”:“2025-03-21T07:38:47.185Z”}
As a result, a.pdf file size is 1.7MB, but only 9 bytes are uploaded and can’t preview pdf file in dataset.
What should I check for this problem?
Any answers would be very appreciated.
curl -X POST -H “Content-type: application/octet-stream” -H “Authorization: Bearer xxxxxxxx” “https://xxxxxxxxx/api/v2/datasets/ri.foundry.main.dataset.79260673-8f30-45ae-aa96-4f7f7abfb946/files/a.pdf/upload?transactionType=APPEND” --data-binary @D:/awork/test/a.pdf