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

Facebook 계정 연결

Facebook Pages 계정을 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 Facebook. 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-facebook"  }}

응답

200OAuth URL generated successfully. Redirect the user to `url` to begin the Facebook authorization flow. The `url` shown is a placeholder; send the user to the `url` returned in your own response.
Response
{  "data": {    "bulkConnectLinkForFacebook": {      "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 "FacebookOauthBulkInput!" was not provided`).
401Unauthenticated, missing or invalid API key.

사용자가 Listings API에 Facebook Pages 일괄 관리 권한을 부여할 때 방문하는, 유효 기간이 짧은 OAuth URL을 생성합니다. 반환된 url로 사용자를 리디렉션합니다. 이 과정에서 사용자는 Facebook 약관을 검토하고 동의하며 Listings API에 필요한 페이지 관리 권한을 부여합니다. 링크는 24시간 동안 유효합니다.

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

이는 connect-google 엔드포인트에 대응하는 Facebook용 엔드포인트이며 일괄 연결 워크플로의 첫 번째 단계입니다. 권한 부여가 완료되면 계정이 GET /connected-accounts에 표시되며, 매칭 및 동기화에 사용되는 connectedAccountId가 함께 제공됩니다.

사용 사례: 고객의 Facebook 페이지 온보딩. 고객이 Facebook 액세스 권한을 부여하면 반환된 url로 리디렉션합니다. 고객이 과정을 완료하면 POST /connected-accounts/trigger-matches를 실행하고, GET /connected-accounts/{connectedAccountId}/connection-suggestions로 결과를 검토한 다음, POST /connected-accounts/confirm-matches를 통해 연결 쌍을 확정하여 Facebook Page 데이터가 매칭된 Listings API 사업장과 동기화되기 시작하도록 합니다.

사용 사례: 권한 거부 후 다시 권한 부여. 사용자가 필수 Facebook 권한을 건너뛰면 해당 연결은 동기화할 수 없습니다. 링크를 다시 발급하고 사용자가 모든 권한을 허용하여 권한 부여를 다시 진행하도록 합니다.

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

Request
curl -X POST 'https://listingsapi.com/api/v4/connected-accounts/connect-facebook' \  -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-facebook"    }  }'