POST/api/v4/connected-accounts/connect-google

Google 계정 연결

Google Business Profile 계정을 Listings API 계정에 연결하는 OAuth URL을 반환합니다.

API 키가 필요합니다. 헤더 형식과 키 교체는 인증을 참고하세요.

매개변수

본문

이름유형필수설명
inputobject필수Wrapper object. The entire request body must be nested under `input`.
input.successUrlstring필수URL the user is redirected to after they successfully authorize Google. Must be an absolute https URL you control.
input.errorUrlstring필수URL the user is redirected to if they cancel or the authorization fails. Must be an absolute https URL you control.

요청 예시

바로 붙여 넣을 수 있는 본문입니다. 예시 ID와 값을 실제 값으로 바꾸세요.

Request body
{  "input": {    "successUrl": "https://listingsapi.com/docs/api/connected-accounts-trigger-matches",    "errorUrl": "https://listingsapi.com/docs/api/connected-accounts-connect"  }}

응답

200OAuth URL generated successfully. Redirect the user to `url` to begin the Google authorization flow. The `url` shown is a placeholder; send the user to the `url` returned in your own response.
Response
{  "data": {    "bulkConnectLinkForGoogle": {      "errors": null,      "success": true,      "url": "https://connect.example.com/oauth?token=8f3c1d92-..."    }  }}
400Bad request, the body was not wrapped in `input`, or `successUrl`/`errorUrl` was omitted (error message: `Variable "$input" of required type "GoogleOauthBulkInput!" was not provided`).
401Unauthenticated, missing or invalid API key.

사용자가 방문하여 Listings API에 자신의 Google Business Profile 사업장을 일괄 관리할 권한을 부여할 수 있는 단기 유효 OAuth URL을 생성합니다. 사용자를 반환된 url로 리디렉션하면 사용자는 Google 동의 화면에서 절차를 완료한 후 제공한 URL 중 하나로 돌아옵니다. 링크는 24시간 동안 유효합니다.

요청 구조. 본문은 필수 필드인 successUrl과 errorUrl을 포함하는 input 객체로 감싸야 합니다. 이 필드들은 사용자가 Google 동의 화면에서 절차를 완료하거나 중단한 후 돌아갈 절대 https URL이며, 성공 시 온보딩을 재개하고 오류 시 재시도할 수 있도록 자체 애플리케이션의 엔드포인트를 전달합니다. accountId 필드는 없으며, 연결 링크의 범위는 항상 API 키를 소유한 계정으로 한정되고, accountId 또는 객체로 감싸지 않은 평면 구조의 본문을 전송하면 HTTP 400으로 거부됩니다.

이는 일괄 연결 워크플로의 첫 번째 단계입니다. 계정에 대한 권한 부여가 완료되면 연결된 계정 목록 조회 엔드포인트(GET /connected-accounts)에 해당 계정이 표시되며, 이후 모든 호출에 사용할 connectedAccountId도 함께 제공됩니다.

사용 사례: 대행사 고객의 Google 프로필 온보딩. 신규 고객이 자신의 Google Business Profile 접근 권한을 넘겨줍니다. 이 엔드포인트를 호출하고 고객을 반환된 url로 리디렉션하면, 고객이 동의한 후 새로 연결된 계정에서 해당 고객의 Google 등록 정보를 사용할 수 있게 됩니다. 그런 다음 POST /connected-accounts/trigger-matches를 실행하여 해당 Google 등록 정보를 Listings API 사업장과 매칭하고, GET /connected-accounts/{connectedAccountId}/connection-suggestions로 매칭된 쌍을 검토한 후 POST /connected-accounts/confirm-matches로 확정합니다.

사용 사례: 만료된 자격 증명 복구. 연결된 계정의 Google 토큰이 만료되면 등록 정보 업데이트의 동기화가 중단됩니다. 이 엔드포인트로 연결 링크를 재발급하고 계정 소유자가 다시 권한을 부여하도록 하면, 연결이 중복 생성되지 않고 기존 연결이 갱신됩니다.

Facebook의 경우 connect-facebook 엔드포인트를 사용합니다. success: true와 함께 url이 null이 아닌 값으로 제공되면 링크가 생성되었다는 의미이며, errors는 생성에 실패한 경우에만 채워집니다.

Request
curl -X POST 'https://listingsapi.com/api/v4/connected-accounts/connect-google' \  -H "Authorization: API $LISTINGSAPI_KEY" \  -H 'Content-Type: application/json' \  -d '{    "input": {      "successUrl": "https://listingsapi.com/docs/api/connected-accounts-trigger-matches",      "errorUrl": "https://listingsapi.com/docs/api/connected-accounts-connect"    }  }'