|
@@ -0,0 +1,37 @@
|
|
1
|
+package kr.co.swh.lecture.opensource.project.colona;
|
|
2
|
+
|
|
3
|
+import java.io.IOException;
|
|
4
|
+import java.util.List;
|
|
5
|
+
|
|
6
|
+import org.apache.http.HttpResponse;
|
|
7
|
+import org.apache.http.client.HttpClient;
|
|
8
|
+import org.apache.http.client.methods.HttpGet;
|
|
9
|
+import org.apache.http.impl.client.HttpClients;
|
|
10
|
+import org.apache.http.util.EntityUtils;
|
|
11
|
+
|
|
12
|
+import com.google.gson.Gson;
|
|
13
|
+
|
|
14
|
+public class ColonaCall {
|
|
15
|
+ public static void main(String[] args) {
|
|
16
|
+ HttpClient client = HttpClients.createDefault();
|
|
17
|
+ HttpGet request = new HttpGet("https://8oi9s0nnth.apigw.ntruss.com/corona19-masks/v1/sales/json?page=1&perPage=500");
|
|
18
|
+ try {
|
|
19
|
+ // 필요에 따라서는 헤더 추가
|
|
20
|
+// request.addHeader("Content-type", "application/json");
|
|
21
|
+
|
|
22
|
+ // 요청
|
|
23
|
+ HttpResponse response = client.execute(request);
|
|
24
|
+
|
|
25
|
+ // 응답
|
|
26
|
+ String result = EntityUtils.toString(response.getEntity());
|
|
27
|
+ Gson gson = new Gson();
|
|
28
|
+ ResponseStore stores = gson.fromJson(result, ResponseStore.class);
|
|
29
|
+
|
|
30
|
+ List<Store> k = stores.getStoreInfos();
|
|
31
|
+ System.out.println(result);
|
|
32
|
+ } catch (IOException e2) {
|
|
33
|
+ // TODO Auto-generated catch block
|
|
34
|
+ e2.printStackTrace();
|
|
35
|
+ }
|
|
36
|
+ }
|
|
37
|
+}
|