Andre1
(Andre1)
July 2, 2019, 2:03pm
1
Hi, can anyone help pls. I have a job recruitment agency who need to ensure their google sitemap indexing is updated every time a job vacancy is posted through the cms and thus when one is deleted. I have generated the code but no idea where to add it in my project? Anyone help.
String scopes = “https://www.googleapis.com/auth/indexing ”;
String endPoint = “https://indexing.googleapis.com/v3/urlNotifications:publish ”;
JsonFactory jsonFactory = new JacksonFactory();
// service_account_file.json is the private key that you created for your service account.
InputStream in = IOUtils.toInputStream(“bcb965bd0287331cd3665342dbf959345a7d8d6a.json”);
GoogleCredential credentials =
GoogleCredential.fromStream(in, this.httpTransport, jsonFactory).createScoped(Collections.singleton(scopes));
GenericUrl genericUrl = new GenericUrl(endPoint);
HttpRequestFactory requestFactory = this.httpTransport.createRequestFactory();
// Define content here. The structure of the content is described in the next step.
String content = “{”
HttpRequest request =
requestFactory.buildPostRequest(genericUrl, ByteArrayContent.fromString(“application/json”, content));
credentials.initialize(request);
HttpResponse response = request.execute();
int statusCode = response.getStatusCode();
webdev
(Jeff Selser)
July 2, 2019, 2:27pm
2
Here is a getting started doc with Google JS API.
# Getting Started
You can use the JavaScript client library to interact with Google APIs, such as People, Calendar, and Drive, from your web applications. Follow the instructions on this page to get started.
[](#top_of_page)How to make API requests
----------------------------------------
There are several ways to use the JavaScript client library to make API requests, but they all follow the same basic pattern:
1. The application loads the JavaScript client library.
2. The application initializes the library with API key, OAuth client ID, and [API Discovery Document(s)](discovery.md).
3. The application sends a request and processes the response.
The following sections show 3 common ways of using the JavaScript client library.
### Option 1: Load the API discovery document, then assemble the request.
The following example assumes the user has already signed in. For a full example of how to sign in a user, see the [full auth sample](https://github.com/google/google-api-javascript-client/blob/master/docs/samples.md#authorizing-and-making-authorized-requests).
```html
This file has been truncated. show original
\Are you publishing the listings to your site with the Webflow API?
Andre1
(Andre1)
July 4, 2019, 9:24am
3
Hi, sorry for late reply, the client is simply using updating and creating job vacancies through the webflow cms.
webdev
(Jeff Selser)
July 4, 2019, 4:44pm
4
@Andre1 - The question is how will you trigger the script? What event can you hook into?
Anyone have a solution for this? I have the same issue. Wordpress has a plug-in to take advantage of Google Index API. Don’t know if Webflow has a similar feature or how this can be accomplished.
In terms of trigger: im using Zapier to create the items on the cms. Perhaps this is a zapier issue?
webdev
(Jeff Selser)
February 3, 2020, 1:33pm
6
You should be able to set up a webhook on Zapier that triggers a process on an application you build and host when a new item is added.
Is anyone interested in adding this functionality to my site as a small job?
JakeOxley
(Jake Oxley)
January 30, 2023, 4:53am
8
Did anyone end up integrating this? looking to set it up on my next project for a news/media company. Would love to know how you went about it.