Skip to main content
All CollectionsIntegrationsPinpoint
How to list Pinpoint jobs on any website
How to list Pinpoint jobs on any website
Dave Edwards avatar
Written by Dave Edwards
Updated over a week ago

Background

One question we get asked from time to time is, other than our Pinpoint Career's page, how can I list jobs on another website. This website may be a company webpage that sits on its own platform or a 3rd party website that is out of the Pinpoint ecosystem.

While we have an API we do not allow non same origin client-side fetches due to our CORS policy. Doing so would effectively leave the API open to everyone and security is paramount.

Solutions

  1. The easiest solution is to use the open JSON endpoint for all external jobs:

https://[company-name].pinpointhq.com/postings.json

The above can be fetched client side with no CORS issues and then can be easily parsed however you wish to display the jobs.

2. We also have a public facing RSS URL that can be used for a variety of use cases (exposing jobs to job boards is a common example).

The issue with RSS feeds (typically) is the format can make them tricky to work with however when combined with a parser you can effectively work with XML which makes life a lot easier for developers.

Example code snippet

// Add in your Pinpoint URL in the RSS_URL

const RSS_URL = `https://<your_company>.pinpointhq.com/jobs.rss`;

fetch(RSS_URL)
.then((response) => response.text())
.then((str) => new window.DOMParser().parseFromString(str, "text/xml"))
.then((data) => {
// show all the parsed data
console.log(data);
// grab all jobs which are in the item tag
const items = data.querySelectorAll("item");
// console log each individual job
items.forEach((item) => console.log(item));
});

Example response

In the above example we do the following:

  • fetch the RSS feed

  • Parse it as XML

  • Select all item tags

  • Console log each item

Next Steps

The above example is for illustrative purposes but you could then render each job, or element of a job, in anyway you wish within the HTML of the page you are planning on listing the jobs within.

Outputting JSON

The previous example is boilerplate you can take and work with how you wish, however if you want to output all the fields into JSON, which can then be easily manipulated, you can use the following code example:

const RSS_URL = 'https://workwithus.pinpointhq.com/jobs.rss'; fetch(RSS_URL) 
.then((response) => response.text())
.then((str) => new window.DOMParser().parseFromString(str, "text/xml"))
.then((data) => {
const items = data.querySelectorAll("item");
items.forEach((item) => {
const encodedContent = item.getElementsByTagName("content:encoded")[0].innerHTML;
const attributes = {
title: item.getElementsByTagName("title")[0].innerHTML,
description: item.getElementsByTagName("description")[0].innerHTML, link: item.getElementsByTagName("link")[0].innerHTML,
pubDate: item.getElementsByTagName("pubDate")[0].innerHTML, department: encodedContent.match(/&lt;p&gt;&lt;strong&gt;Department: &lt;\/strong&gt;(.*?)&lt;\/p&gt;/)[1],
location: encodedContent.match(/&lt;p&gt;&lt;strong&gt;Location: &lt;\/strong&gt;(.*?)&lt;\/p&gt;/)[1],
employmentType: encodedContent.match(/&lt;p&gt;&lt;strong&gt;Employment Type: &lt;\/strong&gt;(.*?)&lt;\/p&gt;/)[1],
reportingTo: encodedContent.match(/&lt;p&gt;&lt;strong&gt;Reporting To: &lt;\/strong&gt;(.*?)&lt;\/p&gt;/)[1],
htmlDescription: encodedContent.match(/&lt;h3&gt;Description&lt;\/h3&gt;((.|\s)*)/)[1] }
console.log(attributes); });
});

The JSON output will look like the below:

E.g. the attributes variable looks like this: 

{
department: "Sales",
description: "Want your calendar .....",
employmentType: "Full Time",
htmlDescription: "HTML output is very long.....",
link: "https://workwithus.pinpointhq.com/jobs/26303",
location: "Remote",
pubDate: "Fri, 15 Oct 2021 11:32:50 +0100",
reportingTo: "Chief Executive Officer",
title: "Sales Account Executive - Remote - US Timezone"
}
Did this answer your question?