Indeedとの連携とAPIの呼び出し
OAuth認証情報を取得し、最初のAPI呼び出しを行います。
本 API および本ドキュメントを利用し、連携を構築することにより、Additional API Terms and Guidelines に同意したものとみなされます。
概要
When you become an Indeed partner, Indeed sets up an app for your integration. Sign in to Partner Console to view your app and OAuth credentials (client ID, secret, and authorization code for 3-legged OAuth). Exchange credentials for an access token to authenticate API calls.
Indeed パートナーになる
まだパートナーでない場合は、Indeedパートナーになる手続きを行ってください。
OAuth クレデンシャルを取得する
-
ご自身のIndeedユーザーアカウントでPartner Consoleにサインインします。
-
Dashboardで、Appsリストからアプリを選択します。
アプリの詳細ページのCredentialsタブに、OAuth認証情報(クライアントIDとシークレット)が表示されます。
アクセストークンを取得する
アクセストークンを取得するには、curl などのコマンドラインツールや Insomnia などの UI ツールを使用して、次のヘッダーとボディパラメーターで https://apis.indeed.com/oauth/v2/tokens に POST リクエストを送信します。
クライアントシークレットをエンドユーザーに公開しないでください。Indeed は、バックエンドでトークンを生成することを推奨します。
curl -L 'https://apis.indeed.com/oauth/v2/tokens' \ -H 'Accept: application/json' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'client_id=<client_id>' \ -d 'client_secret=<client_secret>' \ -d 'grant_type=client_credentials' \ -d 'scope=employer_access'リクエストヘッダーは次のとおりです。
リクエストボディのパラメーターは次のとおりです。
{ "access_token": "<access_token>", "scope": "employer_access", "token_type": "Bearer", "expires_in": 3600}トークンは 1 時間(3600 秒)で有効期限が切れます。トークンは 1 時間ごとに更新します。
Indeed API を呼び出す
Indeed GraphQL APIを呼び出すには、以下のヘッダーとGraphQLクエリまたはミューテーションを指定してhttps://apis.indeed.com/graphqlにPOSTリクエストを送信します。
curl -L 'https://apis.indeed.com/graphql' \ -H 'Authorization: Bearer <access_token>' \ -H 'Content-Type: application/json' \ -d '{"query":"query {\n jobSearch(\n location: { radius: 5, radiusUnit: MILES, where: \"Austin\" }\n what: \"Nurse\"\n limit: 5\n ) {\n results {\n job {\n title\n sourceEmployerName\n }\n }\n }\n}","variables":{}}'リクエストヘッダー:
| ヘッダー | 値 | 説明 |
|---|---|---|
|
| Use this header to authenticate with the server and access protected resources. Pass the access token in this header with the For the See Get an access token, Authorization header, and Basic authentication scheme. |
|
| The media type of the resource. See Content-Type header. |
-dパラメーターでGraphQLクエリを指定します。
query { jobSearch(location: { radius: 5, radiusUnit: MILES, where: "Austin" } what: "Nurse" limit: 5) { results { job { title sourceEmployerName } } }}{ "errors": [{ "message": "The client does not have access to the 'job-retrieval-service' service.", "extensions": { "code": "INTERNAL_SERVER_ERROR" } }], "data": null}関連項目
- oauth/v2/tokensエンドポイント
- HTTPリクエストヘッダー
- 雇用主の作成例
- 求人の作成例
- OAuth 2.0 Client for Java/Kotlin
- GraphQL API reference
- GraphQL エラーのトラブルシューティング
- OAuth エラーのトラブルシューティング