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
-
REST Paths
The current approach for a REST URL is like this:
get
http://localhost:5000/api/bookpost
http://localhost:5000/api/bookput
http://localhost:5000/api/book/id1/123/id2/234patch
http://localhost:5000/api/book/id1/123/id2/234delete
http://localhost:5000/api/book/id1/123/id2/234Notice how the
put
,patch
, anddelete
URLs include the keys in the url.The Model
In the
get
operation, 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/book
if 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
, anddelete
Then end. This makes things so much simpler for consumers by about 100.
Beta Was this translation helpful? Give feedback.
All reactions