npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@othermachines/platsbanken-vacancy

v1.0.1

Published

API for submitting vacancies to Arbetsförmedlingen Platsbanken (Swedish Employment Agency jobs bank)

Readme

platsbanken-vacancy

Submit vacancies to the Arbetsförmedlingen Platsbanken (Swedish employment agency job centre).

Description

This module provides an interface for generating an appropriate XML document for submission to the Arbetsförmedlingen Platsbanken API.

It does not perform the submission or handle responses. See ./example/example.js.

Install

npm install --save @othermachines/platsbanken-vacancy

Scripts

npm test: mocha

npm run build: babel src --out-dir build --source-maps

npm run watch: babel src --out-dir build --source-maps --watch

npm prepare: npm run build

Dependencies

This module was developed against node v8.1.2.

  • joi
  • source-map-support
  • xml

Usage

const vacancy = require('@othermachines/platsbanken-vacancy');

const request = vacancy();

try {
  request
    .sender({
      id: '12345678',
      email: '[email protected]',
    })
    .transaction({
      id: 'TRANSACTION GUID',
    })
    .jobPositionPosting({
      id: '46-123456-1234-123-123',
      status: 'active',
    })
    .hiringOrg({
      name: 'Company Name',
      id: '46-123456-1234'
      url: 'http://example.org',
      description: 'Organizational unit description',
    })
    .hiringOrgContact({
      countryCode: 'SE',
      postalCode: '11356',
      municipality: '0180',
      addressLine: 'Birger Jarlsgatan 58, 11356, Stockholm',
      streetName: 'Birger Jarlsgatan 58',
    })
    .postDetail({
      startDate: '2018-09-01',
      endDate: '2018-12-01',
      recruiterName: 'Alex Smith',
      recruiterEmail: '[email protected]',
    })
    .jobPositionTitle({
      title: 'Job Title',
    })
    .jobPositionPurpose({
      purpose: 'Job purpose',
    })
    .jobPositionLocation({
      countryCode: 'SE',
      postalCode: '11356',
      municipality: '0180',
      addressLine: 'Birger Jarlsgatan 58, 11356, Stockholm',
      streetName: 'Birger Jarlsgatan 58',
    })
    .classification({
      scheduleType: 'part',
      duration: 'temporary',
      scheduleSummaryText: 'Schedule Summary',
      durationSummaryText: 'Duration Summary',
      termLength: 2,
    })
    .compensationDescription({
      currency: 'SEK',
      salaryType: 1,
      benefits: 'Benefits',
      summary: 'summary text',
    })
    .qualificationsRequiredSummary({
      summary: 'Summary of qualifications',
    })
    .qualification({
      type: 'license',
      description: 'DriversLicense',
      category: 'B',
    })
    .qualification({
      type: 'experience',
      required: true,
    })
    .qualification({
      type: 'equipment',
      description: 'Car',
    })
    .qualificationsPreferredSummary({
      summary: 'Preferred qualifications',
    })
    // applicationMethods() not neccessary, will be called by byWeb()
    // or byEmail(), included for clarity
    .applicationMethods()
    .byWeb({
      url: 'http://example.org',
    })
    .byEmail({
      email: '[email protected]',
    })
    .numberToFill({
      number: 1,
    })
    .hiringOrgDescription({
      description: 'Hiring org description',
    })
    .occupationGroup({
      code: 7652,
    });
} catch (err) {
  console.log(err);
  if (err.isJoi) {
    console.log('-----');
    console.log(err.annotate());
  }
  process.exit(1);
}
const xmlString = request.toString();

Sample scripts

There are three scripts in the examples directory:

  • minimal.js: demonstrate creation of XML for adding a new vacancy. Minimal fluff, start here.
  • example.js: full fat demo, including adding, updating, and deleting vacancies. See comments at top of script for more detail.
  • apiTest.js: executes tests required by Arbetsförmedling to use API.*

* Note that currently the API is returning an error for test #7 (add vacancy outside of Sweden), apparently on the address.

Running the example script (./example/example.js)

The script uses config to set organisation-specfic information (company name, customer number, organisation number). If you just want to see what the final XML looks like, you don't need to fill those in (but you do need to create the configuration file):

cd example/config/

cp default.sample.json default.json

node example.js --create --xml

You can output the JSON object that is used to create the XML:

node example.js --json

You can use example.js to submit a test request. The API will return an error unless valid values have been set in your config file:

node example.js --create --submit

You can set NODE_ENV to "production" if you want to submit to the live API.

Oddities

Errors may be returned with HTTP status 202 or 400.

202 is returned with errors that appear to have been generated at the application level, e.g., from invalid values such as non-existent postal codes. Just because you got a 2xx response back doesn't mean the post was successful, check your response error code! (See example.js).

400 seems to usually be errors when validating against XSDs, although it will also be returned if you have an invalid customer number.

The JPPExtension element requires that children occur in a specific order. If you receive an error similar to:

  The element 'JPPExtension' in namespace
  'http://arbetsformedlingen.se/LedigtArbete' has
  invalid child element 'ApplicationReferenceID' in
  namespace
  'http://arbetsformedlingen.se/LedigtArbete'. List
  of possible elements expected:
  'LastDateApplication, ApplicationReferenceId,
  RequiredQualification, PreferredQualification' in
  namespace
  'http://arbetsformedlingen.se/LedigtArbete'.

check the order in which you are adding elements. Method calls must be in this order, though only occupationGroup() is required:

vacancy
  .hiringOrgDescription({
    description: 'Hiring org description',
  })
  .contact({
    name: 'Contact Name',
    phone: '555.555.5555',
    email: '[email protected]',
  })
  .occupationGroup({
    code: 7652,
  })
  .applicationReferenceID({
    id: 'ABC123',
  });

(Note that this appears to apply to other tag sets as well - the XSDs make liberal use of sequence - but this was the first time it bit me.)

There are two places where a description of the organization can be added. These are:

<Envelope><Packet><Payload><JobPositionPosting><HiringOrg><OrganizationalUnit><Description>

added via the hiringOrg({name, id, url, description}) method, and

<Envelope><Packet><Payload><JPPExtension><HiringOrgDescription>

added via the hiringOrgDescription({ description }) method.

Neither is required, and the documentation is unclear on the difference. Best guess until I try this out is that they appear in a different order in the job ad.

Thank you

Development of this module was made possible by Internationella Engelska Skolan.

@buren's ruby gem for creating submissions was an invaluable resource. Also see that github page for additional resources, including links to a Postman collection for querying the Arbetsförmedlingen taxonomy service and data from that service in CSV format.

Contributing

Pull requests are welcome!

Methods implement a tag, or set of tags if they are logically a group. Each tag or set is implemented with three methods:

  • jsonTagName(): creates json for the tag/set,
  • validateTagName(): performs parameter validation, throws Joi error on failure,
  • tagName(): calls validateTagName() and jsonTagName(), performs any neccessary business logic and attaches the new JSON object. Methods are chainable, so must return this.

Author

Dwayne Holmberg [email protected] https://github.com/dwayneholmberg

License

This module is freely distributable under the terms of the MIT license.