Polling
리포트를 Polling방식으로 수신합니다.
Polling 방식이란? 클라이언트(사용자)에서 서버(OMNI API)로 주기적으로 요청하여 변경사항을 확인하는 방식입니다.
1회 호출 시 최대 1,000개의 리포트를 가져올 수 있습니다.
전달되지 않고 3일이 지난 리포트는 삭제 됩니다.
전달할 리포트가 없는 경우 reportId와 report는 빈값("", null)으로 전달 됩니다.
리포트 가져오기
curl -X GET https://omni.ibapi.kr/v1/report/polling \
-H "content-type: application/json" \
-H "Accept: application/json" \
-H "Authorization:Bearer 발급받은 토큰"
import java.io.*;
import okhttp3.*;
public class Main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://omni.ibapi.kr/v1/report/polling")
.method("GET", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer 발급받은 토큰")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://omni.ibapi.kr/v1/report/polling"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer 발급받은 토큰")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://omni.ibapi.kr/v1/report/polling',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer 발급받은 토큰'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://omni.ibapi.kr/v1/report/polling',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://omni.ibapi.kr/v1/report/polling");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer 발급받은 토큰");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer 발급받은 토큰");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://omni.ibapi.kr/v1/report/polling", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("omni.ibapi.kr")
payload = ''
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
}
conn.request("GET", "/v1/report/polling", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "json"
require "net/http"
url = URI("https://omni.ibapi.kr/v1/report/polling")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Bearer 발급받은 토큰"
response = https.request(request)
puts response.read_body
Request
Header
Name | Type | Description |
---|---|---|
Authorization | String | schema + “ “ + token |
Accept | String | application/json |
Response
Header
Name | Type | Description |
---|---|---|
Content-Type | String | application/json |
Body
Schema
data
Name | Type | Description |
---|---|---|
reportId | String | 리포트 ID |
report | Object Array | 리포트 정보 |
리포트 수신 확인
curl -X DELETE https://omni.ibapi.kr/v1/report/polling/리포트ID \
-H "content-type: application/json" \
-H "Accept: application/json" \
-H "Authorization:Bearer 발급받은 토큰"
import java.io.*;
import okhttp3.*;
public class Main {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://omni.ibapi.kr/v1/report/polling/reportId")
.method("DELETE", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer 발급받은 토큰")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://omni.ibapi.kr/v1/report/polling/reportId"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer 발급받은 토큰")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://omni.ibapi.kr/v1/report/polling/reportId',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Accept: application/json',
'Authorization: Bearer 발급받은 토큰'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://omni.ibapi.kr/v1/report/polling/reportId',
'headers': {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Delete, "https://omni.ibapi.kr/v1/report/polling/reportId");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer 발급받은 토큰");
var content = new StringContent(string.Empty);
content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer 발급받은 토큰");
var requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://omni.ibapi.kr/v1/report/polling/reportId", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
import http.client
import json
conn = http.client.HTTPSConnection("omni.ibapi.kr")
payload = ''
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer 발급받은 토큰'
}
conn.request("DELETE", "/v1/report/polling/reportId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
require "uri"
require "json"
require "net/http"
url = URI("https://omni.ibapi.kr/v1/report/polling/reportId")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Content-Type"] = "application/json"
request["Accept"] = "application/json"
request["Authorization"] = "Bearer 발급받은 토큰"
response = https.request(request)
puts response.read_body
Request
Header
Name | Type | Description |
---|---|---|
Authorization | String | schema + “ “ + token |
Accept | String | application/json |
Path Parameter
Name | Type | Required | Description |
---|---|---|---|
reportId | String | YES | 리포트 ID |
Response
Header
Name | Type | Description |
---|---|---|
Content-Type | String | application/json |
Body
Name | Type | Description |
---|---|---|
String(4) | API호출 결과 코드 | |
result | String | API호출 결과 설명 |
Last updated