Polling
리포트를 Polling방식으로 수신합니다.
Last updated
리포트를 Polling방식으로 수신합니다.
Last updated
Polling 방식이란? 클라이언트(사용자)에서 서버(OMNI API)로 주기적으로 요청하여 변경사항을 확인하는 방식입니다.
로 발급 받은 reportId는 반드시 처리를 해야 다음 리포트를 수신 받을 수 있습니다.
1회 호출 시 최대 1,000개의 리포트를 가져올 수 있습니다.
전달되지 않고 3일이 지난 리포트는 삭제 됩니다.
전달할 리포트가 없는 경우 reportId와 report는 빈값("", null)으로 전달 됩니다.
GET
/v1/report/polling
Header
Authorization
String
schema + “ “ + token
Accept
String
application/json
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
Header
Content-Type
String
application/json
Body
String(4)
API 호출 결과 코드
result
String
API 호출 결과 설명
Object
API 호출 데이터
{
"code": "A000",
"result": "Success",
"data": {
"reportId": "발급된 리포트ID",
"report":[
{
"msgKey": "메시지 키",
"serviceType": "서비스 타입",
"msgType": "메시지 타입",
"sendTime": "2024-00-00T00:00:00+09:00",
"reportTime": "2024-00-00T00:00:00+09:00",
"reportType": "0",
"reportCode": "10000",
"reportText": "Success",
"carrier": "10001",
"ref": "요청시 입력한 데이터"
}
]
}
}
{
"code": "A001",
"result": "Expired token"
}
{
"code": "A802",
"result": "No permission to Pull API"
}
{
"code": "A020",
"result": "Rate limit exceeded"
}
{
"code": "A999",
"result": "Unknown error"
}
reportId
String
리포트 ID
report
Object Array
리포트 정보
DELETE
/v1/report/polling/{reportId}
Header
Authorization
String
schema + “ “ + token
Accept
String
application/json
Path Parameter
reportId
String
YES
리포트 ID
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
Header
Content-Type
String
application/json
Body
String(4)
API 호출 결과 코드
result
String
API 호출 결과 설명
{
"code": "A000",
"result": "Success"
}
{
"code": "A805",
"result": "Invalid Report ID(Pull API)"
}
{
"code": "A001",
"result": "Expired token"
}
{
"code": "A020",
"result": "Rate limit exceeded"
}
{
"code": "A999",
"result": "Unknown error"
}
msgKey
String
메시지 키
String
서비스 타입
String
메시지 타입
sendTime
String
전송 처리 일시(ISO 8601, yyyy-MM-dd'T'HH:mm:ssXXX)
reportTime
String
리포트 일시(ISO 8601, yyyy-MM-dd'T'HH:mm:ssXXX)
String
리포트 종류
String
리포트 코드
reportText
String
리포트 상세
String
이통사 코드
resCnt
String
국제메시지 분할 수
ref
String
참조 필드