I have a turtle file that I wish to send from S3 server to the Neptune instance on powershell. Below is the command I am using
Invoke-RestMethod -Uri http://edwardspoc.civwhymjvz19.us-east-1.neptune.amazonaws.com:8182 -ContentType application/json -body '
{
"source" : "s3://cedwardsneptune/ATC.ttl",
"format" : "turtle",
"iamRoleArn" : "arn:aws:s3:::cedwardsneptune",
"region" : "us-east-1",
"failOnError" : "FALSE",
"parserConfiguration" : {
"namedGraphUri" : "http://purl.bioontology.org/ontology/ATC"
}
}'
This is giving me the following error
Invoke-RestMethod : Cannot send a content-body with this verb-type.
I made subtle changes but nothing seems to be working. Any help is appreciated !
Error you having says that you are trying to send a BODY when your REQUEST VERB does not allow it.
Basically you are doing GET and trying to send a body. When GET verb is not allowed to send a body part. Probably you need to use POST method (check specific webservice documentation)
For that I recommend you next format:
$Cred = Get-Credential (If you could have)
$Url = "http://edwardspoc.civwhymjvz19.us-east-1.neptune.amazonaws.com:8182"
$Body = '{
"source" : "s3://cedwardsneptune/ATC.ttl",
"format" : "turtle",
"iamRoleArn" : "arn:aws:s3:::cedwardsneptune",
"region" : "us-east-1",
"failOnError" : "FALSE",
"parserConfiguration" : {
"namedGraphUri" : "http://purl.bioontology.org/ontology/ATC"
}
}'
Invoke-RestMethod -Method 'Post' -Uri $url -Credential $Cred -ContentType $contentType -Body $body -ContentType 'application/json' -OutFile output.csv
(*)Of course -OutFile is optional
And about JSON There is a cmdlet called ConvertFrom-JSON you can use commonly when you need to parse an output(that is a JSON).
p.e:
Invoke-RestMethod -Method 'Post' -Uri $url -Credential $Cred -Body $body |
ConvertFrom-JSON | Select field1, field2, field3
If you expect an output (json) having field1, field2, field3 as fields