Event API
기본 정보
BaseURL
Phase |
URL |
Description |
---|---|---|
QA (DEV) |
https://{region}-qa-connect.lgthinq.com |
region
|
OP |
https://{region}-connect.lgthinq.com |
API List
Method |
End-point |
Sync/ Async |
Response Format |
Summary |
---|---|---|---|---|
GET |
v2/devices/event |
동기 |
JSON |
사용자의 이벤트 구독 디바이스 목록을 조회합니다. |
POST |
v2/devices/event/{DEVICE_ID} |
동기 |
JSON |
지정된 디바이스의 이벤트를 구독합니다. |
DELETE |
v2/devices/event/{DEVICE_ID} |
동기 |
JSON |
지정된 디바이스의 이벤트 구독을 해지합니다. |
POST |
v2/devices/event-async/{DEVICE_ID} |
비동기 |
JSON |
비동기 방식으로, 지정된 디바이스의 이벤트를 구독합니다. |
DELETE |
v2/devices/event-async/{DEVICE_ID} |
비동기 |
JSON |
비동기 방식으로, 지정된 디바이스의 이벤트 구독을 해지합니다. |
디바이스 이벤트 구독 관리
이벤트 구독 목록 조회
POST /v2/devices/event
특정 사용자에 대해 이벤트 구독 디바이스 목록을 조회합니다.
요청
GET /v2/devices/event HTTP/1.1 Host: kic-connect.lgthinq.com Content-Type: application/json Authorization: Bearer {ACCESS_TOKEN} x-message-id: {MESSAGE_ID} x-service-id: {SERVICE_ID} x-service-key: {SERVICE_KEY} x-country-code: {COUNTRY_CODE}
Location |
Name |
Required |
Type |
Default |
Description |
Example |
|
---|---|---|---|---|---|---|---|
Header |
Y |
- | - | - | - |
응답
응답 메시지에 대해서는 다음을 참조하십시오
성공
성공 시, responseCode가 정상 코드 (0000
)로 리턴됩니다. 응답 결과는 response 오브젝트를 통해 확인할 수 있습니다.
Property |
Type |
Description |
|
---|---|---|---|
response |
array (object) |
|
|
└ | deviceId | string |
사용자가 등록한 기기 아이디 |
실패
실패 시, responseCode가 정상 코드 (0000
)가 아닌 다른 값으로 리턴됩니다. 상세 에러 내용은 response > error 오브젝트를 통해 확인할 수 있습니다.
Example
Request
curl -v -X GET 'https://kic-connect.lgthinq.com/v2/devices/event' \ -H 'Authorization: Bearer {EMP_ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -H 'x-message-id: Ig7pfvgQQFiLjrKoBFJ0xg' \ -H 'x-service-id: {YOUR_SERVICE_ID}' \ -H 'x-service-key: {YOUR_SERVICE_KEY}' \ -H 'x-country-code: KR'
Response
{ "messageId": "Ig7pfvgQQFiLjrKoBFJ0xg", "requestId": "n9Wj2DsEs9rSdk77iUdXok", "response": [{ "deviceId": "TQS-7E950117-52AF-4E8E-8ED3-4778C6D67435", }, { "deviceId": "TQS-A0FA49E5-1B95-4F9A-89B5-E4156706276A" } ], "responseCode": "0000", "statusCode": 200, "timestamp": "2020-08-20T01:09:58.224604" }
이벤트 구독
POST /v2/devices/event/{DEVICE_ID}
요청
POST /v2/devices/event/{DEVICE_ID} HTTP/1.1 Host: kic-connect.lgthinq.com Content-Type: application/json Authorization: Bearer {ACCESS_TOKEN} x-message-id: {MESSAGE_ID} x-service-id: {SERVICE_ID} x-service-key: {SERVICE_KEY} x-country-code: {COUNTRY_CODE} { "expire": { "unit": "HOUR", "timer": 1 } }
Location |
Name |
Required |
Type |
Default |
Description |
Example |
|
---|---|---|---|---|---|---|---|
Header |
Y |
- | - | - | - | ||
Path |
DEVICE_ID |
Y |
string |
- |
디바이스 목록 조회를 통해 확인한 사용자의 디바이스 ID |
||
Body |
expire |
N |
object |
|
구독 만료 시간을 결정합니다.
|
{ "expire": { "unit": "HOUR", "timer": 1 } } |
|
└ |
unit |
- |
string |
HOUR |
만료 시간 단위 이벤트 구독 요청의 경우, 허용되는 단위는 HOUR(시) 입니다.
|
||
└ |
timer |
- |
integer |
1 |
이벤트 구독 만료 시간
|
응답
응답 메시지에 대해서는 다음을 참조하십시오
성공
성공 시, responseCode가 정상 코드 (0000
)로 리턴됩니다. 응답 결과는 response 오브젝트를 통해 확인할 수 있습니다.
Property |
Type |
Description |
---|---|---|
response |
object |
비어있는 값을 반환합니다. |
실패
실패 시, responseCode가 정상 코드 (0000
)가 아닌 다른 값으로 리턴됩니다. 상세 에러 내용은 response > error 오브젝트를 통해 확인할 수 있습니다.
Example
Request
curl -v -X POST 'https://kic-connect.lgthinq.com/v2/devices/event/{DEVICE_ID}' \ -H 'Authorization: Bearer {EMP_ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -H 'x-message-id: Ig7pfvgQQFiLjrKoBFJ0xg' \ -H 'x-service-id: {YOUR_SERVICE_ID}' \ -H 'x-service-key: {YOUR_SERVICE_KEY}' \ -H 'x-country-code: KR' \ -d '{ "expire": { "unit": "HOUR", "timer": 1 } }'
Response
{ "messageId": "a30a1a28922240cd9b9373", "requestId": "Dk6yZpYbKJvkuDvKHYP2oY", "response": {}, "responseCode": "0000", "statusCode": 200, "timestamp": "2020-08-25T05:46:35.922378" }
이벤트 구독 해지
DELETE /v2/devices/event/{DEVICE_ID}
요청
DELETE /v2/devices/event/{DEVICE_ID} HTTP/1.1 Host: kic-connect.lgthinq.com Content-Type: application/json Authorization: Bearer {ACCESS_TOKEN} x-message-id: {MESSAGE_ID} x-service-id: {SERVICE_ID} x-service-key: {SERVICE_KEY} x-country-code: {COUNTRY_CODE}
Parameter
Location |
Name |
Required |
Type |
Default |
Description |
Example |
---|---|---|---|---|---|---|
Header |
Y | - | - | - | - | |
Path |
DEVICE_ID |
Y | string | - |
디바이스 목록 조회를 통해 확인한 사용자의 디바이스 ID |
응답
응답 메시지에 대해서는 다음을 참조하십시오
성공
성공 시, responseCode가 정상 코드 (0000
)로 리턴됩니다. 응답 결과는 response 오브젝트를 통해 확인할 수 있습니다.
Property |
Type |
Description |
---|---|---|
response |
object |
비어있는 값을 반환합니다. |
실패
실패 시, responseCode가 정상 코드 (0000
)가 아닌 다른 값으로 리턴됩니다. 상세 에러 내용은 response > error 오브젝트를 통해 확인할 수 있습니다.
Example
Request
curl -v -X DELETE 'https://kic-connect.lgthinq.com/v2/devices/event/{DEVICE_ID}' \ -H 'Authorization: Bearer {EMP_ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -H 'x-message-id: Ig7pfvgQQFiLjrKoBFJ0xg' \ -H 'x-service-id: {YOUR_SERVICE_ID}' \ -H 'x-service-key: {YOUR_SERVICE_KEY}' \ -H 'x-country-code: KR'
Response
{ "messageId": "a30a1a28922240cd9b9373", "requestId": "Dk6yZpYbKJvkuDvKHYP2oY", "response": {}, "responseCode": "0000", "statusCode": 200, "timestamp": "2020-08-25T05:46:35.922378" }
디바이스 이벤트 구독 관리 (비동기)
이벤트 구독 (비동기)
POST /v2/devices/event-async/{DEVICE_ID}
요청된 디바이스의 이벤트를 구독합니다.
이 API는 비동기 방식으로 동작합니다. 동작 방식은 API Call Sequence > 비동기 호출을 참조하시기 바랍니다.
요청
POST /v2/devices/event-async/{DEVICE_ID} HTTP/1.1 Host: kic-connect.lgthinq.com Content-Type: application/json Authorization: Bearer {ACCESS_TOKEN} x-message-id: {MESSAGE_ID} x-service-id: {SERVICE_ID} x-service-key: {SERVICE_KEY} x-country-code: {COUNTRY_CODE} { "expire": { "unit": "HOUR", "timer": 1 } }
Location |
Name |
Required |
Type |
Default |
Description |
Example |
|
---|---|---|---|---|---|---|---|
Header |
Y |
- | - | - | - | ||
Path |
DEVICE_ID |
Y |
string |
- |
디바이스 목록 조회를 통해 확인한 사용자의 디바이스 ID |
||
Body |
expire |
N |
object |
|
구독 만료 시간을 결정합니다.
|
{ "expire": { "unit": "HOUR", "timer": 1 } } |
|
└ |
unit |
- |
string |
HOUR |
만료 시간 단위 이벤트 구독 요청의 경우, 허용되는 단위는 HOUR(시) 입니다.
|
||
└ |
timer |
- |
integer |
1 |
이벤트 구독 만료 시간
|
응답
응답 메시지에 대해서는 다음을 참조하십시오
성공
성공 시, responseCode가 정상 코드 (0000
)로 리턴됩니다. 응답 결과는 response 오브젝트를 통해 확인할 수 있습니다.
Property |
Type |
Description |
---|---|---|
response |
object |
비어있는 값을 반환합니다. |
실패
실패 시, responseCode가 정상 코드 (0000
)가 아닌 다른 값으로 리턴됩니다. 상세 에러 내용은 response > error 오브젝트를 통해 확인할 수 있습니다.
Callback
{ "messageId": "Ig7pfvgQQFiLjrKoBFJ0xg", "requestId": "c6TqAaWAAx9EsnWWzG624J", "response": { "deviceId": {DEVICE_ID}, "deviceType": "DEVICE_AIR_CONDITIONER", "pushType": "DEVICE_EVENT_SUBSCRIBED", "result": {}, "serviceId": {SERVICE_ID}, "userNumber": {USER_NUMBER} }, "responseCode": "0000", "statusCode": 200, "timestamp": "2021-04-02T01:39:49.151744" }
Property | Type | Description |
---|---|---|
deviceId |
string |
디바이스 ID |
deviceType |
string |
디바이스 타입 |
pushType |
string |
DEVICE_EVENT_SUBSCRIBED |
serviceId |
string |
서비스를 등록한 후에 발급되는 서비스 ID |
userNumber |
string |
API를 호출한 사용자의 User Number |
result |
object |
비어있는 값을 반환합니다. |
Example
Request
curl -v -X POST 'https://kic-connect.lgthinq.com/v2/devices/event-async/{DEVICE_ID}' \ -H 'Authorization: Bearer {EMP_ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -H 'x-message-id: Ig7pfvgQQFiLjrKoBFJ0xg' \ -H 'x-service-id: {YOUR_SERVICE_ID}' \ -H 'x-service-key: {YOUR_SERVICE_KEY}' \ -H 'x-country-code: KR' \ -d '{ "expire": { "unit": "HOUR", "timer": 1 } }'
Response
{ "messageId": "Ig7pfvgQQFiLjrKoBFJ0xg", "requestId": "c6TqAaWAAx9EsnWWzG624J", "response": {}, "responseCode": "0000", "statusCode": 202, "timestamp": "2021-04-02T01:39:48.928081" }
이벤트 구독 해지 (비동기)
DELETE /v2/devices/event-async/{DEVICE_ID}
요청된 디바이스에 대해 이벤트 구독을 해지합니다.
이 API는 비동기 방식으로 동작합니다. 동작 방식은 API Call Sequence > 비동기 호출을 참조하시기 바랍니다.
요청
DELETE /v2/devices/event-async/{DEVICE_ID} HTTP/1.1 Host: kic-connect.lgthinq.com Content-Type: application/json Authorization: Bearer {ACCESS_TOKEN} x-message-id: {MESSAGE_ID} x-service-id: {SERVICE_ID} x-service-key: {SERVICE_KEY} x-country-code: {COUNTRY_CODE}
Parameter
Location |
Name |
Required |
Type |
Default |
Description |
Example |
---|---|---|---|---|---|---|
Header |
Y | - | - | - | - | |
Path |
DEVICE_ID |
Y | string | - |
디바이스 목록 조회를 통해 확인한 사용자의 디바이스 ID |
응답
응답 메시지에 대해서는 다음을 참조하십시오
성공
성공 시, responseCode가 정상 코드 (0000
)로 리턴됩니다. 응답 결과는 response 오브젝트를 통해 확인할 수 있습니다.
Property |
Type |
Description |
---|---|---|
response |
object |
비어있는 값을 반환합니다. |
실패
실패 시, responseCode가 정상 코드 (0000
)가 아닌 다른 값으로 리턴됩니다. 상세 에러 내용은 response > error 오브젝트를 통해 확인할 수 있습니다.
Callback
{ "messageId": "Ig7pfvgQQFiLjrKoBFJ0xg", "requestId": "kYjrAq5BLD6D93Pg2RFR3t", "response": { "deviceId": {DEVICE_ID}, "deviceType": "DEVICE_AIR_CONDITIONER", "pushType": "DEVICE_EVENT_UNSUBSCRIBED", "result": {}, "serviceId": {SERVICE_ID}, "userNumber": {USER_NUMBER} }, "responseCode": "0000", "statusCode": 200, "timestamp": "2021-04-02T01:41:46.437116" }
Property | Type | Description |
---|---|---|
deviceId |
string |
디바이스 ID |
deviceType |
string |
디바이스 타입 |
pushType |
string |
DEVICE_EVENT_UNSUBSCRIBED |
serviceId |
string |
서비스를 등록한 후에 발급되는 서비스 ID |
userNumber |
string |
API를 호출한 사용자의 User Number |
result |
object |
비어있는 값을 반환합니다. |
Example
Request
curl -v -X DELETE 'https://kic-connect.lgthinq.com/v2/devices/event-async/{DEVICE_ID}' \ -H 'Authorization: Bearer {EMP_ACCESS_TOKEN}' \ -H 'Content-Type: application/json' \ -H 'x-message-id: Ig7pfvgQQFiLjrKoBFJ0xg' \ -H 'x-service-id: {YOUR_SERVICE_ID}' \ -H 'x-service-key: {YOUR_SERVICE_KEY}' \ -H 'x-country-code: KR'
Response
{ "messageId": "Ig7pfvgQQFiLjrKoBFJ0xg", "requestId": "kYjrAq5BLD6D93Pg2RFR3t", "response": {}, "responseCode": "0000", "statusCode": 202, "timestamp": "2021-04-02T01:41:46.238440" }