Skip to content

How to posting payload with long OData query parameters (>1024 chars) #2887

@ernesto-manoni

Description

@ernesto-manoni

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions