I am trying to transform a curl command for uploading new DNS zone files in NSONE to Powershell using Invoke-RestMethod.
NSONE has posted this sample curl command:
curl -X PUT -F zonefile=@example.com.db -H 'X-NSONE-Key: qACMD09OJXBxT7XOuRs8' https://api.nsone.net/v1/import/zonefile/example.com
which I partially cloned to its Powershell version as
Invoke-RestMethod -Uri https://api.nsone.net/v1/import/zonefile/example.com -Header @{"X-NSONE-Key" = "qACMD09OJXBxT7XOuRs8"} -Method Put -InFile "c:\example.com.db" -ContentType "multipart/form-data"
Obviously, I am doing something wrong here because I am getting this error:
"Invoke-RestMethod : {"message":"Upload a single zone file using multipart/form-data and input name \"zonefile\""}
CategoryInfo: InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
FullyQualifiedErrorId: WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
"
Any suggestion would be very much appreciated.