MARK MIRCHANDANI: When working with a job search service,
artificial intelligence can improve
the experience of your candidates and employers.
In the last set of videos, we looked
at what the Google Cloud Talent Solution Job Search
API offers and gave some general tips for using it.
Now, let's write some code and start working with the API
itself.
[MUSIC PLAYING]
In order to use the API, we'll need
to go through code using the client
libraries, REST interface, or RPC interface.
The client libraries are the easiest way to get started,
so we'll be using those for any examples here.
But the structure is still the same
if you want to use the REST or RPC interfaces.
We'll be using version three of the API for all of our code.
Don't forget to check the documentation for the latest
updates.
First thing's first, we'll need a Google Cloud Platform
project with billing enabled to work from.
If you're not sure how to do this,
I'd recommend checking out the links in the description first,
then coming back to this video when you've
got the GCP basics set up.
With the GCP project, we can open up
the navigation in the top left, and look
for Talent Solution, which will be
under Artificial Intelligence.
When we click on Overview, we should
get redirected to a screen that asks
us to enable the API since this might be a new GCP project.
Easily enough, we can just click that Enable button
to turn on the API for the current project.
This may take a few minutes, but once it's enabled,
anything we do in the context of this project can use the API.
Keep in mind that if you want to use multiple projects
with the API, you'll need to enable it for each project.
After that's done, we'll head back to the Overview page
and have a new screen show up--
a data-logging requirement notification.
This is really just making sure you know that the Job Search
API is powered by a machine-learning model that
needs data.
As part of the integration, we'll
actually be able to send over events
from users who are searching to further train those models.
When this is implemented through code,
you can specify which pieces of information get sent over.
We'll dive deeper into what those events are
and how to send them later, but the pre-trained models
will work just fine for now.
So we'll go ahead and enable Data Logging
and click on Service Account Connections.
See, when making API requests, you'll
need to make them on behalf of an actual authenticated
account.
Google Cloud Platform's best practices
recommend setting up a service account for this.
Once again, there's a link in the description for more
about service accounts, but think of them as an easy way
to set up authenticated users who have limited permissions
so you can build an independent and secure system.
We'll need a service account to use the Job Search API,
so let's create one and give it read-write permissions using
Job Editor under the Cloud Talent Solution section.
It's also possible to set up a service account
with just Job Viewer so it would only have read-only access.
One more note to be aware of-- especially
if you're importing a lot of jobs at once
or dealing with a high volume of search requests,
you should be aware of quotas.
You can see your quotas on the admin page and request
increases if needed.
If you see an error message related to quota or to jobs
still being indexed, the quota page
may help to see what's going on.
Check out the quota page in the ever-growing link
farm down below to see what the default quotas are
and how to raise them.
OK.
That's enough set up for now.
We've got everything we actually need to run some code,
so let's do it.
We'll use the Client Libraries in Python,
but you can check the docs for code samples
in your preferred language.
We'll also use the convenient Cloud Shell
that you can access through the console.
If you're doing this from your own environment,
make sure to get the Google Cloud SDK and the client
libraries installed.
To run the code using the libraries,
you just need to make sure some environment variables are
set up--
one for the project, and one for the path to your service
account's key file.
Let's start off with something simple--
just listening all the companies that we have.
This is our code on the top and the Cloud Shell on the bottom.
You can see that we set up the project
ID using the environment variable,
and in the list companies function,
we'll just list the companies by passing the project ID.
Then, we'll loop to the results and print them all out.
Of course, there's no companies because we
haven't created any yet.
So let's take a look at how to create a basic company.
This function will create a company that's passed in.
The request is pretty similar to the last one,
but we're calling create with some additional fields.
We'll pass in a very basic company
with only the required fields-- display name and external ID.
When we run this, we'll see that the company was created,
and it has a name, which is a unique identifier used
in the API.
Now, when we list our companies, we'll
see the new one we created, as well as its name.
See, the name is the unique identifier
generated by the Job Search API, while the external ID is
the identifier you provide from your own job system.
Anytime you refer to an object through the API,
you'll need to use the name.
We'll talk about that in the next video
when we dive more into working with companies.
In the meantime, you can always check out the documentation
for more info.
Thanks for watching, and remember,
when looking for talent, it's OK to keep your head in the Cloud.
[MUSIC PLAYING]