I am using the graph api: to get the particular user’s profile photo with my access token. In postman I am able to see the image using the above get call. In my spring-boot application I am using like below: I am getting below error: I have defined RestTemplate like: Could someone please help me with th…
Tag: resttemplate
Spring RestTemplate: how to send the payload body as compact form so without rn
I am dealing with an API that don’t accept multi line json body and accept only 1 json line body (json compact form) The below payload is valid because it’s compact in just 1 line And the below payload is not passing because it’s multiline I have the same problem in the Java/Spring code wher…
Why handleResponse(URI url, HttpMethod method, ClientHttpResponse response) method of RestTemplate.class is getting called for a 200 Succeess response
I am calling an external API from my code using RestTemplate like below: This API call is returning 200 Success but when I debug it, it still goes to handleResponse(URI url, HttpMethod method, ClientHttpResponse response) method of RestTemplate.class And then it’s coming to my RestTemplateErrorHandler.j…
Java Exception: Unauthorized: 401
I’m getting the error: Exception: org.springframework.web.client.HttpClientErrorException$Unauthorized: 401, when trying to connect to Jira through HttpHeader, and the credentials are configured in a configserver file, which would be this: And the method where I command to call the file above and where …
RestTemplate get list from specific json structure
The json is of this structure: I have a DTO of the form I want to parse the array into List and ignore data. This is the code: But I get this exception Answer I would suggest you changing your model as follows: And your test also:
Spring boot server receiving param with %20 instead of space
I have spring boot server with controller and one endpoint: And another spring boot application which is sending request with restTemplate.getForEntity info log with url prints this: Reference data URL http://some-name:8080/readProperty?channel=E&service_name=Some%20Value Problem is that when I call this …
AWS Appsync Graphql Java Client – IAM authorisation
This is the schema for which I have implement business logic I use RestTemplate as my Java client to consume graphql endpoint giving API key as authorization. I ad dthe api key in the header paart as x-api-key. The above implementation retrieves the values from the backend. But according the schema which is d…
Deserialising JSON array using RestTemplate
I’m trying to convert JSON data to a java class using Rest Template. The JSON data has this format and cannot be changed: The java class to save the data is: To receive the JSON data and deserialize i’m doing: But i’m getting this exception: I’ve done this before and it worked, but the…
Spring boot app stops with UnknownContentTypeException when trying to return JSON response from endpoint
I am trying to make a Spring boot app that uses the API endpoints of SWAPI and refine the results to some of them. To explain better I want to take the name of a character the user provided from a GET request and return to him the Starships this character has piloted. I am trying to use RestTemplate to