Jobs
To fetch a company's jobs, you first need their token
via Authentication. Once you have the token, you can store it on your server. It won't expire unless it is manually deleted via logout. This logout can occur on the client's account in their ThAFF profile, so be cautious when you receive 401 responses. Alternatively, use Webhooks to be informed when users log out.
JS SDK
import {Loader} from 'thaff-embed-scripts';
import 'thaff-embed-scripts/dist/thaff-embed-scripts.css';
const loader = new Loader({
key: '{key}',
});
const ThaffJobs = await loader.importJobs();
const jobService = new ThaffJobs(token);
const jobs = await jobService.getJobs();
Plain JS
await fetch('https://thaff-thueringen.de/api/v2/jobs', {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
'Accept': 'application/json',
},
});
Guzzle
$client = new \GuzzleHttp\Client();
$res = $client->get('https://thaff-thueringen.de/api/v2/jobs', [
'headers' => [
'Authorization' => 'Bearer {token}'
]
]);
$jobs = json_decode($res->getBody()->getContents(), true);
curl
curl 'https://thaff-thueringen.de/api/v2/jobs' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
This will return an array of Jobs
with the following format
interface Job {
id: number,
reference: string
title: string
description: string
address: {
zip: string | null
city: string | null
houseNumber: string | null
street: string | null
lat: number | null
lng: number | null
},
companyName: string
publishDate: string
url: string
categories: Category[],
professions: Category[]
industrySectors: Category[]
}
interface Category {
id: number,
name: string
}
Attribute | type | description |
---|---|---|
id | int | the internal unique ID of this dataset |
reference | string | external unique number of this dataset, should be used to display the JobId |
title | string | name of the job |
companyName | string | name of company for this job |
address.zip | string | null | zip code of the working location |
address.city | string | null | city of the working location |
address.houseNumber | string | null | house number of the working location |
address.street | string | null | street number of the working location |
address.lat | string | null | geo latitude of the working location |
address.lng | string | null | geo longitude number of the working location |
publishDate | string | Time representation when this job was published in Y-m-d\TH:i:sP |
url | string | Detail URL |
categories | {id: number, title: string}[] | Job categories eg "Vollzeit", "Teilzeit" |
professions | {id: number, title: string}[] | Job categories eg "Öffentlicher Dienst", "Recht, Steuern, Finanzen" |
industrySectors | {id: number, title: string}[] | Job categories eg "Banken", "Einzelhandel" |
Pagination
the API is currently limited to max 100 jobs in all cases with a default page size of 100 jobs per request. You can pass a page size and page number to the getJobs
function in order to fetch less than 100 jobs. For example to show only the first 5 jobs.
JS SDK
// grab first 5 jobs
const jobs = await jobService.getJobs(1, 5);
console.log(jobService.getPagination());
{
perPage: 5
pageCount: x
currentPage: 1
totalPages: x
}
// grab next 5 jobs
const nextJobs = await jobService.getJobs(2, 5);
console.log(jobService.getPagination());
{
perPage: 5
pageCount: x
currentPage: 2
totalPages: x
}
Plain JS
const res = await fetch('https://thaff-thueringen.de/api/v2/jobs?page=1&per-page=5', {
method: 'GET',
headers: {
'Authorization': `Bearer ${token}`,
'Accept': 'application/json',
},
});
res.headers.get('x-pagination-per-page')
res.headers.get('x-pagination-page-count')
res.headers.get('x-pagination-current-page')
res.headers.get('x-pagination-total-count')
Guzzle
$client = new \GuzzleHttp\Client();
$res = $client->get('https://thaff-thueringen.de/api/v2/jobs', [
'headers' => [
'Authorization' => 'Bearer {token}'
],
'query' => [
'page' => 1,
'per-page' => 5
]
]);
$jobs = json_decode($res->getBody()->getContents(), true);
curl
curl 'https://thaff-thueringen.de/api/v2/jobs?per-page=5&page=1' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
Methods
export interface ThaffJobs {
getJobs(page?: number, pageSize?: number): Promise<Job[]>;
// Get the last pagination object
getPagination(): Pagination | null;
}