Context
I'm working on an OData endpoint that should accept both:
an OData filter query (e.g. $filter=...)
a JSON payload in the request body (to post additional data).
example
POST /api/Documents?$filter=Matricola_x0020sampleslongquery
Payload
{
"document": {
"id": 123,
"title": "Document"
}
}
Controller EndPoint
public IQueryable Post(ODataQueryOptions queryOptions, Document document)
{
// [do something]
return somethingDocumentDto;
}
When the $filter or other query params becomes too long (more than 1024 characters), the request fails due to URL length limits.
To bypass this, I tried to move the OData query into the body and manually parse it using IODataQueryOptionsParser, but request is converted into a GET losing payload.
Is there a way to posting both a large query filter and and a payload in a single POST request?
Thanks