Should the PATCH method return all fields of the resource in the response body?

Normally this should be handled through content negotiation. In other words, the client asks for a specific representation if it needs one. The request would look like this: PATCH /user/123 Content-Type: application/merge-patch+json Accept: application/vnd.company.user+json … In this case, the client expresses that it wants a full user representation as answer. Or it could do: PATCH … Read more

Python Requests – Dynamically Pass HTTP Verb

Just use the requests.request() method. First argument is the HTTP verb that you want to use. requests.get(), requests.post(), etc. are just aliases to request(‘GET’), request(‘POST’): see the doc Your code becomes: verb = ‘POST’ response = requests.request( verb, headers=self.auth, url=self.API + ‘/zones/’ + str(zID) + ‘/dns_records’, data={“type”:record[0], “name”:record[1], “content”:record[2]} )

How to specify DELETE method in a link or form?

Was trying to figure this out for a rails app that was using Angular on the front end; these seems to work for that environment: <a data-confirm=”Are you sure?” data-method=”delete” href=”https://stackoverflow.com/link-to-resource” rel=”nofollow”>Delete</a> Edit: Just to give everyone a heads up, I think you still need to have jQuery for this to work. I removed jQuery … Read more

Combine GET and POST request methods in Spring

@RequestMapping(value = “/testonly”, method = { RequestMethod.GET, RequestMethod.POST }) public ModelAndView listBooksPOST(@ModelAttribute(“booksFilter”) BooksFilter filter, @RequestParam(required = false) String parameter1, @RequestParam(required = false) String parameter2, BindingResult result, HttpServletRequest request) throws ParseException { LONG CODE and SAME LONG CODE with a minor difference } if @RequestParam(required = true) then you must pass parameter1,parameter2 Use BindingResult and request … Read more

What is the main difference between PATCH and PUT request?

HTTP verbs are probably one of the most cryptic things about the HTTP protocol. They exist, and there are many of them, but why do they exist? Rails seems to want to support many verbs and add some verbs that aren’t supported by web browsers natively. Here’s an exhaustive list of http verbs: http://annevankesteren.nl/2007/10/http-methods There … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)