NiFi를 통해 REST API에서 데이터 가져오기
지정된 REST API Endpoint에서 정기적으로 정보를 받습니다.
대상 1: 얻은 정보를 통합하여 HDFS(또는 로컬 파일, S3)에 저장
골문2: API의 응답을 받은 JSON의 특정 PATH 값
전체도

절차.
REST API 호출
InvokeHTTP 프로세서 사용
Schedule 태그의 Run schedule 값을 0 sec에서 30 sec로 변경

Endpoint 값을 설정합니다.

병합 값:
MergeContent
프로세서 활용
로컬 파일에 저장: PutFile 프로세서

JSON의 특정 PATH 값을 가져와 다시 조립하기
획득한 값: EvaluateJsonPath 프로세서 활용

* Properties 태그의
Destination
값을 flowfile-attribute
로 변경* 플러스 아이콘 을 클릭하여 새 Property-Value 를 추가합니다.
*Property는 자체 정의되고 Value는 JSON 경로
야후 날씨 정보 REST API 계정 획득
{
"ResultInfo": {
"Count": 1,
"Total": 1,
"Start": 1,
"Status": 200,
"Latency": 0.003801,
"Description": "",
"Copyright": "(C) Yahoo Japan Corporation."
},
"Feature": [
{
"Id": "201810082015_139.73229_35.663613",
"Name": "地点(139.73229,35.663613)の2018年10月08日 20時15分から60分間の天気情報",
"Geometry": {
"Type": "point",
"Coordinates": "139.73229,35.663613"
},
"Property": {
"WeatherAreaCode": 4410,
"WeatherList": {
"Weather": [
{
"Type": "observation",
"Date": "201810082015",
"Rainfall": 0.00
},
{
"Type": "forecast",
"Date": "201810082025",
"Rainfall": 0.00
},
{
"Type": "forecast",
"Date": "201810082035",
"Rainfall": 0.00
},
{
"Type": "forecast",
"Date": "201810082045",
"Rainfall": 0.00
},
{
"Type": "forecast",
"Date": "201810082055",
"Rainfall": 0.00
},
{
"Type": "forecast",
"Date": "201810082105",
"Rainfall": 0.00
},
{
"Type": "forecast",
"Date": "201810082115",
"Rainfall": 0.00
}
]
}
}
}
]
}
특정 경로의 값 획득 및 확인LogAttribute
수시로 값 확인 가능문자열 수정

ReplaceText
프로세서:값
Replacement Value
을 변경합니다.provenance를 통해 값 확인

LogAttribute 프로세서를 마우스 오른쪽 버튼으로 클릭하고 메뉴에서
View data provenance
를 선택합니다.데이터 provence 페이지를 표시하려면 다음과 같이 하십시오.

표시할 데이터 선택:
Content
탭 View
버튼:

Reference
이 문제에 관하여(NiFi를 통해 REST API에서 데이터 가져오기), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/zzeng/items/7676ada5688f87a2acd2텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)