> ## Documentation Index
> Fetch the complete documentation index at: https://www.integrate.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# ETL: Hubspot 데이터를 API로 가져오기

> Integrate.io ETL의 REST API 컴포넌트와 HubSpot의 API 키를 사용해 HubSpot에서 Contact 데이터를 검색하고 데이터 파이프라인으로 가져오는 방법과 API 키 발급 절차를 자세히 안내합니다. Integrate.io 한국어 사용자 가이드 항목입니다.

이 가이드에서는 Hubspot API를 사용하여 Xplenty에서 Contact 데이터를 검색하는 방법을 설명합니다.
**관련 가이드:** [Xplenty: Hubspot 데이터를 API로 갱신하기](https://www.integrate.io/ko/docs/etl/restapi-part04-ko/)

\*\*이번 사용하는 API에 관한 참고 페이지
\*\*[https://legacydocs.hubspot.com/docs/methods/contacts/get\_contacts](https://legacydocs.hubspot.com/docs/methods/contacts/get_contacts?__hstc=114807128.c51228f2a84e4b928703072619d2233a.1776367979957.1776367979957.1776367979957.1&__hssc=114807128.97.1776367979958&__hsfp=038341d576670ef04875040b9e9ada03)
**Hubspot API를 사용하는 방법?**

* 대시보드 화면 오른쪽 상단에 배치된 '설정' 버튼을 클릭합니다.
  \[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-1.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=c258686ed31fa685d1eea86150ec48df" alt="restapi-part03-ko image 1" width="1200" height="590" data-path="images/creating-packages/restapi-part03-ko/image-1.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/Ugcdl2X0TSe1XDgmZKxR](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/Ugcdl2X0TSe1XDgmZKxR))

* 연동의 "API 키" 메뉴에서 API 키를 생성합니다.
  \[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-2.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=4d3e9e82de361319d0df235dd8749a35" alt="restapi-part03-ko image 2" width="1200" height="713" data-path="images/creating-packages/restapi-part03-ko/image-2.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/WdxJscGeTcqRYx9uTBO4](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/WdxJscGeTcqRYx9uTBO4))

**데이터 읽기**

## **패키지 만들기**

이번에는 데이터 플로 작성시에 제공되는 템플릿을 활용하여 패키지를 만들어 봅시다.

\[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-3.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=c430db17a68b91a0f5ab6769030a97f2" alt="restapi-part03-ko image 3" width="1200" height="1077" data-path="images/creating-packages/restapi-part03-ko/image-3.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/w2DyAkrkS3GnGQ7nNPas](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/w2DyAkrkS3GnGQ7nNPas))

이미 작성된 패키지가 작성됩니다.

\[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-4.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=4a9176163deeb2a374f7249e3ca8f4fc" alt="restapi-part03-ko image 4" width="1200" height="810" data-path="images/creating-packages/restapi-part03-ko/image-4.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/JCY2AEKStiBpKaBfTrwt](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/JCY2AEKStiBpKaBfTrwt))

## **연결 URL 변경**

요청시의 URL을 템플릿으로 설정된 변수를 사용한 URL이 아니라, 변수 부분을 명시적으로 고정값으로 변경하는 것만으로, Contacts 정보를 취득하는 것이 가능합니다.

* 원본 URL : `$url?hapikey=$api_key&count=250`

* 변경 후의 URL:`[https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=](https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=)&lt;API-키값>&count=250`

\[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-5.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=d2b7c58b6a86e15713b5503e953f7e4e" alt="restapi-part03-ko image 5" width="1200" height="746" data-path="images/creating-packages/restapi-part03-ko/image-5.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/jY1OdeUITtuhktGMmjyX](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/jY1OdeUITtuhktGMmjyX))

미리보기를 하면 다음과 같이 JSON 형식으로 데이터를 가져오는 것을 확인할 수 있습니다.

\[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-6.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=19cced99277dbe7490373a17177b5c9f" alt="restapi-part03-ko image 6" width="1200" height="1026" data-path="images/creating-packages/restapi-part03-ko/image-6.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/vELFk0nbTKCYodZW0t34](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/vELFk0nbTKCYodZW0t34))

## **변환**

### **이메일 주소를 하나의 열로 독립적으로 검색하는 방법**

* 데이터 미리보기로 돌아가 이메일 주소가 저장된 JSON 경로를 가져옵니다
  JSON 경로: `$.[2].identity-profiles.[0].identities.[0].value`
  \[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-7.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=c9bba898786015c0a9816f7fe9beed3c" alt="restapi-part03-ko image 7" width="1200" height="702" data-path="images/creating-packages/restapi-part03-ko/image-7.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/kK4fYXZnRUSSqetSV6HU](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/kK4fYXZnRUSSqetSV6HU))

* 위의 JSON 경로를 기반으로 변환식을 정의합니다.
  `JsonExtractScalar(identity_profiles,'$.[0].identities.[0].value')`
  주) 앞의 미리보기에서 컬럼명이 `identity-profiles`가 Xplenty에 의해 자동적으로 `identity_profiles`로 변경된 점에 주의 하세요
  \[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-8.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=0ad263407197c25b7c2116fe00f7c9fe" alt="restapi-part03-ko image 8" width="1200" height="761" data-path="images/creating-packages/restapi-part03-ko/image-8.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/XoYYKl2RRVKAij66oxF9](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/XoYYKl2RRVKAij66oxF9))

* JsonExtractScalar의 사용법\*\*
  \*\*`JsonExtractScalar（인수1,인수２)`:
  `인수１`: 문자열형의 JSON 캐릭터 라인을 포함한 필드나 변수
  `인수２`: JSON 패스를 홑 따옴표로 둘러싼다
  `반환값`: 문자열형

*

`identity_profiles`: 필드 이름. JSON 문자열이 저장됨(문자열형)

* 데이터 저장 대상은 기본설정인 Redshift를 삭제하고 Snowflake로 변경합니다.
  \[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-9.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=fb1d717f035a51570ca8b8a5c927cc78" alt="restapi-part03-ko image 9" width="1200" height="814" data-path="images/creating-packages/restapi-part03-ko/image-9.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/wBMrZFTHROmqU1BVEYkE](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/wBMrZFTHROmqU1BVEYkE))

## **Xplenty에서 작업 실행 결과 확인**

Hubspot에서 3개의 레코드가 업데이트 되었음을 확인되었습니다.

\[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-10.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=33c6e28495917b4b411fb033171210fb" alt="restapi-part03-ko image 10" width="1200" height="853" data-path="images/creating-packages/restapi-part03-ko/image-10.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/VCIiiFfITIa0yGx7Fi0O](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/VCIiiFfITIa0yGx7Fi0O))

쿼리로 데이터를 확인해 보면 아래와 같이 3건의 데이터 입력이 확인 됩니다. 

\[

<Frame>
  <img src="https://mintcdn.com/integrateio/8_YWxtQNutL7liVJ/images/creating-packages/restapi-part03-ko/image-11.webp?fit=max&auto=format&n=8_YWxtQNutL7liVJ&q=85&s=c9c8e73ba82d25f9af951eaef894e3c0" alt="restapi-part03-ko image 11" width="1200" height="814" data-path="images/creating-packages/restapi-part03-ko/image-11.webp" />
</Frame>

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/DM3DH1NBReOkcBviXPVS](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/DM3DH1NBReOkcBviXPVS))

\<!-- notionvc: b176aed2-0c00-4e71-aa1a-53dd46f52b99 -->

##

\<!-- Google Tag Manager hidden fields -->

\<!-- End Google Tag Manager hidden fields -->

\<!-- Text input-->

Get Started

Free 7-day trial. Easy setup. Cancel any time
