Unable to create embed code for resource of workdrive using API

Unable to create embed code for resource of workdrive using API

Hello Team,

I am trying to create embed code for a resource using workdrive api in powershell, however facing some issues with injecting data in body.


Please help, below is the code:

$ResourceID2= "1lmz0e40d0c92044629a7cd6e89fa54e"

# Define the headers for the POST request
$headers2 = @{
    Authorization = "Zoho-oauthtoken $accesstoken"
Accept        = "application/vnd.api+json"
}

$body2 = @{
    resource_id = $ResourceID2
    shared_type = "publish"
    role_id = "34"
}

$link = Invoke-RestMethod -Method Post -Uri $url2 -Headers $headers2 -Body $body2


==================================================================

Invoke-RestMethod : {"errors":[{"id":"F000","title":"JSON_PARSE_ERROR"}]}
At line:16 char:9
+ $link = Invoke-RestMethod -Method Post -Uri $url2 -Headers $headers2  ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand