I'm using a Powershell script to interact with the Document Management API. The Create is working fine, but when I try to upload the pdf to the newly created documentId, I get a (415) Unsupported Media Type error. I've tried several iterations of the code below. If there is a better way to do this then the create, get documentId, then upload, I'm open to that too. This code is after the create has successfully processed. What am I doing wrong? Thanks in advance for any help/advice.
# Construct the request body
$requestBody = @{
name = "TestFile"
parents = @(@{ id = $parentFolderId })
mimeType = "application/pdf"
description = "scan"
}
$uploadHeaders = @{}
$uploadHeaders.add("Content-Type","application/json")
$uploadHeaders.add("X-TR-API-APP-ID",$TR_api_key)
$uploadHeaders.Add("Authorization", "Basic " + $login.token)
try
{
$uploadUrl = "">api.thomsonreuters.com/.../" + $create.documentCreate.documentId + "/file"
$upload = Invoke-RestMethod -Uri $uploadUrl -Method Post -Headers $uploadHeaders -Body ($requestBody | ConvertTo-Json)
}