1. Cloud development

ジョブAPIに切り替える

日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

Entities APIやクエリAPIの代わりにジョブAPIを使うには、現在エンティティAPI /api/entitiesを使用しているM.TargetM.JobDescriptionエンティティの取得、作成、更新、削除の呼び出しをジョブAPI /api/jobsに置き換える必要があります。

!注このウォークスルーを完了してコードを更新した後は、ジョブ 管理の推奨手順に従うことができます。

以下の例は、skipとtakeクエリパラメータを用いたジョブAPIへの呼び出しを示しています。

GET /api/jobs/123/targets?skip=0&take=25&state=Pending

ジョブAPIに切り替えるにはコードを更新する必要があります。このウォークスルーでは以下の方法を説明します:

  1. 求人目標や職務記述書の求人情報を特定・更新する
  2. ジョブターゲットや職務記述エンティティを作成するコールを見つけて更新する
  3. ジョブターゲットエンティティを作成する
  4. 求人目標や求人記述書を削除するコールを見つけて更新してください:::

!注ジョブAPIからの応答構造は、エンティティAPIおよびクエリングAPIのものと同じです。

求人目標や職務記述書の求人情報を特定・更新する

Entities APIを使ってジョブターゲットエンティティを取得するAPIコールを探すには、以下の例に示されているようなコールを検索してください。

GET /api/entities/{TARGET_ID}

この呼び出しは以下の例に似た応答を返します。

HTTP status code 200

{ "id": 31388, "identifier": "dLQk3EjdT46PvqdVeqXFgw", "cultures": "en-US" , "properties": { "Target.Location": "10607", "Target.StartedOn": "2024-10-22T18:`31

`.9773702Z", "Target.CompletedOn": "2024-10-22T18:`31
`.4345384Z", "Target.StateDescription": "File processed", "Target.Data": { "type": "Web", "href": "http://www.stylelabs.com/product/annotation-templates/400/Annotation report - PDF template.zip" }, "Target.Scope": null, "Target.Priority": null, "Target.RetryCount": null, "Target.State": { "identifier": "Completed", "labels": { "en-US": "Completed" } }, "Target.Condition": { "identifier": "Success", "labels": { "en-US": "Success" } }, "Target.Type": { "identifier": "Fetch", "labels": { "en-US": "Fetch job" } }, "Target.StatusData": { "code": "FileProcessed" }, "Target.PriorityLevel": null }, "relations": { "JobToTarget": { "href": "https://localhost:8180/api/entities/31388/relations/JobToTarget" } }, "created_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who created the entity" }, "created_on": "2024-10-22T18:`31
`.879725Z", "modified_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who last modified the entity" }, "modified_on": "2024-10-22T18:`31
`.4733914Z", "entitydefinition": { "href": "https://localhost:8180/api/entitydefinitions/M.Target", "title": "The entity definition for this entity" }, "copy": { "href": "https://localhost:8180/api/entities/31388/copy", "title": "Copy this entity" }, "permissions": { "href": "https://localhost:8180/api/entities/31388/permissions", "title": "The permissions on this entity" }, "lifecycle": { "href": "https://localhost:8180/api/entities/31388/lifecycle", "title": "The lifecycle action for this entity." }, "saved_selections": { "href": "https://localhost:8180/api/entities/31388/savedselections", "title": "The saved selections this entity belongs to" }, "roles": { "href": "https://localhost:8180/api/entities/31388/roles", "title": "Roles for this entity" }, "annotations": { "href": "https://localhost:8180/api/entities/31388/annotations", "title": "Annotations for this entity" }, "is_root_taxonomy_item": false, "is_path_root": false, "inherits_security": true, "is_system_owned": false, "version": 3, "self": { "href": "https://localhost:8180/api/entities/31388" }, "renditions": {} }

これを以下に置き換えてください:

GET /api/jobs/{jobId}/targets

この呼び出しは以下の例に似た応答を返します。

HTTP status code 200

{ "items": { "id": 31388, "identifier": "dLQk3EjdT46PvqdVeqXFgw", "cultures": "en-US" , "properties": { "Target.Location": "10607", "Target.StartedOn": "2024-10-22T18:`31

`.9773702Z", "Target.CompletedOn": "2024-10-22T18:`31
`.4345384Z", "Target.StateDescription": "File processed", "Target.Data": { "type": "Web", "href": "http://www.stylelabs.com/product/annotation-templates/400/Annotation report - PDF template.zip" }, "Target.Scope": null, "Target.Priority": null, "Target.RetryCount": null, "Target.State": { "identifier": "Completed", "labels": { "en-US": "Completed" } }, "Target.Condition": { "identifier": "Success", "labels": { "en-US": "Success" } }, "Target.Type": { "identifier": "Fetch", "labels": { "en-US": "Fetch job" } }, "Target.StatusData": { "code": "FileProcessed" }, "Target.PriorityLevel": null }, "relations": { "JobToTarget": { "parent": { "href": "https://localhost:8180/api/entities/31380" }, "inherits_security": true, "self": { "href": "https://localhost:8180/api/entities/31388/relations/JobToTarget" } } }, "created_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who created the entity" }, "created_on": "2024-10-22T18:`31
`.879725Z", "modified_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who last modified the entity" }, "modified_on": "2024-10-22T18:`31
`.4733914Z", "entitydefinition": { "href": "https://localhost:8180/api/entitydefinitions/M.Target", "title": "The entity definition for this entity" }, "copy": { "href": "https://localhost:8180/api/entities/31388/copy", "title": "Copy this entity" }, "permissions": { "href": "https://localhost:8180/api/entities/31388/permissions", "title": "The permissions on this entity" }, "lifecycle": { "href": "https://localhost:8180/api/entities/31388/lifecycle", "title": "The lifecycle action for this entity." }, "saved_selections": { "href": "https://localhost:8180/api/entities/31388/savedselections", "title": "The saved selections this entity belongs to" }, "roles": { "href": "https://localhost:8180/api/entities/31388/roles", "title": "Roles for this entity" }, "annotations": { "href": "https://localhost:8180/api/entities/31388/annotations", "title": "Annotations for this entity" }, "is_root_taxonomy_item": false, "is_path_root": false, "inherits_security": true, "is_system_owned": false, "version": 3, "self": { "href": "https://localhost:8180/api/entities/31388" }, "renditions": {} } , "total_items": 1, "returned_items": 1, "offset": 0, "self": { "href": "https://localhost:8180/api/jobs/31380/targets?skip=0&take=25", "title": "This collection" } }

Entities APIを使って職務記述エンティティを取得するAPIコールを探すには、以下の例に示されているようなコールを検索してください。

GET /api/entities/{JOB_DESCRIPTION_ID}

この呼び出しは以下の例に似た応答を返します。

HTTP status code 200

{ "id": 31382, "identifier": "2OjPPWkhQj-4tc2dUGlaog", "cultures": "en-US" , "properties": { "Job.Configuration": { "file_id": 0, "asset_id": 10607, "files": { "type": "Web", "href": "http://www.stylelabs.com/product/annotation-templates/400/Annotation report - PDF template.zip" } , "post_fetch": , "process_only_post_fetch_tasks": false, "key": "local-df77b7f3dfd040f3bb11805218077a0e" }, "Job.Data": { "qbtMDX_JSAmNzJcIaMJxFA": { "Id": 31391, "has_completed": true } } }, "relations": { "JobToJobDescription": { "parent": { "href": "https://localhost:8180/api/entities/31380" }, "inherits_security": true, "self": { "href": "https://localhost:8180/api/entities/31382/relations/JobToJobDescription" } } }, "created_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who created the entity" }, "created_on": "2024-10-22T18:`30

`.442564Z", "modified_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who last modified the entity" }, "modified_on": "2024-10-22T18:`31
`.135262Z", "entitydefinition": { "href": "https://localhost:8180/api/entitydefinitions/M.JobDescription", "title": "The entity definition for this entity" }, "copy": { "href": "https://localhost:8180/api/entities/31382/copy", "title": "Copy this entity" }, "permissions": { "href": "https://localhost:8180/api/entities/31382/permissions", "title": "The permissions on this entity" }, "lifecycle": { "href": "https://localhost:8180/api/entities/31382/lifecycle", "title": "The lifecycle action for this entity." }, "saved_selections": { "href": "https://localhost:8180/api/entities/31382/savedselections", "title": "The saved selections this entity belongs to" }, "roles": { "href": "https://localhost:8180/api/entities/31382/roles", "title": "Roles for this entity" }, "annotations": { "href": "https://localhost:8180/api/entities/31382/annotations", "title": "Annotations for this entity" }, "is_root_taxonomy_item": false, "is_path_root": false, "inherits_security": true, "is_system_owned": false, "version": 3, "self": { "href": "https://localhost:8180/api/entities/31382" }, "renditions": {} }

これを以下に置き換えてください:

GET /api/jobs/{jobId}/description

この呼び出しは以下の例に似た応答を返します。

HTTP status code 200

{ "id": 31382, "identifier": "2OjPPWkhQj-4tc2dUGlaog", "cultures": "en-US" , "properties": { "Job.Configuration": { "file_id": 0, "asset_id": 10607, "files": { "type": "Web", "href": "http://www.stylelabs.com/product/annotation-templates/400/Annotation report - PDF template.zip" } , "post_fetch": , "process_only_post_fetch_tasks": false, "key": "local-df77b7f3dfd040f3bb11805218077a0e" }, "Job.Data": { "qbtMDX_JSAmNzJcIaMJxFA": { "Id": 31391, "has_completed": true } } }, "relations": { "JobToJobDescription": { "parent": { "href": "https://localhost:8180/api/entities/31380" }, "inherits_security": true, "self": { "href": "https://localhost:8180/api/entities/31382/relations/JobToJobDescription" } } }, "created_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who created the entity" }, "created_on": "2024-10-22T18:`30

`.442564Z", "modified_by": { "href": "https://localhost:8180/api/entities/6", "title": "The user who last modified the entity" }, "modified_on": "2024-10-22T18:`31
`.135262Z", "entitydefinition": { "href": "https://localhost:8180/api/entitydefinitions/M.JobDescription", "title": "The entity definition for this entity" }, "copy": { "href": "https://localhost:8180/api/entities/31382/copy", "title": "Copy this entity" }, "permissions": { "href": "https://localhost:8180/api/entities/31382/permissions", "title": "The permissions on this entity" }, "lifecycle": { "href": "https://localhost:8180/api/entities/31382/lifecycle", "title": "The lifecycle action for this entity." }, "saved_selections": { "href": "https://localhost:8180/api/entities/31382/savedselections", "title": "The saved selections this entity belongs to" }, "roles": { "href": "https://localhost:8180/api/entities/31382/roles", "title": "Roles for this entity" }, "annotations": { "href": "https://localhost:8180/api/entities/31382/annotations", "title": "Annotations for this entity" }, "is_root_taxonomy_item": false, "is_path_root": false, "inherits_security": true, "is_system_owned": false, "version": 3, "self": { "href": "https://localhost:8180/api/entities/31382" }, "renditions": {} }

ジョブターゲットや職務記述エンティティを作成するコールを見つけて更新する

Entities APIを使用する呼び出しをJobs APIを使う呼び出しに置き換える際は、古いAPI呼び出しで使われたリクエストボディが新しいAPIコールに正しくマッピングされていることを確認してください。新しいエンドポイントは以下のリクエストボディを期待します:

  • EntityPostResource ターゲットを作るために。
  • JobDescriptionResource 職務記述書の作成に使うために。

以下の例は、M.TargetとM.JobDescriptionを扱う際にエンティティAPIからジョブズAPIに切り替える方法を示しています。

ジョブターゲットエンティティを作成する

こちらはEntities APIを使ってジョブターゲットエンティティを作成する例です。

POST /api/entities Content-Type: application/json

{ "properties": { "Target.StateDescription": , "Target.Location": }, "relations": { "JobToTarget": { "parent": { "href": "https:///api/entities/{jobId}" } } } }

このものはJobs APIで次のように置き換えます:

POST /api/jobs/{jobId}/targets Content-Type: application/json

{ "properties": { "Target.StateDescription": , "Target.Location": } }

職務記述書エンティティを作成する

こちらはEntities APIを使って職務記述書を作成する例です。

POST /api/entities Content-Type: application/json

{ "properties": { "Job.Data": { ... } }, "relations": { "JobToTarget": { "parent": { "href": "https:///api/entities/{jobId}" } } } }

これをJobs APIを使ったものに置き換えてください。

PUT /api/jobs/{jobId}/description Content-Type: application/json

{ "properties": { "Job.Data": { ... } } }

職務目標や職務内容を更新しましょう

Entities APIを使ってジョブターゲットや職務記述エンティティを更新するコールを特定したら、それらのコールをJobs APIに修正してください。

!重要PUT操作はジョブに関連付けられたターゲットや記述に対して完全な更新を行います。リクエストに含まれていないプロパティや関係はnullに設定されます。

PATCH操作はジョブに関連付けられたターゲットや記述に対して部分的な更新を行います。リクエストに含まれるプロパティと関係のみが更新されます。

古いAPI呼び出しで使用されたリクエストボディが新しいAPIコールに正しくマッピングされていることを確認してください。新しいエンドポイントは以下のリクエストボディを期待します:

  • EntityResource ターゲットの更新(PUT)または部分的な更新(PATCH)のために使用されます。
  • JobDescriptionResource 更新用(PUT)と、職務記述書の部分更新用(PATCH)用EntityResourceです。

こちらはEntities APIを使ってジョブターゲットエンティティを更新するコールです:

PUT /api/entities/{id} PUT /api/entities/identifier/{identifier} Content-Type: application/json

{ "properties": { "Target.StateDescription": , "Target.Location": }, "relations": { "JobToTarget": { "parent": { "href": "https:///api/entities/{jobId}" } } } }

こちらはJobs APIを使ってジョブターゲットエンティティを更新するコールです:

PUT /api/jobs/{jobId}/targets/{targetId} PATCH /api/jobs/{jobId}/targets/{targetId} Content-Type: application/json

{ "properties": { "Target.StateDescription": , "Target.Location": } }

こちらはEntities APIを使って職務記述書エンティティを更新するコールです:

PUT /api/entities/{id} PUT /api/entities/identifier/{identifier} Content-Type: application/json

{ "properties": { "Job.Data": { ... } }, "relations": { "JobToTarget": { "parent": { "href": "https:///api/entities/{jobId}" } } } }

こちらはJobs APIを使って職務記述書エンティティを更新するコールです:

PUT /api/jobs/{jobId}/description PATCH /api/jobs/{jobId}/description Content-Type: application/json

{ "properties": { "Job.Data": { ... } } }

求人目標や職務記述書を削除するコールを見つけて更新する

Entities APIを使ってジョブターゲットや職務記述を削除するコールを特定したら、それらのコールをジョブAPIに更新してください。

こちらはEntities APIを使ってジョブターゲットエンティティを削除するコールです:

DELETE /api/entities/{ID}

このコールを次のように置き換えます:

DELETE /api/jobs/{jobId}/targets/{targetId}

こちらは職務記述書のエンティティを削除するものです:

DELETE /api/entities/{ID}

このコールを次のように置き換えます:

DELETE /api/jobs/{JOB_ID}/description

この記事を改善するための提案がある場合は、 お知らせください!