> ## 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의 Curl 함수와 HubSpot API를 활용하여 S3에 저장된 CSV 형식의 연락처 데이터를 읽고 HubSpot의 Contact 레코드를 일괄 갱신하는 방법을 단계별 화면과 함께 자세히 소개합니다. 화면 캡처와 함께 단계별로 정리했습니다.

지난번에는 [Xplenty: Hubspot의 데이터를 API로 가져오는](https://www.integrate.io/ko/docs/etl/restapi-part03-ko/) 방법에 대해 소개했지만, 이번에는 Hubspot의 API를 사용하여 Xplenty에서 Hubspot의 Contact 데이터를 갱신하는 방법에 대해 설명합니다.
\*\*이번에 사용하는 API에 관한 참고 문서:
\*\*[https://legacydocs.hubspot.com/docs/methods/contacts/create\_or\_update](https://legacydocs.hubspot.com/docs/methods/contacts/create_or_update?__hstc=114807128.c51228f2a84e4b928703072619d2233a.1776367979957.1776367979957.1776367979957.1&__hssc=114807128.98.1776367979958&__hsfp=038341d576670ef04875040b9e9ada03)
**데이터 쓰기**

여기서는 S3에 저장된 연락처 목록의 CSV 파일을 Hubspot으로 갱신하는 방법을 보여줍니다.

##

**스토리지** 컴포넌트(Source)를 통해, S3에서 Hubspot에 갱신 할 데이터를 가져옵니다.

\[

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

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

## **Select 컴포넌트에서 Curl 함수를 사용하여 리퀘스트를 정의합니다.**

**Select 컴포넌트 설정 화면**

\[

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

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

\*\*리퀘스트 예:
\*\*`[https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/](https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/)메일주소_필드이름/?hapikey=&lt;API_키값>`

리퀘스트 **Body 예:**

\{
"properties": \[
\{
"property": "firstname",
"value": "firstname\_필드이름"
},
\{
"property": "lastname",
"value": "lastname\_필드이름"
},
\{
"property": "company",
"value": "기업명\_필드이름"
}
]
}

\*\*위의 바디 구조를 참고하여 Xplenty의 Curl 함수를 사용한 갱신용 함수식을 만든다.
\*\*`Curl(CONCAT('https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/', mail, '/?hapikey=API-키값'), 'POST', '&#123;"content-type":"application/json"&#125;', CONCAT('&#123; "properties": [&#123;"property": "firstname","value": "',FirstName ,'" &#125;, &#123;"property": "lastname","value": "' ,LastName,'" &#125;,&#123;"property": "company","value": "',Company,'" &#125;]&#125;') )#'status'`

작성된 패키지는 다음과 같습니다.

\[

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

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

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

작업이 올바르게 실행되고 각 이메일 주소에 대한 요청이 성공(상태: 200)하였음을 알 수 있습니다.

\[

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

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

Hubspot쪽의 화면에서 확인하면, 작업 실행 전에 대해 데이터가 올바르게 추가/갱신되었다는 것을 확인할 수 있습니다.

**작업 실행 전:**

\[

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

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

**작업 실행 후:**

\[

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

]\([https://cdn.filestackcontent.com/auto\_image//compress/cache=expiry:max/cEwCX259TU5U5ldp9Io4](https://cdn.filestackcontent.com/auto_image//compress/cache=expiry:max/cEwCX259TU5U5ldp9Io4))
**변수사용이 편리**

이번에는 빠른 이해를 위해 API Key나 URL을 고정값으로 세트하여 소개 했지만, 운영 편의성 측면에서는 변수사용을 추천합니다.

\<!-- notionvc: 18290c7b-1141-41bd-98cf-3abab9f7c773 -->

##

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

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

\<!-- Text input-->

Get Started

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