Put Media Item API Question

I create a mediaset in a folder and I want to upload pdf file into that mediaset.

API Document : Put Media Item • API Reference • Palantir

First of all, I received a token from /multipass/api/oauth2/token api.

I tried to upload pdf file with below curl command. But I received an error message.

Curl Command

curl --location ‘https://[hostname]/api/v2/mediasets/[mediasetrid]/items?mediaItemPath=a.pdf&preview=true’
–header ‘Content-Type: application/octet-stream’
–header ‘Authorization: Bearer oAuthToken’
–data-binary ‘@/D:/awork/test/a.pdf’

Error Response I’ve received.

{
“errorCode”: “INTERNAL”,
“errorName”: “Default:Internal”,
“errorInstanceId”: “2880aee0-e55e-4858-bad5-de7d72268774”,
“parameters”: {}
}

Just to be sure: the token you’ve received grants the right to write to the mediaset in question, right?

Try this cURL command in PowerShell (not cmd.exe) and see if it works:

curl -X POST \
	-H "Content-type: application/octet-stream" \
	-H "Authorization: Bearer InsertTokenHere" \
	"https://HOSTNAME/api/v2/mediasets/{mediaSetRid}/items?mediaItemPath=a.pdf&preview=true" \
	-d "@/D:/awork/test/a.pdf"

yes. Token received from oauth is for Third Party Application (Service User: A) and I assigned
owner role to A in mediaset file.

I think your curl command is same as mine.

Did you run it in cmd.exe or PowerShell?

This is crucial, as they interpret quotation marks very differently, which can lead to errors like the one you are experiencing.

Thanks for the reply.

Actually I posted a request with postman. So quotation mark is not the problem.

I copied the curl command from postman.

Does the api call succeed in your environment?