You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to posting payload with long OData query parameters (>1024 chars) #2887
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
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?
But that would indeed route to a Get action in your controller. In your case you want to include both the long query and request payload to the body. I don't understand the part where you say it converts the request into a GET and losing payload. Could you share a repro?
Do you know exactly how long the query params were? I think we should support way more than 1024 characters.
One workaround I can think of is to use batch operations, using a JSON path or multipart-form syntax. While that's usually meant sending multiple OData requests in a single HTTP request, you do include both the request endpoints (include query params) and payload in the overall HTTP body. If you control the requests that the clients make, it could be a workaround.
Activity
habbes commentedon Nov 11, 2025
Hello @ernesto-manoni I was going to share that you can use the
POST /$queryendpoint and move the query to the request body as documented here: https://learn.microsoft.com/en-us/odata/webapi/query-options-in-request-bodyBut that would indeed route to a Get action in your controller. In your case you want to include both the long query and request payload to the body. I don't understand the part where you say it converts the request into a GET and losing payload. Could you share a repro?
Do you know exactly how long the query params were? I think we should support way more than 1024 characters.
One workaround I can think of is to use batch operations, using a JSON path or multipart-form syntax. While that's usually meant sending multiple OData requests in a single HTTP request, you do include both the request endpoints (include query params) and payload in the overall HTTP body. If you control the requests that the clients make, it could be a workaround.