API Client & Post job ads to the Swedish employment agency (Arbetsförmedlingen)
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Fix typo in bin/seed Dec 8, 2018
config/locales 🔪 misspelling ocupation => occupation Jun 12, 2017
data Additional Arbetsförmedlingen occupations Jun 20, 2017
examples Rubocop 💄 Dec 9, 2018
lib Bump version from 0.6.0 to 0.7.0 Dec 9, 2018
spec Add TaxonomyClient#skill_headlines_by_headline_ids Dec 9, 2018
.gitignore Remove spec/cassettes from gitignore Sep 3, 2018
.hound.yml Add Hound CI configuration file Dec 8, 2018
.rubocop.yml Add rubucop config Sep 12, 2018
.ruby-style-guide.yml Code style :lipstick Sep 12, 2018
CHANGELOG.md Bump version from 0.6.0 to 0.7.0 Dec 9, 2018
Gemfile rubocop -a 💄 Sep 12, 2018
LICENSE.txt Update LICENSE year & name Sep 3, 2018
Rakefile rubocop -a 💄 Sep 12, 2018
arbetsformedlingen.gemspec Update gem description Sep 18, 2018


Arbetsförmedlingen Build Status Gem Version

Arbetsförmedlingen API client (Swedish Public Employment Service).


API Clients

Create a client:

client = Arbetsformedlingen::API::Client.new(locale: 'en')

Fetch all ads containing specified keyword:

ads = client.ads(keywords: 'ruby')

Fetch one ad:

ad = client.ad(id: 7408089)

Fetch countries in area:

countries = client.countries(area_id: 2)
countries.map do |country|
  "#{country.name} has #{country.total_vacancies} total vacancies."

Post job ad

⚠️ In order to post live job ads to Arbetsförmedlingen you need to contact them and go through a test procedure. You can find their own documentation and some additional notes here.

You can find Arbetsförmedlingens own documentation and some additional notes here. Note that the documentation provided by Arbetsförmedlingen can be pretty hard to follow.

Validation support All models used to create a job ad include validations. A lot of work was put into finding all the quirks in the API and adding each validation to its corresponding model. I can't recommend using it enough.

Complete example creating a packet

There's a lot of data you can/must send to the API when creating an ad. See files in lib/arbetsformedlingen/models for details.

See full example.

WSOccupation API Client

client = Arbetsformedlingen::API::WSOccupationClient.new
response = client.occupations
# => "Landskapsarkitekter och landskapsingenjörer"

WSOccupationClient documentation.

🔗 Arbetsformedlingen WsOccupation API documentation

Ontology API Client

client = Arbetsformedlingen::API::OntologyClient.new
response = client.concepts(filter: 'ruby', type: 'skill')
# => [{"uuid"=>"035fc466-605e-5684-a106-a458929f27c6", "name"=>"Ruby", "type"=>"skill"}, ...]

OntologyClient documentation.

🔗 Arbetsformedlingen Ontology API documentation

Taxonomy API Client

client = Arbetsformedlingen::API::TaxonomyClient.new
response = client.occupation_names(language_id: 502) # sv language id
response.xml.css('OccupationName Term').first.text
# => "1:e Fartygsingenjör/1:e Maskinist"

TaxonomyClient documentation.

🔗 Arbetsformedlingen TaxonomiService API documentation


Arbetsförmedlingen TaxonomyService

Some requests had to be made to Arbetsförmedlingens TaxonomyService in order to fetch the data for the occupation codes. You can find that (plus some more) here 👇 Postman.


Terms translation table

This gem has translated the attribute names in Arbetsförmedlingens (AF) API from Swedish to English. You can find the translations below.

Arbetsförmedlingen Term Gem term
landområde/värdsdel areas
kommun municipality
län counties
län2 counties2
yrkesområde occupational_fields
yrkesgrupp occupational_group
yrkesgrupp occupational_group
yrkesnamn occupation


Add this line to your application's Gemfile:

gem 'arbetsformedlingen'

And then execute:

$ bundle

Or install it yourself as:

$ gem install arbetsformedlingen


After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.


Bug reports and pull requests are welcome on GitHub at https://github.com/buren/arbetsformedlingen.


The gem is available as open source under the terms of the MIT License.