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

Facebookアカウントを接続する

Facebookページのアカウントを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ページの一括管理を承認するための、有効期間の短いOAuth URLを生成します。返されたurlにユーザーをリダイレクトしてください。このフローの中で、ユーザーはFacebookの利用規約を確認して同意し、Listings APIが必要とするページ管理権限を付与します。リンクは24時間有効です。

リクエストの形式。 リクエストボディは、2つの必須フィールド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ページのデータと対応する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"    }  }'