net
request
HSP 의 Operation 또는 Hub 와의 네트워크 통신 기능을 제공한다.
options
필드 | 필드 | 설명 | 비고 | M/O |
---|---|---|---|---|
target | 서버이름, OP가 미리 정의되어 있어야 함 | M | ||
path | 서비스 URL 구성을 위한 path | M | ||
method | HTTP 전송 방식
| 대소문자 구분 없음 | M | |
message | Header 와 Playload 로 구성되며 서버로 전송되는 실제 패킷. 개발 시에는 서버와 비즈앱 간의 합의된 규격서를 기반으로 작성된다. | O | ||
header | 패킷 공통 정보 | O | ||
payload | 전송 데이터 | O | ||
options | O | |||
requestTimeout | 네트워크 read/connection timeout 값 | 기본 설정값 : configuration.json내 networkTimeout 값 | O | |
attachedFiles | Upload할 파일 데이터 | O | ||
Callback
필드 | 설명 | 비고 | M/O |
---|---|---|---|
successCallback | 응답 패킷의 내용 전달 | M | |
errorCallback | 오류 메시지 전달 | M | |
statusListener | Request 통신 진행 상황 전달 | O | |
successCallback
필드 | 설명 | 비고 |
---|---|---|
result | 응답 패킷의 내용 | |
errorCallback
필드 | 필드 | 설명 | 비고 |
---|---|---|---|
e | 오류 객체 | ||
code | 상세 오류 코드 | ||
message | 오류 메시지 | ||
statusListener (Optional)
필드 | 필드 | 설명 | 비고 |
---|---|---|---|
status | Request 통신 진행 상황
| 소문자로만 제공 | |
options | 파일 업로드/다운로드 시 제공되는 데이터 사이즈 | ||
totalByte | 전체 데이터 사이즈 | 단위 byte | |
currentByte | 현재 수신된 데이터 사이즈 | 단위 byte | |
Example
POST - 데이터 생성
"target":"hub1",
"path":"/notice/boards",
"method":"POST",
"message":{
"header":{},
"payload":{
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다.",
"postedAt":1704692416000
}
}
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
},
function(s) {
// status callback
switch(s.status) {
// status 가 start인 경우
case 'start':
alert(JSON.stringify(s));
break;
// status 가 finish인 경우
case 'finish':
alert(JSON.stringify(s));
break;
}
}
);
successCallback
"id":106,
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"link":null,
"files":[],
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다.",
"postedAt":1704692416000
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
statusCallback - status가 start인 경우
"status":"start"
}
statusCallback - status가 finish인 경우
"status":"finish"
}
POST - 파일 업로드
"target":"hub1",
"path":"/notice/boards",
"method":"POST",
"message":{
"header":{},
"payload":{
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다."
}
},
"options":{
"attachedFiles":{
"icon":"apple_logo_2.png",
"text":"robots.txt"
},
"requestTimeout": 50000
}
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
},
function(s) {
// status callback
switch(s.status) {
// status 가 start인 경우
case 'start':
alert(JSON.stringify(s));
break;
// status 가 progress인 경우
case 'progress':
console.log('totalByte:' + s.options.totalByte + ', currentByte:' + s.options.currentByte);
break;
// status 가 finish인 경우
case 'finish':
alert(JSON.stringify(s));
break;
}
}
);
successCallback
"id":110,
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"files": [
{
"id": 217,
"name": "icon",
"fileName": "apple_logo_2.png",
"fileUrl": "https://hone.hanwha.co.kr/smarthub_v4d/bizhub/service/notice/boards/217/apple_logo_2.png"
},
{
"id": 217,
"name": "text",
"fileName": "robots.txt",
"fileUrl": "https://hone.hanwha.co.kr/smarthub_v4d/bizhub/service/notice/boards/217/robots.txt"
}
],
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다.",
"postedAt":1704692416000
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
statusCallback - status가 start인 경우
"status":"start"
}
statusCallback - status가 progress인 경우
"status":"progress",
"options":{
"totalByte":10280,
"currentByte":10280
}
}
statusCallback - status가 finish인 경우
"status":"finish"
}
POST - 파일 다운로드
"target":"hub1",
"path":"/notice/boards/download",
"method":"POST",
"message":{
"header":{},
"payload":{
"id":14,
"fileName":"icon.png"
}
}
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
},
function(s) {
// status callback
switch(s.status) {
// status 가 start인 경우
case 'start':
alert(JSON.stringify(s));
break;
// status 가 progress인 경우
case 'progress':
console.log('totalByte:' + s.options.totalByte + ', currentByte:' + s.options.currentByte);
break;
// status 가 finish인 경우
case 'finish':
alert(JSON.stringify(s));
break;
}
}
);
successCallback
"path":"/Users/usr/Library/Developer/CoreSimulator/Devices/9AA09C07-A8DE-4689-8C5B-336ED0307456/data/Containers/Data/Application/58922A4A-7ABF-4551-AAE4-18ED23BEAF27/Library/honemobile/HLODIOS/downloads/icon.png"
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
statusCallback - status가 start인 경우
"status":"start"
}
statusCallback - status가 progress인 경우
"status":"progress",
"options":{
"totalByte":10280,
"currentByte":10280
}
}
statusCallback - status가 finish인 경우
"status":"finish"
}
GET - 전체 조회
"target":"hub1",
"path":"/notice/boards",
"method":"GET"
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
}
);
successCallback
"boards":[{
"id":110,
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"files":[{
"id":110,
"name":"icon",
"fileName":"apple_logo.png",
"fileUrl":"https://hone.hanwha.co.kr/smarthub_v4d/bizhub/service/notice/boards/110/apple_logo.png"
}],
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다.",
"postedAt":1704692416000
},
{
"id":109,
"title":"[안내] 네이버 사칭 메일에 주의해주세요.",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"files":[],
"contents":"안녕하세요. 네이버 메일서비스팀입니다. 사칭 메일을 구분하여 피싱 피해를 예방할 수 있도록 방법을 안내드립니다.",
"postedAt":1704692416000
}]
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
GET - 단일건 조회
"target":"hub1",
"path":"/notice/boards/110",
"method":"GET"
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
}
);
successCallback
"id":110,
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"files":[{
"id":110,
"name":"icon",
"fileName":"apple_logo.png",
"fileUrl":"https://hone.hanwha.co.kr/smarthub_v4d/bizhub/service/notice/boards/110/apple_logo.png"
}],
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다.",
"postedAt":1704692416000
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
GET - 단일건 조회(payload로 query parameter 추가)
"target":"hub1",
"path":"/notice/boards",
"method":"GET",
"message":{
"header":{},
"payload":{
"id":110
}
}
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
}
);
successCallback
"id":110,
"title":"[공지] iOS 18 업그레이드 패치 관련 공지",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"files":[{
"id":110,
"name":"icon",
"fileName":"apple_logo.png",
"fileUrl":"https://hone.hanwha.co.kr/smarthub_v4d/bizhub/service/notice/boards/110/apple_logo.png"
}],
"contents":"안녕하세요. iOS 18 업그레이드 패치 관련 내용입니다.",
"postedAt":1704692416000
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
GET - 파일 다운로드
"target":"hub1",
"path":"/notice/boards/13/icon.png",
"method":"GET"
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
},
function(s) {
// status callback
alert(JSON.stringify(s));
}
);
successCallback
"path":"/Users/urs/Library/Developer/CoreSimulator/Devices/9AA09C07-A8DE-4689-8C5B-336ED0307456/data/Containers/Data/Application/58922A4A-7ABF-4551-AAE4-18ED23BEAF27/Library/honemobile/HLODIOS/downloads/icon.png"
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
statusCallback - status가 start인 경우
"status":"start"
}
statusCallback - status가 progress인 경우
"status":"progress",
"options":{
"totalByte":10280,
"currentByte":10280
}
}
statusCallback - status가 finish인 경우
"status":"finish"
}
PUT - 데이터 갱신
"target":"hub1",
"path":"/notice/boards/10",
"method":"PUT",
"message":{
"header":{},
"payload":{
"title":"[공지] iOS 18 업그레이드 패치 관련 공지 v2",
"contents":"iOS 18 업그레이드 패치 일정 공지드립니다.",
"postedAt":1704692416000
}
}
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
}
);
successCallback
"id":10,
"title":"[공지] iOS 18 업그레이드 패치 관련 공지 v2",
"link":"https://help.naver.com/notice/noticeView.help?noticeNo=12894&serviceNo=1&page=1&lang=ko",
"files":[],
"contents":"iOS 18 업그레이드 패치 일정 공지드립니다.",
"postedAt":1704692416000
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
PUT - 데이터 갱신, 파일 업로드
"target":"hub1",
"path":"/notice/boards/78",
"method":"PUT",
"message":{
"header":{},
"payload":{
"title": "[공지] 그룹 창립 72주년 기념사 v2",
"link": "https://www.hanwha.co.kr",
"contents": "한화가족 여러분! 반갑습니다. 그룹 창립 72주년을 맞아 항상 그룹을 위해 애쓰고 있는 한화가족 여러분에게 먼저 깊은 감사의 마음을 전합니다.\n한화는 지난 72년 많은 위기와 어려움 속에서도 끊임없는 도전과 혁신으로 세계 시장의 주역으로 도약해왔습니다. 사업보국의 창업이념 아래 다이너마이트 국산화를 통해 이룬 국토개발의 꿈은 이제 지구를 넘어 우주를 향하고 있습니다.",
"postedAt": 1704692416000
}
},
"options":{
"attachedFiles":{
"file1":"ios_logo.png"
}
}
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
},
function(e) {
// error callback
alert(JSON.stringify(e));
},
function(s) {
// status callback
alert(JSON.stringify(s));
}
);
successCallback
"id": 78,
"title": "[공지] 그룹 창립 72주년 기념사 v2",
"link": "https://www.hanwha.co.kr",
"files": [
{
"id": 78,
"name": "file1",
"fileName": "ios_logo.png",
"fileUrl": "https://hone.hanwha.co.kr/smarthub_v4d/bizhub/service/notice/boards/78/ios_logo.png"
}
],
"contents": "한화가족 여러분! 반갑습니다. 그룹 창립 72주년을 맞아 항상 그룹을 위해 애쓰고 있는 한화가족 여러분에게 먼저 깊은 감사의 마음을 전합니다.\n한화는 지난 72년 많은 위기와 어려움 속에서도 끊임없는 도전과 혁신으로 세계 시장의 주역으로 도약해왔습니다. 사업보국의 창업이념 아래 다이너마이트 국산화를 통해 이룬 국토개발의 꿈은 이제 지구를 넘어 우주를 향하고 있습니다.",
"postedAt": 1704692416000
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
statusCallback - status가 start인 경우
"status":"start"
}
statusCallback - status가 progress인 경우
"status":"progress",
"options":{
"totalByte":10280,
"currentByte":10280
}
}
statusCallback - status가 finish인 경우
"status":"finish"
}
DELETE - 데이터 삭제
"target":"hub1",
"path":"/notice/boards/1",
"method":"DELETE"
};
hone.channel.execute('net', 'request', [options],
function(result){
// success callback
alert(JSON.stringify(result));
}, function(e) {
// error callback
alert(JSON.stringify(e));
}
);
successCallback
"code": "S00000",
"message": "DELETE SUCCESS"
}
errorCallback
"code":"E12850",
"message":"실행 중 오류가 발생했습니다."
}
Error Code
Code | Cause | Comment |
---|---|---|
E12800 | 파라메터 값이 잘못되어 있을 경우 | |
E12801 | 전달된 액션 값이 알 수 없는 액션일 경우 | |
E12802 | 통신할 서버 이름이 null 이거나 빈 값이고 설정 정보에 없는 경우 | |
E12803 | 서비스 정보가 null 이거나 빈 값인 경우 | |
E12804 | 데이터 전송 방식이 post, get, put, delete 외 다른 값인 경우 | |
E12805 | 타임아웃이 0~2147483647 사이의 정수값이 아닌 경우 | |
E12806 | 서버로 업로드 할 첨부 파일 정보가 잘못되어 있을 경우 | |
E12807 | 서버로 전송되는 패킷 공통 정보가 잘못되어 있을 경우 | |
E12808 | 서버로 전송되는 전송 데이터가 잘못되어 있을 경우 | |
E12850 | 실행 중 오류가 발생 되었을 경우 | |
E12851 | 실행 중 업로드할 파일이 존재하지 않을 경우 | |
E12852 | 서버로 부터 전달받은 응답 메시지가 없는 경우 | |
E12853 | 서버로 부터 전달받은 응답 메시지가 잘못되어 있는 경우 | |
E12899 | 알 수 없는 오류가 발생 되었을 경우 | |