Job search in Google Cloud Talent Solution empty

366 Views Asked by At

Environment details

  • OS: macOS Big Sur Version 11.6 (Apple M1 Chip)
  • Node.js version: v16.4.1
  • npm version: 7.23.0
  • @google-cloud/talent version: v4

Intruduction

I'm having a hard time to get the job search in Google Cloud Talent Solution to work. I already can create/read/update, tenants/companies/jobs indicating that the credentials are ok. But I don't find any jobs searching them.

Facts

Currently I have one job stored in Google Cloud Talent Solution. This ist the job export, done with the Google Console:

{
"name":"projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5/jobs/135317048994472646",
"requisition_id":"f9bffe6e-3c8c-40d5-b3c3-672d30485745",
"title":"IT-Berater"
}

This is the JSON stringifyed request, passed to "searchJobs":

{
"parent":"projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5",
"searchMode":"JOB_SEARCH",
"requestMetadata":{"domain":"insurancepunk.com","sessionId":"8f47bbab-5c15-4bd9-9008-60f79030ab3b","userId":"vCobKcXPFdf6zlVibjnb"},
"jobQuery":{"query":"IT-Berater"}
}

As you can see the project id and the tenant id match the exported job.

This is my very simple code:

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

const client = new talent.JobServiceClient();

      client.searchJobs(request)
      .then(responses => {
        const resources = responses[0];
        for (const resource of resources) {
          console.log(`Job summary: ${resource.jobSummary}`);
          console.log(`Job title snippet: ${resource.jobTitleSnippet}`);
          const job = resource.job;
          console.log(`Job name: ${job.name}`);
          console.log(`Job title: ${job.title}`);
        }
      })
      .catch(err => {
        console.error(err);
      });

The code enters the then-path, but "responses" is empty.

Google OAuth Play Ground

When testing it in Google OAuth Play Ground, i get this results. Googel OAuth Play Ground: https://developers.google.com/oauthplayground/

Google Talent Solution Scope: [https://www.googleapis.com/auth/jobs2

The Scope was found here: https://cloud.google.com/talent-solution/job-search/docs/reference/rpc/google.cloud.talent.v4

Output from Google OAuth Play Ground:

Request:

POST /v4/projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5/jobs:search HTTP/1.1
Host: jobs.googleapis.com
Content-length: 277
Content-type: application/json
Authorization: Bearer ya29.a0ARrda...
{
"parent":"projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5",
"searchMode":"JOB_SEARCH",
"requestMetadata":{"domain":"insurancepunk.com","sessionId":"8f47bbab-5c15-4bd9-9008-60f79030ab3b","userId":"vCobKcXPFdf6zlVibjnb"},
"jobQuery":{"query":"IT-Berater"}
}

Response:

HTTP/1.1 200 OK
Content-length: 117
X-xss-protection: 0
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Cache-control: private
Date: Tue, 30 Nov 2021 09:44:40 GMT
X-frame-options: SAMEORIGIN
Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Content-type: application/json; charset=UTF-8
{
  "metadata": {
    "requestId": "0e7330e1-ee15-404e-85d2-b8174679583f:APAb7ITvUURH6nrwLrbLLBCB9Zg6NKPMfg=="
  }
}

Listing companies works well!

Request:

GET /v4/projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5/companies HTTP/1.1
Host: jobs.googleapis.com
Content-length: 0
Authorization: Bearer ya2...

Response:

HTTP/1.1 200 OK
Content-length: 1124
X-xss-protection: 0
Content-location: https://jobs.googleapis.com/v4/projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5/companies
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Cache-control: private
Date: Tue, 30 Nov 2021 10:08:49 GMT
X-frame-options: SAMEORIGIN
Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Content-type: application/json; charset=UTF-8
{
  "companies": [
    {
      "displayName": "Pompadour GmbH", 
      "name": "projects/insurancepunk/tenants/75f8ac52-6e7c-4b00-9220-03771d25e9c5/companies/a6f34dd2-76f1-40e8-8175-1274f49f5977", 
      "headquartersAddress": "Am Burgweg 1, 97346 Iphofen", 
      "imageUri": "http://www.pompadour.info/bar", 
      "derivedInfo": {
        "headquartersLocation": {
          "locationType": "STREET_ADDRESS", 
          "postalAddress": {
            "postalCode": "97346", 
            "regionCode": "DE", 
            "administrativeArea": "BY", 
            "addressLines": [
              "Am Burgweg 1, 97346 Iphofen, Germany"
            ], 
            "locality": "Iphofen"
          }, 
          "radiusMiles": 6.892640659556388e-05, 
          "latLng": {
            "latitude": 49.7102381, 
            "longitude": 10.254041
          }
        }
      }, 
      "externalId": "9a1ebd16-886c-40ac-ae0a-d5a4e288f867", 
      "websiteUri": "http://www.pompadour.info", 
      "hiringAgency": true
    }
  ], 
  "metadata": {
    "requestId": "5780a724-ca05-4f56-8a88-d74fdc04a24e:APAb7IS/J4Hs1KThU2G0nCZk5fOdBT3sJw=="
  }
}

All hints are welcome.

1

There are 1 best solutions below

0
On

Wow! This don't quite smell like Artificial Intelligence...

My one and only job had the Title "IT-Berater". Searching for "IT-Berater" returned an empty result set. However, searching for "Berater" returned the job...

The results are equal no matter if I used the Node.js API ore the original Google HTTP-API...