I am trying to upload a local csv file to the import endpoint of 4me/xurrent using power shell. My latest version looks as follows and still receives an error.
$importUrl = "https://api.xurrent.qa/v1/import"
# Create the headers for the import request
$ImportHeaders = @{
Authorization = "Bearer $bearerToken"
"X-4me-Account" = "XXX"
"Content-Type" = "multipart/form-data"
}
# Create the body for the import request
$importBody = @{
file = $ImportFile
type = "cis"
}
#QA Import to Xurrent with PROXY
$importResponse = Invoke-RestMethod -Method Post -Uri $importUrl -Headers $ImportHeaders -inFile $importBody
This get’s the following error:
Invoke-RestMethod : Der Pfad "C:UsersXXXSystem.Collections.Hashtable" kann nicht gefunden werden, da er nicht vorhanden ist.
In \tst_mgmt4me_Import_ShareScriptsQA - Import CI.ps1:65 Zeichen:19
+ ... tResponse = Invoke-RestMethod -Method Post -Uri $importUrl -Headers $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:UsersXXX...tions.Hashtable:String) [Invoke-RestMethod], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
ImportBody looks like this:
Name Value
---- -----
file C:UsersXXXDownloadsXXX.csv
type cis
Beorn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
3