Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyClass {
- private long id;
- private String name;
- public MyClass() {}
- public MyClass (long id, String name) {
- this.id = id;
- this.name = name;
- }
- public long getId() {
- return this.id;
- }
- public String getName() {
- return this.name;
- }
- }
- public class MyResponseWrapper {
- private MyClass[] myClassArray;
- public MyResponseWrapper() {
- // this empty constructor is always being called
- }
- public MyResponseWrapper(MyClass[] myClassArray) {
- this.myClassArray = myClassArray;
- }
- public MyClass[] getMyClassArray() {
- return this.myClassArray;
- }
- }
- RestTemplate restTemplate = new RestTemplate();
- HttpHeaders headers = new HttpHeaders();
- headers.set("Accept", "application/json");
- HttpEntity<String> entity = new HttpEntity<>("parameters", headers);
- ResponseEntity<MyResponseWrapper> res = restTemplate.exchange(url, HttpMethod.GET, entity, MyResponseWrapper.class);
- {
- "authorities":[
- {
- "LocalAuthorityId":197,
- "LocalAuthorityIdCode":"760",
- "Name":"Aberdeen City",
- "FriendlyName":"aberdeen-city",
- "Url":"http://www.aberdeencity.gov.uk",
- "SchemeUrl":"",
- "Email":"commercial@aberdeencity.gov.uk",
- "RegionName":"Scotland",
- "FileName":"http://ratings.food.gov.uk/OpenDataFiles/FHRS760en-GB.xml",
- "FileNameWelsh":null,
- "EstablishmentCount":1847,
- "CreationDate":"2010-08-17T15:30:24.87",
- "LastPublishedDate":"2018-02-08T00:35:50.717",
- "SchemeType":2,
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities/197"
- }
- ]
- },
- {
- "LocalAuthorityId":198,
- "LocalAuthorityIdCode":"761",
- "Name":"Aberdeenshire",
- "FriendlyName":"aberdeenshire",
- "Url":"http://www.aberdeenshire.gov.uk/",
- "SchemeUrl":"",
- "Email":"environmental@aberdeenshire.gov.uk",
- "RegionName":"Scotland",
- "FileName":"http://ratings.food.gov.uk/OpenDataFiles/FHRS761en-GB.xml",
- "FileNameWelsh":null,
- "EstablishmentCount":2102,
- "CreationDate":"2010-08-17T15:30:24.87",
- "LastPublishedDate":"2018-02-24T00:34:15.547",
- "SchemeType":2,
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities/198"
- }
- ]
- },
- {
- "LocalAuthorityId":277,
- "LocalAuthorityIdCode":"323",
- "Name":"Adur",
- "FriendlyName":"adur",
- "Url":"http://www.adur-worthing.gov.uk",
- "SchemeUrl":"",
- "Email":"publichealth.regulation@adur-worthing.gov.uk",
- "RegionName":"South East",
- "FileName":"http://ratings.food.gov.uk/OpenDataFiles/FHRS323en-GB.xml",
- "FileNameWelsh":null,
- "EstablishmentCount":417,
- "CreationDate":"2010-08-17T15:30:24.87",
- "LastPublishedDate":"2018-02-28T00:36:33.987",
- "SchemeType":1,
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities/277"
- }
- ]
- },
- {
- "LocalAuthorityId":158,
- "LocalAuthorityIdCode":"055",
- "Name":"Allerdale",
- "FriendlyName":"allerdale",
- "Url":"http://www.allerdale.gov.uk",
- "SchemeUrl":"",
- "Email":"environmental.health@allerdale.gov.uk",
- "RegionName":"North West",
- "FileName":"http://ratings.food.gov.uk/OpenDataFiles/FHRS055en-GB.xml",
- "FileNameWelsh":null,
- "EstablishmentCount":1092,
- "CreationDate":"2010-08-17T15:30:24.87",
- "LastPublishedDate":"2018-02-28T00:33:58.31",
- "SchemeType":1,
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities/158"
- }
- ]
- },
- {
- "LocalAuthorityId":48,
- "LocalAuthorityIdCode":"062",
- "Name":"Amber Valley",
- "FriendlyName":"amber-valley",
- "Url":"http://www.ambervalley.gov.uk",
- "SchemeUrl":"",
- "Email":"envhealth@ambervalley.gov.uk",
- "RegionName":"East Midlands",
- "FileName":"http://ratings.food.gov.uk/OpenDataFiles/FHRS062en-GB.xml",
- "FileNameWelsh":null,
- "EstablishmentCount":972,
- "CreationDate":"2010-08-17T15:30:24.87",
- "LastPublishedDate":"2018-02-28T00:34:14.493",
- "SchemeType":1,
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities/48"
- }
- ]
- },
- {
- "LocalAuthorityId":334,
- "LocalAuthorityIdCode":"551",
- "Name":"Anglesey",
- "FriendlyName":"anglesey",
- "Url":"http://www.ynysmon.gov.uk",
- "SchemeUrl":"",
- "Email":"iechydyramgylchedd@ynysmon.gov.uk",
- "RegionName":"Wales",
- "FileName":"http://ratings.food.gov.uk/OpenDataFiles/FHRS551en-GB.xml",
- "FileNameWelsh":"http://ratings.food.gov.uk/OpenDataFiles/FHRS551cy-GB.xml",
- "EstablishmentCount":703,
- "CreationDate":"2010-08-17T15:30:24.87",
- "LastPublishedDate":"2018-02-28T00:34:28.853",
- "SchemeType":1,
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities/334"
- }
- ]
- }
- ],
- "meta":{
- "dataSource":"API",
- "extractDate":"2018-02-28T00:58:26.2673908+00:00",
- "itemCount":6,
- "returncode":"OK",
- "totalCount":6,
- "totalPages":1,
- "pageSize":6,
- "pageNumber":1
- },
- "links":[
- {
- "rel":"self",
- "href":"http://api.ratings.food.gov.uk/authorities"
- },
- {
- "rel":"first",
- "href":"http://api.ratings.food.gov.uk/authorities/1/6"
- },
- {
- "rel":"previous",
- "href":"http://api.ratings.food.gov.uk/authorities/1/6"
- },
- {
- "rel":"next",
- "href":"http://api.ratings.food.gov.uk/authorities/1/6"
- },
- {
- "rel":"last",
- "href":"http://api.ratings.food.gov.uk/authorities/1/6"
- }
- ]
- }
Add Comment
Please, Sign In to add comment