Tutorial 1 - Create a Job

Tutorial

We will give a short introduction to the api by providing a short tutorial in which we:

  1. Authenticate
  2. Create and preview a job
  3. Publish a job

We will therefore use a dynamically generated node.js-client from our swagger.json definiton.

1. Authenticate

In the first Step we have to get our session token to access the rest of the api. We therefore request a new session_token from /api-login with our mandator and token. We then register an ApiKeyAuthorization so our client knows to set the x-session-token header for the subsequent requests.


2. Create and preview a job

To Add a job we use the addJob operation which will post an object to create a job. To preview the job before publishing the isPublished property must be set to false (default). In this case the server will return a job object containing a previewUrl.

3. Publish a job

To finally publish the job, the job object must be modified and the isPublished must be set to true. We then use addJob operation again to post the modified object and update job.

The full example can be downloaded here.

It was tested with node.js version 8.9.4 and npm 5.6.0.

You will have to do > npm install and insert your mandator id and token before starting the project with > node src/create_job.js