Repository navigation
Replies: 2 comments
|
I just found feat: HTTP QUERY method support in the core repo. I will upgrade to 4.4 to see if that gets me where I need to go. I'm still open to best practices and other advice if there is any. |
|
For the POST route, you don't need to subclass Use The official DTO and state processor patterns cover these pieces. A processor can return the search result rather than the input object. The main caveat is collection behavior: a custom POST doesn't automatically inherit Your linked HTTP QUERY work may provide a cleaner collection-shaped operation on 4.4, but for clients that must keep POST, the DTO/processor approach avoids depending on that upgrade. |
Uh oh!
There was an error while loading. Please reload this page.
Our API has the requirement to allow searching for "things" using specific identifiers, which may exceed the max length of the GET query string. Our current implementation uses HTTP POST and sends a JSON data structure with the varying criteria.
From my research so far, I am getting the impression I will need to create a custom HttpOperation to achieve my goal. I wanted to extend the GetCollection and change its method to POST, but that class is final and cannot be extended.
Before I dive too deeply into this rabbit hole, I was looking to get feedback from the community in case this has already been solved, or what the best direction would be to solve this problem myself.
Info:
application/jsonorapplication/ld+json(json preferred)Examples:
curl -X POST https://api.local/users --json '{"username": ["bobby", "jb1234", "billyjoearmstrong", ...]}'curl -X POST https://api.local/users --json '{"uniqueId": [123, 456, 789, ...]}'curl -X POST https://api.local/users --json '{"somethingElse": ["other", "unique", "criteria", ...]}'Requirements:
Thank you in advance!
All reactions