{
"response": [
{
"productId": "TP_PD_000011",
"productName": "Toppr Get 10% Off on all Packages",
"point": 100,
"imageURL": "https://image.timespoints.iimg.in/product/images/toppr.card.jpg",
"categories": [
"Learning###Education"
],
"stock": true,
"partnerId": 397,
"category": null,
"clientId": null,
"termsConditions": "<ul><li><span style=\"color: rgb(0, 0, 0);\">Get flat 10% off on all Toppr Packages.</span></li><li><span style=\"color: rgb(0, 0, 0);\">To avail the offer : </span><a href=\"https://short.klippd.in/ahik\" rel=\"noopener noreferrer\" target=\"_blank\">Click Here! </a></li><li><span style=\"color: rgb(0, 0, 0);\">Offer valid for all users. </span></li><li><span style=\"color: rgb(0, 0, 0);\">Offer valid on all products. </span></li><li><span style=\"color: rgb(0, 0, 0);\">Offer is valid till </span>31st March'22</li><li><span style=\"color: rgb(0, 0, 0);\">Offer is valid once per user.</span></li><li><span style=\"color: rgb(0, 0, 0);\">Valid on Credit card/ Debit card/ Net banking. </span></li><li>Merchant/TimesPoints reserves the right to withdraw, modify, cancel, change the offer at any point of time without prior notice and at their sole discretion.</li><li>In case of any issues with the usage of code please reach us at feedback at timespoints dot com.</li></ul>",
"productDescription": "<p><a href=\"https://short.klippd.in/ahik\" rel=\"noopener noreferrer\" target=\"_blank\">Toppr</a> is India's leading after-school learning app with over 12 million students learning on the platform. On a mission to make learning personalised, Toppr caters to the individual learning styles of candidates and provides the widest K12 syllabus.</p><p><br></p><p>Toppr covers 22 boards like CBSE, ICSE, major state boards; 17 Subjects like Maths, Science, Social Science and 60+ competitive exams like JEE, NEET, BITSAT and more.</p>",
"orderSequence": 59,
"linkBasedOffer": false,
"exclusive": false,
"productApplicability": "ONLINE",
"partnerName": "Toppr",
"expiryDate": "31-03-2022",
"active": false
}
],
"message": "Success",
"comments": "",
"status": "SUCCESS",
"responseCode": "TP_100"
}
i am triyng to call external api using rest template and above is the api response if i able to get this response as object or string then how can i get any one value like
productId=
productName=
my controller class looks like this
@GetMapping("/callingAPI")
public Object getForEntity() {
String url = "base url";
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<Response> response = restTemplate.getForEntity(url, Response.class);
System.out.println(response);
String.valueOf(ResponseEntity.status(response.getStatusCode()).headers(response.getHeaders()));
System.out.println(response.getStatusCode());
Response Json = response.getBody();
System.out.println(Json);
System.out.println("ProductId"+ "=" + Json.getProductId());
System.out.println("point"+ "=" + Json.getPoint());
System.out.println("ClientId"+ "=" + Json.getClientId());
System.out.println("ImageURL"+ "=" + Json.getImageURL());
return Json;
}
i have created response model class with all getter and setters and also table created in my db
@Column(name="productId")
private String productId;
@Column(name="productName")
private String productName;
@Column(name="point")
private Integer point;
@Column(name="imageURL")
private String imageURL;
@ElementCollection
@Column(name="categories")
private List<String> categories = new ArrayList<String>();
@Column(name="stock")
private Boolean stock;
@Column(name="partnerId")
private Integer partnerId;
@Column(name="category")
private String category;
@Column(name="clientId")
private String clientId;
@Column(name="termsConditions")
private String termsConditions;
@Column(name="productDescription")
private String productDescription;
@Column(name="orderSequence")
private Integer orderSequence;
@Column(name="linkBasedOffer")
private Boolean linkBasedOffer;
@Column(name="exclusive")
private Boolean exclusive;
@Column(name="productApplicability")
private String productApplicability;
@Column(name="partnerName")
private String partnerName;
@Column(name="expiryDate")
private String expiryDate;
@Column(name="active")
private Boolean active;
**i am getting result as below and in console also as null for println statement **
{
"productId": null,
"productName": null,
"point": null,
"imageURL": null,
"categories": [],
"stock": null,
"partnerId": null,
"category": null,
"clientId": null,
"termsConditions": null,
"productDescription": null,
"orderSequence": null,
"linkBasedOffer": null,
"exclusive": null,
"productApplicability": null,
"partnerName": null,
"expiryDate": null,
"active": null
}