RestClientException: Could not extract response. no suitable HttpMessageConverter found

The main problem here is content type [text/html;charset=iso-8859-1] received from the service, however the real content type should be application/json;charset=iso-8859-1 In order to overcome this you can introduce custom message converter. and register it for all kind of responses (i.e. ignore the response content type header). Just like this

PHP cURL HTTP PUT

I am trying to create a HTTP PUT request with cURL and I can’t make it work. I’ve read many tutorials but none of them actually worked. Here’s my current code: I’ve also tried using PHP PEAR but got the same result. The problem is that the repository says that no metadata has been set. … Read more

What’s the difference between “Request Payload” vs “Form Data” as seen in Chrome dev tools Network tab

The Request Payload – or to be more precise: payload body of a HTTP Request is the data normally send by a POST or PUT Request. It’s the part after the headers and the CRLF of a HTTP Request. A request with Content-Type: application/json may look like this: If you submit this per AJAX the browser simply shows you what it is … Read more

JaxbRepresentation gives error “doesnt contain ObjectFactory.class or jaxb.index”

In my case I was able to resolve this by adding a file called “jaxb.index” in the same package folder as the JAXB annotated class. In that file list the simple, non-qualified names of the annotated classes. For example, my file /MyProject/src/main/java/com/example/services/types/jaxb.index is simply one line (since I have only one JAXB typed class): which … Read more

MultipartException: Current request is not a multipart request

When you are using Postman for multipart request then don’t specify a custom Content-Type in Header. So your Header tab in Postman should be empty. Postman will determine form-data boundary. In Body tab of Postman you should select form-data and select file type. You can find related discussion at https://github.com/postmanlabs/postman-app-support/issues/576

AttributeError: ‘str’ object has no attribute ‘items’

You are passing in a string; headers can’t ever be a JSON encoded string, it is always a Python dictionary. The print results are deceptive; JSON encoded objects look a lot like Python dictionary representations but they are far from the same thing. The requests API clearly states that headers must be a dictionary: headers – (optional) Dictionary of HTTP Headers to send with the Request. JSON data is something you’d … Read more

How to call a REST web service API from JavaScript?

I’m surprised nobody has mentioned the new Fetch API, supported by all browsers except IE11 at the time of writing. It simplifies the XMLHttpRequest syntax you see in many of the other examples. The API includes a lot more, but start with the fetch() method. It takes two arguments: A URL or an object representing the request. Optional … Read more