Getting MediaTypeFormatter error when trying to Query File System

I am sending a POST to this URI:


http://myserver.mycompany.com:8000/API/file/?sessionId=(session guid)


Request body:

{
"queryFileSystemEntriesOptions": {
"entryIds": [ "6F42F069-DCAE-4E1C-9520-1828540791A8" ],
"pageNumber": 1,
"pageSize": 150
},
"queryOptions": "RecursiveQuery",
"filter": [
{
"field": "ObjectType",
"operator": "Equals",
"value": "Dashboard",
"options": "None"
}
]
}

Response:


{
"Message": "An error has occurred.",
"ExceptionMessage": "No MediaTypeFormatter is available to read an object of type 'BatchDeleteOptions' from content with media type 'text/plain'.",
"ExceptionType": "System.InvalidOperationException",
"StackTrace": " at System.Net.Http.HttpContentExtensions.ReadAsAsync[T](HttpContent content, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ReadContentAsync(HttpRequestMessage request, Type type, IEnumerable`1 formatters, IFormatterLogger formatterLogger)\r\n at System.Web.Http.ModelBinding.FormatterParameterBinding.ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)\r\n at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()\r\n at System.Threading.Tasks.TaskHelpers.IterateImpl(IEnumerator`1 enumerator, CancellationToken cancellationToken)",
"4052bf36-e432-4131-9d42-cc2c96bdf040": "5.0.0.1000"
}



It seems there are two issues here. First, the MIME type is incorrect. The stack trace indicates it's set to text/plain and it needs to be application/json.

Second, if your goal is to query you need to POST to /file/query. A POST to straight /file/ is interpreted as a delete, not a query.

Hope this helps.

Outstanding! I'm out of the ditch and rolling again, thanks.