I want to implement a basic example using OkHttpClient. In my case I want to make Rest requests to https://data.brreg.no/rofs/od/rofs/stottetildeling/search?language=nob&mottakerOrgnr=987&fraDato=2016-11-20
In order to get public data. More information:
https://data.brreg.no/enhetsregisteret/api/docs/index.html#_oversikt https://www.brreg.no/produkter-og-tjenester/apne-data/register-offentlig-stotte/api
I implemented this code:
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://data.brreg.no/rofs/od/rofs/stottetildeling/search?language=eng")
.get()
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
But I get this result:
IGVsbGVyIGF2Z2lmdHNmb3JkZWwiLCJzdG90dGVpbnN0cnVtZW50RnJpdGVrc3QiOm51bGwsInN0b3R0ZW1vdHRha2VyU3RvcnJlbHNlIjoiTGl0ZW4gb2cgTWVsbG9tc3RvciIsIm5hZXJpbmciOiI0MS4yIiwibmFlcmluZ0Jlc2tyaXZlbHNlIjoiT3BwZsO4cmluZyBhdiBieWduaW5nZXIiLCJmeWxrZXNudW1tZXIiOjE4LCJmeWxrZSI6Ik5vcmRsYW5kIiwic3RvdHRlZ2l2ZXJPcmdhbmlzYXNqb25zbnVtbWVyIjoiOTc0NzYxMDc2Iiwic3RvdHRlZ2l2ZXJOYXZuIjoiU0tBVFRFRVRBVEVOIiwic3RvdHRlZ2l2ZXJzUmVmZXJhbnNlIjpudWxsLCJ1bG92bGlnU3RvdHRlIjpudWxsfSx7InRpbGRlbGluZ0lkIjoi............
Looks like I have to configure the encoding properly in order to read the data. what is the proper way to implement this?