Proposal: Simpler URLs #1471
Closed
JerryNixon
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
|
{
"error": {
"code": "BadRequest",
"message": "Primary key for POST requests can't be specified in the request URL. Use request body instead.",
"status": 400
}
}Can look into for PUT and PATCH, though there is an interesting SO discussion regards to DELETE and HTTP specification comments: https://stackoverflow.com/a/299696 (e.g. 'content received in a DELETE request has no generally defined semantics') https://www.rfc-editor.org/rfc/rfc9110.html#name-delete |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
REST Paths
The current approach for a REST URL is like this:
gethttp://localhost:5000/api/bookposthttp://localhost:5000/api/bookputhttp://localhost:5000/api/book/id1/123/id2/234patchhttp://localhost:5000/api/book/id1/123/id2/234deletehttp://localhost:5000/api/book/id1/123/id2/234Notice how the
put,patch, anddeleteURLs include the keys in the url.The Model
In the
getoperation, this typical model will be returned to the consumer.Note that the key fields are in the model payload.
The Config
Let me bring our attention to the config settings:
That's right, we already know which properties are key properties.
Behavior change
http://localhost:5000/api/bookif these conditions are met:a. The config file includes key fields in the entity setup.
b. The inbound payload includes the key properties.
c. Only for operations:
put,patch, anddeleteThen end. This makes things so much simpler for consumers by about 100.
Beta Was this translation helpful? Give feedback.
All reactions