求人の基本

Job リソースは、1 件の求人の投稿(「求人情報」とも呼ばれます)を表します。求人は、求人の責務を負う雇用側のエンティティである Company に属します。

LIST および GET メソッドを使用して求人にアクセスし、CREATE、UPDATE、DELETE メソッドを使用して求人を操作できます。変更が Cloud Talent Solution のインデックスに反映されるまで数分かかります。

求人はサービス アカウントの適用範囲に含まれます。特定のサービス アカウントの認証情報を使用して認証された検索リクエストのみが、求人のコンテンツへのアクセスに使用できます。

トラブルシューティングや優先順位付けを容易にするため、Cloud Talent Solution の求人インデックスをお客様自身の求人インデックスに同期し、Cloud Talent Solution によって生成された name とお客様のシステム内の固有の求人 ID の関連性を維持してください。求人が変更されたりお客様のシステムに導入されたりすると、適切な CRUD 呼び出しがリアルタイムで CTS に送信され、それらの変更が直ちに反映されます。CTS のインデックスは、既存の求人取り込みパイプラインに追加する必要があります。

ジョブの作成

次のコードサンプルを使用して求人を作成できます。詳細については、クイックスタート: 会社と求人を作成するをご覧ください。チュートリアル動画とインタラクティブなコードラボも利用できます

Go

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Go API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// createJob create a job as given.
func createJob(w io.Writer, projectID, companyID, requisitionID, title, URI, description, address1, address2, languageCode string) (*talentpb.Job, error) {
	ctx := context.Background()

	// Initialize a jobService client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		fmt.Printf("talent.NewJobClient: %v\n", err)
		return nil, err
	}

	jobToCreate := &talentpb.Job{
		CompanyName:   fmt.Sprintf("projects/%s/companies/%s", projectID, companyID),
		RequisitionId: requisitionID,
		Title:         title,
		ApplicationInfo: &talentpb.Job_ApplicationInfo{
			Uris: []string{URI},
		},
		Description:  description,
		Addresses:    []string{address1, address2},
		LanguageCode: languageCode,
	}

	// Construct a createJob request.
	req := &talentpb.CreateJobRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		Job:    jobToCreate,
	}

	resp, err := c.CreateJob(ctx, req)
	if err != nil {
		fmt.Printf("Failed to create job: %v\n", err)
		return nil, err
	}

	fmt.Printf("Created job: %q\n", resp.GetName())

	return resp, nil
}

Java

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Java API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


import com.google.cloud.talent.v4.CreateJobRequest;
import com.google.cloud.talent.v4.Job;
import com.google.cloud.talent.v4.JobServiceClient;
import com.google.cloud.talent.v4.TenantName;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

public class JobSearchCreateJob {

  public static void createJob() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    String companyId = "your-company-id";
    String requisitionId = "your-unique-req-id";
    String jobApplicationUrl = "your-job-url";
    // String projectId = "me-qa-1";
    // String tenantId = "8ed97629-27ee-4215-909b-18cfe3b7e8e3";
    // String companyId = "05317758-b30e-4b26-a57d-d9e54e4cccd8";
    // String requisitionId = "test-requisitionid-1";
    // String jobApplicationUrl = "http://job.url";
    createJob(projectId, tenantId, companyId, requisitionId, jobApplicationUrl);
  }

  // Create a job.
  public static void createJob(
      String projectId,
      String tenantId,
      String companyId,
      String requisitionId,
      String jobApplicationUrl)
      throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      TenantName parent = TenantName.of(projectId, tenantId);
      Job.ApplicationInfo applicationInfo =
          Job.ApplicationInfo.newBuilder().addUris(jobApplicationUrl).build();

      List<String> addresses =
          Arrays.asList(
              "1600 Amphitheatre Parkway, Mountain View, CA 94043",
              "111 8th Avenue, New York, NY 10011");

      // By default, job will expire in 30 days.
      // https://cloud.google.com/talent-solution/job-search/docs/jobs
      Job job =
          Job.newBuilder()
              .setCompany(companyId)
              .setRequisitionId(requisitionId)
              .setTitle("Software Developer")
              .setDescription("Develop, maintain the software solutions.")
              .setApplicationInfo(applicationInfo)
              .addAllAddresses(addresses)
              .setLanguageCode("en-US")
              .build();

      CreateJobRequest request =
          CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();

      Job response = jobServiceClient.createJob(request);
      System.out.format("Created job: %s%n", response.getName());
    }
  }
}

Node.js

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Node.js API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


const talent = require('@google-cloud/talent').v4;

/**
 * Create Job
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenant
 */
function sampleCreateJob(
  projectId,
  tenantId,
  companyName,
  requisitionId,
  title,
  description,
  jobApplicationUrl,
  addressOne,
  addressTwo,
  languageCode
) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const companyName = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionId = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const title = 'Software Engineer';
  // const description = 'This is a description of this <i>wonderful</i> job!';
  // const jobApplicationUrl = 'https://www.example.org/job-posting/123';
  // const addressOne = '1600 Amphitheatre Parkway, Mountain View, CA 94043';
  // const addressTwo = '111 8th Avenue, New York, NY 10011';
  // const languageCode = 'en-US';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const uris = [jobApplicationUrl];
  const applicationInfo = {
    uris: uris,
  };
  const addresses = [addressOne, addressTwo];
  const job = {
    company: companyName,
    requisitionId: requisitionId,
    title: title,
    description: description,
    applicationInfo: applicationInfo,
    addresses: addresses,
    languageCode: languageCode,
  };
  const request = {
    parent: formattedParent,
    job: job,
  };
  client
    .createJob(request)
    .then(responses => {
      const response = responses[0];
      console.log(`Created job: ${response.name}`);
    })
    .catch(err => {
      console.error(err);
    });
}

Python

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Python API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


from google.cloud import talent

def create_job(
    project_id,
    tenant_id,
    company_id,
    requisition_id,
    job_application_url,
):
    """Create Job"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_id = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id = 'Job requisition ID, aka Posting ID. Unique per job.'
    # title = 'Software Engineer'
    # description = 'This is a description of this <i>wonderful</i> job!'
    # job_application_url = 'https://www.example.org/job-posting/123'
    # address_one = '1600 Amphitheatre Parkway, Mountain View, CA 94043'
    # address_two = '111 8th Avenue, New York, NY 10011'
    # language_code = 'en-US'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(company_id, bytes):
        company_id = company_id.decode("utf-8")
    if isinstance(requisition_id, bytes):
        requisition_id = requisition_id.decode("utf-8")
    if isinstance(job_application_url, bytes):
        job_application_url = job_application_url.decode("utf-8")
    parent = f"projects/{project_id}/tenants/{tenant_id}"
    uris = [job_application_url]
    application_info = {"uris": uris}
    addresses = [
        "1600 Amphitheatre Parkway, Mountain View, CA 94043",
        "111 8th Avenue, New York, NY 10011",
    ]
    job = {
        "company": company_id,
        "requisition_id": requisition_id,
        "title": "Software Developer",
        "description": "Develop, maintain the software solutions.",
        "application_info": application_info,
        "addresses": addresses,
        "language_code": "en-US",
    }

    response = client.create_job(parent=parent, job=job)
    print(f"Created job: {response.name}")
    return response.name

必須項目

求人の作成と更新時に必須の項目は、次のとおりです。

  • companyName: companyName=\"projects/{ProjectId}/companies/{CompanyId}\" など、求人を行う会社のリソース名。

  • requisitionId: 求人 ID は投稿 ID とも呼ばれ、求人を識別するために割り当てる値です。このフィールドは、クライアントの識別とリクエストの追跡に使用できます。最大許容文字数は 225 文字(半角相当)です。

    求人情報の一意性は、requisitionIDcompanyName、および場所を組み合わせて決定されます。こうした属性の特定のキーを使用して求人を作成すると、そのキーは Cloud Talent Solution のインデックスに保存され、この求人が削除されるまでそれと同じ項目を含む他の求人は作成できません。

  • title: 職種(「ソフトウェア エンジニア」など)。最大許容文字数は 500 文字(半角相当)です。

    職種が標準のものでないために検索結果に漏れが生じる問題を修正するために、Cloud Talent Solution では求人に指定されているすべてのフィールドを利用してその求人の内容を理解し、その求人の「クリーンな」職種を内部に保存します。検索リクエストがこのサービスに送信されると、検索のクエリもクリーンになり、オントロジーを利用して、クリーンになったクエリが関連するクリーンな求人にマッピングされます。

  • description: 求人の説明。通常、これには複数の段落で説明された会社の情報や関連情報が含まれます。Job オブジェクトには、responsibilities や qualifications などの求人の特性について個別にフィールドが用意されています。こうした個別のフィールドを使用することをおすすめします。

    この項目は、HTML 入力を受け入れ、サニタイズし、太字、斜体、順序付きリスト、順序なしリストなどのマークアップ タグを受け入れます。 最大許容文字数は 100,000 文字です。

次のいずれかです。

  • applicationInfo.uris: アプリケーション ページの URL。

  • applicationInfo.emails: 履歴書または応募の送信先のメールアドレス。

  • applicationInfo.instruction: 「アプリケーションをメールで送信」のようなアプリケーションの手順。このフィールドは、HTML 入力を受け入れてサニタイズし、太字、斜体、順序付きリスト、順序なしリストなどのマークアップ タグを受け入れます。最大許容文字数は 3,000 文字(半角相当)です。

よく使用される項目

  • postingExpireTime: 求人の投稿の有効期限(タイムスタンプに基づく日時)。この日時を経過すると、求人は期限切れとしてマークされ、検索結果に表示されなくなります。この日付は UTC タイムゾーンで 2100/12/31 より前でなければなりません。 無効な日付(過去の日付など)は無視されます。 求人のデフォルトの期限日は、求人の作成日から UTC タイムゾーンで 30 日後です。

    求人が期限切れになっても、GET 演算子を使用すると、期限切れ後 90 日以内であればその求人のコンテンツを取得できます。この 90 日の期限を過ぎると、GET オペレーションでは求人が返されなくなります。

  • addresses: 勤務地。通勤時間による求人検索など、より的確な求人検索結果を得るために、勤務地の正式な住所を入力することをおすすめします。最大許容文字数は 500 文字(半角相当)です。addresses に関する詳細については、下記のベスト プラクティスセクションをご覧ください。

  • promotionValue: 値を 0 より大きくすると、この求人が「注目の求人」として定義されます。この求人はタイプ FEATURED_JOBS の求人検索でのみ返されます。値が高いほど、返される注目の求人の検索結果でより上位に表示されます。詳細については、注目の求人をご覧ください。

カスタム求人フィールドの使用

Cloud Talent Solution には、求人フィールドがいくつか API スキーマに組み込まれています。ただし、すぐに使えるオプションにはない追加のフィールドが必要になる場合があります。可能な限りすぐに使用できるフィールドを使用することをお勧めしますが、Cloud Talent Solution では求人用にいくつかの customAttributes フィールドも用意しています。この中にはフィルタ可能なものと、そうでないものがあります。詳細については、customAttributes ドキュメントをご覧ください。

  • customAttributes: このフィールドには、求人に関するカスタムデータを保存するためのカスタム属性が最大 100 個保存されます。こうしたフィールドは jobQuery フィールドを指定する検索リクエストを使用してフィルタできます。また、いずれのフィールドも companykeywordSearchableJobCustomAttributes 属性に設定できるため、keywordSearchableJobCustomAttributes 内のいずれかのフィールド内に完全一致がある検索語を指定すると、その一致を含むすべての求人が返されます。

次のコード例は、customAttribute を使用して求人を作成する方法を示しています。

Go

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Go API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	"cloud.google.com/go/talent/apiv4beta1/talentpb"
	"github.com/gofrs/uuid"
	money "google.golang.org/genproto/googleapis/type/money"
)

// createJobWithCustomAttributes creates a job with custom attributes.
func createJobWithCustomAttributes(w io.Writer, projectID, companyID, jobTitle string) (*talentpb.Job, error) {
	ctx := context.Background()

	// Initialize a job service client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		return nil, fmt.Errorf("talent.NewJobClient: %w", err)
	}
	defer c.Close()

	// requisitionID shoud be the unique ID in your system
	requisitionID := fmt.Sprintf("job-with-custom-attribute-%s", uuid.Must(uuid.NewV4()).String())
	jobToCreate := &talentpb.Job{
		Company:       fmt.Sprintf("projects/%s/companies/%s", projectID, companyID),
		RequisitionId: requisitionID,
		Title:         jobTitle,
		ApplicationInfo: &talentpb.Job_ApplicationInfo{
			Uris: []string{"https://googlesample.com/career"},
		},
		Description:     "Design, devolop, test, deploy, maintain and improve software.",
		LanguageCode:    "en-US",
		PromotionValue:  2,
		EmploymentTypes: []talentpb.EmploymentType{talentpb.EmploymentType_FULL_TIME},
		Addresses:       []string{"Mountain View, CA"},
		CustomAttributes: map[string]*talentpb.CustomAttribute{
			"someFieldString": {
				Filterable:   true,
				StringValues: []string{"someStrVal"},
			},
			"someFieldLong": {
				Filterable: true,
				LongValues: []int64{900},
			},
		},
		CompensationInfo: &talentpb.CompensationInfo{
			Entries: []*talentpb.CompensationInfo_CompensationEntry{
				{
					Type: talentpb.CompensationInfo_BASE,
					Unit: talentpb.CompensationInfo_HOURLY,
					CompensationAmount: &talentpb.CompensationInfo_CompensationEntry_Amount{
						Amount: &money.Money{
							CurrencyCode: "USD",
							Units:        1,
						},
					},
				},
			},
		},
	}

	// Construct a createJob request.
	req := &talentpb.CreateJobRequest{
		Parent: fmt.Sprintf("projects/%s", projectID),
		Job:    jobToCreate,
	}

	resp, err := c.CreateJob(ctx, req)
	if err != nil {
		return nil, fmt.Errorf("CreateJob: %w", err)
	}

	fmt.Fprintf(w, "Created job with custom attributres: %q\n", resp.GetName())
	fmt.Fprintf(w, "Custom long field has value: %v\n", resp.GetCustomAttributes()["someFieldLong"].GetLongValues())

	return resp, nil
}

Java

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Java API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


import com.google.cloud.talent.v4.CreateJobRequest;
import com.google.cloud.talent.v4.CustomAttribute;
import com.google.cloud.talent.v4.Job;
import com.google.cloud.talent.v4.JobServiceClient;
import com.google.cloud.talent.v4.TenantName;
import java.io.IOException;

public class JobSearchCreateJobCustomAttributes {

  public static void createJob() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    String companyId = "your-company-id";
    String requisitionId = "your-unique-req-id";
    createJob(projectId, tenantId, companyId, requisitionId);
  }

  // Create Job with Custom Attributes.
  public static void createJob(
      String projectId, String tenantId, String companyId, String requisitionId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      TenantName parent = TenantName.of(projectId, tenantId);

      // Custom attribute can be string or numeric value, and can be filtered in search queries.
      // https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
      CustomAttribute customAttribute =
          CustomAttribute.newBuilder()
              .addStringValues("Internship")
              .addStringValues("Apprenticeship")
              .setFilterable(true)
              .build();

      Job job =
          Job.newBuilder()
              .setCompany(companyId)
              .setTitle("Software Developer I")
              .setDescription("This is a description of this <i>wonderful</i> job!")
              .putCustomAttributes("FOR_STUDENTS", customAttribute)
              .setRequisitionId(requisitionId)
              .setLanguageCode("en-US")
              .build();

      CreateJobRequest request =
          CreateJobRequest.newBuilder().setParent(parent.toString()).setJob(job).build();
      Job response = jobServiceClient.createJob(request);
      System.out.printf("Created job: %s\n", response.getName());
    }
  }
}

Node.js

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Node.js API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


const talent = require('@google-cloud/talent').v4;

/**
 * Create Job with Custom Attributes
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenantd
 */
function sampleCreateJob(
  projectId,
  tenantId,
  companyName,
  requisitionId,
  languageCode
) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const companyName = 'Company name, e.g. projects/your-project/companies/company-id';
  // const requisitionId = 'Job requisition ID, aka Posting ID. Unique per job.';
  // const languageCode = 'en-US';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const job = {
    company: companyName,
    requisitionId: requisitionId,
    languageCode: languageCode,
  };
  const request = {
    parent: formattedParent,
    job: job,
  };
  client
    .createJob(request)
    .then(responses => {
      const response = responses[0];
      console.log(`Created job: ${response.name}`);
    })
    .catch(err => {
      console.error(err);
    });
}

Python

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Python API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


from google.cloud import talent

def create_job(project_id, tenant_id, company_id, requisition_id):
    """Create Job with Custom Attributes"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # company_id = 'Company name, e.g. projects/your-project/companies/company-id'
    # requisition_id = 'Job requisition ID, aka Posting ID. Unique per job.'
    # language_code = 'en-US'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(company_id, bytes):
        company_id = company_id.decode("utf-8")

    # Custom attribute can be string or numeric value,
    # and can be filtered in search queries.
    # https://cloud.google.com/talent-solution/job-search/docs/custom-attributes
    custom_attribute = talent.CustomAttribute()
    custom_attribute.filterable = True
    custom_attribute.string_values.append("Intern")
    custom_attribute.string_values.append("Apprenticeship")

    parent = f"projects/{project_id}/tenants/{tenant_id}"

    job = talent.Job(
        company=company_id,
        title="Software Engineer",
        requisition_id=requisition_id,
        description="This is a description of this job",
        language_code="en-us",
        custom_attributes={"FOR_STUDENTS": custom_attribute},
    )

    response = client.create_job(parent=parent, job=job)
    print(f"Created job: {response.name}")
    return response.name

求人の取得

Go

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Go API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// getJob gets an existing job by its resource name.
func getJob(w io.Writer, projectID, jobID string) (*talentpb.Job, error) {
	ctx := context.Background()

	// Initialize a jobService client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		fmt.Printf("talent.NewJobClient: %v\n", err)
		return nil, err
	}

	// Construct a getJob request.
	jobName := fmt.Sprintf("projects/%s/jobs/%s", projectID, jobID)
	req := &talentpb.GetJobRequest{
		// The resource name of the job to retrieve.
		// The format is "projects/{project_id}/jobs/{job_id}".
		Name: jobName,
	}

	resp, err := c.GetJob(ctx, req)
	if err != nil {
		fmt.Printf("Failed to get job %s: %v\n", jobName, err)
		return nil, err
	}

	fmt.Fprintf(w, "Job: %q\n", resp.GetName())
	fmt.Fprintf(w, "Job title: %v\n", resp.GetTitle())

	return resp, err
}

Java

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Java API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


import com.google.cloud.talent.v4.GetJobRequest;
import com.google.cloud.talent.v4.Job;
import com.google.cloud.talent.v4.JobName;
import com.google.cloud.talent.v4.JobServiceClient;
import java.io.IOException;

public class JobSearchGetJob {

  public static void getJob() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    String jobId = "your-job-id";
    getJob(projectId, tenantId, jobId);
  }

  // Get Job.
  public static void getJob(String projectId, String tenantId, String jobId) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      JobName name = JobName.of(projectId, tenantId, jobId);

      GetJobRequest request = GetJobRequest.newBuilder().setName(name.toString()).build();

      Job response = jobServiceClient.getJob(request);
      System.out.format("Job name: %s%n", response.getName());
      System.out.format("Requisition ID: %s%n", response.getRequisitionId());
      System.out.format("Title: %s%n", response.getTitle());
      System.out.format("Description: %s%n", response.getDescription());
      System.out.format("Posting language: %s%n", response.getLanguageCode());
      for (String address : response.getAddressesList()) {
        System.out.format("Address: %s%n", address);
      }
      for (String email : response.getApplicationInfo().getEmailsList()) {
        System.out.format("Email: %s%n", email);
      }
      for (String websiteUri : response.getApplicationInfo().getUrisList()) {
        System.out.format("Website: %s%n", websiteUri);
      }
    }
  }
}

Node.js

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Node.js API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


const talent = require('@google-cloud/talent').v4;

/** Get Job */
function sampleGetJob(projectId, tenantId, jobId) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const jobId = 'Job ID';
  const formattedName = client.jobPath(projectId, tenantId, jobId);
  client
    .getJob({name: formattedName})
    .then(responses => {
      const response = responses[0];
      console.log(`Job name: ${response.name}`);
      console.log(`Requisition ID: ${response.requisitionId}`);
      console.log(`Title: ${response.title}`);
      console.log(`Description: ${response.description}`);
      console.log(`Posting language: ${response.languageCode}`);
      for (const address of response.addresses) {
        console.log(`Address: ${address}`);
      }
      for (const email of response.applicationInfo.emails) {
        console.log(`Email: ${email}`);
      }
      for (const websiteUri of response.applicationInfo.uris) {
        console.log(`Website: ${websiteUri}`);
      }
    })
    .catch(err => {
      console.error(err);
    });
}

Python

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Python API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


from google.cloud import talent

def get_job(project_id, tenant_id, job_id):
    """Get Job"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # job_id = 'Job ID'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(job_id, bytes):
        job_id = job_id.decode("utf-8")
    name = client.job_path(project_id, tenant_id, job_id)

    response = client.get_job(name=name)
    print(f"Job name: {response.name}")
    print(f"Requisition ID: {response.requisition_id}")
    print(f"Title: {response.title}")
    print(f"Description: {response.description}")
    print(f"Posting language: {response.language_code}")
    for address in response.addresses:
        print(f"Address: {address}")
    for email in response.application_info.emails:
        print(f"Email: {email}")
    for website_uri in response.application_info.uris:
        print(f"Website: {website_uri}")

ジョブのリスト表示

Go

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Go API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	"google.golang.org/api/iterator"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// listJobs lists jobs with a filter, for example
// `companyName="projects/my-project/companies/123"`.
func listJobs(w io.Writer, projectID, companyID string) error {
	ctx := context.Background()

	// Initialize a jobService client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		fmt.Printf("talent.NewJobClient: %v\n", err)
		return err
	}

	// Construct a listJobs request.
	companyName := fmt.Sprintf("projects/%s/companies/%s", projectID, companyID)
	req := &talentpb.ListJobsRequest{
		Parent: "projects/" + projectID,
		Filter: fmt.Sprintf("companyName=%q", companyName),
	}

	it := c.ListJobs(ctx, req)

	for {
		resp, err := it.Next()
		if err == iterator.Done {
			return nil
		}
		if err != nil {
			fmt.Printf("it.Next: %v\n", err)
			return err
		}
		fmt.Fprintf(w, "Listing job: %v\n", resp.GetName())
		fmt.Fprintf(w, "Job title: %v\n", resp.GetTitle())
	}
}

Java

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Java API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


import com.google.cloud.talent.v4.Job;
import com.google.cloud.talent.v4.JobServiceClient;
import com.google.cloud.talent.v4.ListJobsRequest;
import com.google.cloud.talent.v4.TenantName;
import java.io.IOException;

public class JobSearchListJobs {

  public static void listJobs() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    String query = "count(base_compensation, [bucket(12, 20)])";
    listJobs(projectId, tenantId, query);
  }

  // Search Jobs with histogram queries.
  public static void listJobs(String projectId, String tenantId, String filter) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      TenantName parent = TenantName.of(projectId, tenantId);
      ListJobsRequest request =
          ListJobsRequest.newBuilder().setParent(parent.toString()).setFilter(filter).build();
      for (Job responseItem : jobServiceClient.listJobs(request).iterateAll()) {
        System.out.format("Job name: %s%n", responseItem.getName());
        System.out.format("Job requisition ID: %s%n", responseItem.getRequisitionId());
        System.out.format("Job title: %s%n", responseItem.getTitle());
        System.out.format("Job description: %s%n", responseItem.getDescription());
      }
    }
  }
}

Node.js

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Node.js API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


const talent = require('@google-cloud/talent').v4;

/**
 * List Jobs
 *
 * @param projectId {string} Your Google Cloud Project ID
 * @param tenantId {string} Identifier of the Tenant
 */
function sampleListJobs(projectId, tenantId, filter) {
  const client = new talent.JobServiceClient();
  // Iterate over all elements.
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const filter = 'companyName=projects/my-project/companies/company-id';
  const formattedParent = client.tenantPath(projectId, tenantId);
  const request = {
    parent: formattedParent,
    filter: filter,
  };

  client
    .listJobs(request)
    .then(responses => {
      const resources = responses[0];
      for (const resource of resources) {
        console.log(`Job name: ${resource.name}`);
        console.log(`Job requisition ID: ${resource.requisitionId}`);
        console.log(`Job title: ${resource.title}`);
        console.log(`Job description: ${resource.description}`);
      }
    })
    .catch(err => {
      console.error(err);
    });
}

Python

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Python API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


from google.cloud import talent

def list_jobs(project_id, tenant_id, filter_):
    """List Jobs"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # filter_ = 'companyName=projects/my-project/companies/company-id'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(filter_, bytes):
        filter_ = filter_.decode("utf-8")
    parent = f"projects/{project_id}/tenants/{tenant_id}"

    # Iterate over all results
    results = []
    for job in client.list_jobs(parent=parent, filter=filter_):
        results.append(job.name)
        print("Job name: {job.name}")
        print("Job requisition ID: {job.requisition_id}")
        print("Job title: {job.title}")
        print("Job description: {job.description}")
    return results

ジョブの削除

Go

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Go API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。

import (
	"context"
	"fmt"
	"io"

	talent "cloud.google.com/go/talent/apiv4beta1"
	talentpb "google.golang.org/genproto/googleapis/cloud/talent/v4beta1"
)

// deleteJob deletes an existing job by its resource name.
func deleteJob(w io.Writer, projectID, jobID string) error {
	ctx := context.Background()

	// Initialize a jobService client.
	c, err := talent.NewJobClient(ctx)
	if err != nil {
		fmt.Printf("talent.NewJobClient: %v\n", err)
		return err
	}

	// Construct a deleteJob request.
	jobName := fmt.Sprintf("projects/%s/jobs/%s", projectID, jobID)
	req := &talentpb.DeleteJobRequest{
		// The resource name of the job to be deleted.
		// The format is "projects/{project_id}/jobs/{job_id}".
		Name: jobName,
	}

	if err := c.DeleteJob(ctx, req); err != nil {
		fmt.Printf("Delete(%s): %v\n", jobName, err)
		return err
	}

	fmt.Printf("Deleted job: %q\n", jobName)

	return err
}

Java

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Java API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


import com.google.cloud.talent.v4.DeleteJobRequest;
import com.google.cloud.talent.v4.JobName;
import com.google.cloud.talent.v4.JobServiceClient;
import java.io.IOException;

public class JobSearchDeleteJob {

  public static void deleteJob() throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String projectId = "your-project-id";
    String tenantId = "your-tenant-id";
    String jobId = "your-job-id";
    deleteJob(projectId, tenantId, jobId);
  }

  // Delete Job.
  public static void deleteJob(String projectId, String tenantId, String jobId) throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (JobServiceClient jobServiceClient = JobServiceClient.create()) {
      JobName name = JobName.of(projectId, tenantId, jobId);

      DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name.toString()).build();

      jobServiceClient.deleteJob(request);
      System.out.println("Deleted job.");
    }
  }
}

Node.js

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Node.js API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


const talent = require('@google-cloud/talent').v4;

/** Delete Job */
function sampleDeleteJob(projectId, tenantId, jobId) {
  const client = new talent.JobServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID (using tenancy is optional)';
  // const jobId = 'Company ID';
  const formattedName = client.jobPath(projectId, tenantId, jobId);
  client.deleteJob({name: formattedName}).catch(err => {
    console.error(err);
  });
  console.log('Deleted job.');
}

Python

CTS 用のクライアント ライブラリをインストールして使用する方法については、CTS クライアント ライブラリをご覧ください。 詳細については、CTS Python API のリファレンス ドキュメントをご覧ください。

CTS への認証を行うには、アプリケーションのデフォルト認証情報を設定します。詳細については、ローカル開発環境の認証の設定をご覧ください。


from google.cloud import talent

def delete_job(project_id, tenant_id, job_id):
    """Delete Job"""

    client = talent.JobServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID (using tenancy is optional)'
    # job_id = 'Company ID'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    if isinstance(job_id, bytes):
        job_id = job_id.decode("utf-8")
    name = client.job_path(project_id, tenant_id, job_id)

    client.delete_job(name=name)
    print("Deleted job.")

おすすめの方法

場所の項目

可能な限り、addresses フィールドに求人の住所を入力することをおすすめします。こうすると場所の検出と関連性の確認がしやすくなります。番地までの住所がわからなくても、できるだけ多くの情報を入力してください。 住所は国レベルまでサポートされています。 「太平洋岸北西部」などの地域の指定はサポートされません。

Cloud Talent Solution は、addresses フィールド内のデータを使用して、derivedInfo.locations フィールド(出力のみ)に住所を自動入力します。正式な住所が入力されない場合、このサービスは他のヒントとなる情報(会社名など)を使用して、求人の投稿用により詳細な住所を推測できるかどうかを判断します。

たとえば、ソフトウェア求人の場所が Mountain View と指定されていて、求人に関連付けられている会社が Google であれば、このサービスは company オブジェクトを調べて headquartersAddress フィールドにより詳細な住所が示されているか、そしてその住所が求人の投稿と同じ市区町村であるかを確認します。その場合、このサービスは求人がその住所にあると「推測」し、その住所を derivedInfo.locations フィールドに入力します。

会社の住所データがない場合、このサービスは独自に所有する知識と求人 / 会社情報を組み合わせて derivedInfo.locations フィールドに渡します。

derivedInfo.locations の値は推測によるベスト エフォートの値であるため、求人の住所を表示するときは、derivedInfo.locations データまたは addresses フィールドを使用するようにしてください。

1 つの求人の投稿に関連付けられる場所は 50 か所までです。1 つの求人にこれより多い場所が存在する場合、その求人を複数の求人に分割してそれぞれ固有の requisitionId(「ReqA」、「ReqA-1」、「ReqA-2」など)を指定します。同じ requisitionIdcompanyNamelanguageCode を持つ求人が複数存在することはできません。元の requisitionId を保存する必要がある場合は、CustomAttribute を使用して保存します。検索しやすくするために、同じ求人の中で、相互の距離が最も近い場所をグループ化することをおすすめします。

サポートされている住所

Google Maps Geocoding API で認識される住所(formattedAddress フィールド内)であれば、どれでも Cloud Talent Solution で使用できます。認識されない住所を使用してジョブの作成や検索を行うと、サービスから 400 エラーが返されます。

会社の住所が Google Maps Geocoding API の一覧に正しく表示されていない場合は、バグを報告して修正を依頼してください。修正が有効になるまで最大 5 日かかります。

住所のオートコンプリート機能

Cloud Talent Solution では、場所のオートコンプリートの候補は表示されません。 Google Maps Places API などの位置情報サービスを使用して、オートコンプリートの候補を入力してください。

都道府県(州)全体の求人、全国の求人、在宅の求人

postingRegion フィールドを使用して、都道府県(州)全体の求人、全国の求人、在宅の求人を指定できます。

  • ADMINISTRATIVE_AREANATION の求人は、求人の投稿の都道府県(州)または国内を指定した検索に対して返されます。たとえば、ADMINISTRATIVE_AREA 求人の場所が「WA、USA」の場合、LocationFilter に「Seattle」を指定する検索で返されます。

  • TELECOMMUTE の求人は場所に関連する検索で返されますが、場所への関連性は低いとみなされます。この求人を検索対象にするには、検索の LocationFiltertelecommutePreference フラグを TELECOMMUTE_ALLOWED に設定します。