DRAG DROP - Drag and drop the REST API call methods for HTTP from the left onto the actions they perform on the right. Not all methods are used. Select and Place:
POST
GET
DELETE
PATCH
Wouldn't "patch" be the "safer" option, since you are just updating one thing in a database
and not the complete database? Put could wipe the entries you are not modifying?
https://rapidapi.com/blog/put-vs-patch/
Feel free to correct me if i got it wrong.
PUT is commonly used for completely replacing an entry, while PATCH is often used for making partial updates to an existing entry in a database.
I guess PUT will be more suitable here.
But it says "updating" an entry. PUT is generally used to update the field in a given model, which will almost always be identified by a primary key. So you'll send a PATCH request to a URL something like /api/employees/29384, in order to update something like their name. A PUT request on the other hand will send *all* data attributes associated with that employee, but it will still be linked to the same primary key.
The issue is, *neither* will actually replace an entry. They'll *both* update it, and so both are completely valid here. To put it simply:
PATCH -> Update a single attribute in a model; usually a single column in a database.
PUT -> Update all attributes in a model; will still likely only update the ones that changed, depending on the ORM you use.
I'd lean toward PATCH since it's more semantically appropriate for "updating" as opposed to "replacing" a resource.
Source: Developer who has worked extensively with databases and REST frameworks.
https://community.cisco.com/t5/networking-knowledge-base/cisco-dna-center-platform-api/ta-p/4105156
https://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/restapi/restapi/RESTAPIintro.html#97727
IOS XE Rest API & Cisco DNA center only use "PUT" and don't use "PATCH" (or so it seems)
I had to look it up for a previous similar question but in relation to Cisco DNA center only.
This question only mentions Rest API call methods for HTTP period, not in the use context of Cisco DNA.
PUT
The single-resource equivalent of POST is PUT, which updates a resource by replacing its content entirely. As a RESTful API HTTP method, PUT is the most common way to update resource information.
It's possible to create a resource with a PUT method, but this approach carries the risk of creating resources by accident, as noted above. If PUT is applied to a collection of resources, the entire resource collection gets replaced, which usually isn't the intention.
PATCH
PATCH is another HTTP method used to update resources. As opposed to replacing resources, like the PUT method does, PATCH only modifies resource contents. As a general rule, these modifications should be expressed in a standard format like JSON or XML.
Much like in PUT, it's poor practice to specifically apply PATCH methods to a whole resource collection -- that is, unless you truly intend to update every resource it contains.
In REST APIs, "PUT" and "PATCH" are both HTTP methods used to update resources, but they differ in their semantics:
1. **PUT**: This method is used to completely replace a resource or create it if it doesn't exist. When you make a PUT request to a resource endpoint, you send the complete representation of the resource you want to update. If the resource already exists, it will be completely replaced with the new representation provided in the request. If the resource doesn't exist, it will be created.
2. **PATCH**: PATCH, on the other hand, is used to partially update a resource. With PATCH, you send only the changes that need to be applied to the resource, rather than the entire representation. This allows for more efficient updates, especially when dealing with large resources where sending the entire representation would be impractical.
In summary, PUT is used for full updates or creation of resources, while PATCH is used for partial updates.
I will choose 'PUT'.
Both `PUT` and `PATCH` methods can be used to update an entry in the database using a REST API, but they are used in slightly different scenarios:
- `PUT` is used when you want to **replace** an entire resource. For example, if you have a user object with fields like `name`, `email`, and `password`, and you want to update all these fields, you would use the `PUT` method.
- `PATCH`, on the other hand, is used when you want to **update** only certain fields of a resource. For example, if you only want to update the `email` field of the user object mentioned above, you would use the `PATCH` method.
So, if you're updating an entire entry, you'd typically use `PUT`. If you're updating only certain fields of an entry, you'd use `PATCH`.
upvoted 5 times
...
This section is not available anymore. Please use the main Exam Page.200-301 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
splashy
Highly Voted 2 years, 2 months agoHM01
1 year, 5 months ago[Removed]
11 months, 2 weeks agosplashy
2 years, 1 month agoRODCCN
1 year, 3 months agoMikD4016
Highly Voted 2 years, 1 month ago[Removed]
Most Recent 7 months, 3 weeks agoStarlord2535
9 months agoNewJeans
1 year, 1 month ago