Tutorial 1 - Creating a Job
Tutorial
We will give a short introduction to usage of our new api by providing a short tutorial in which we:
Authenticate against the api
Create and preview a job offer
Publish the previously created job offer
We will therefore use a dynamically generated node.js-client from our swagger.json definiton.
1. Authenticate
The api uses an oauth2 application flow. We therefore have to obtain an access_token from an exchange endpoint. The exchange endpoint itself uses a basic authentication and we can retrieve a new session token with our mandator_id and mandator_token. As specified by the oauth2 flow we send the access_token as a Bearer token and attach it to every subsequent request.
2. Create and preview a job
To Add a job we use the CreateOrUpdateJOb 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 found here.
It was tested with node.js v12.4.0 and npm 6.10.3.
You will have to do > npm install and insert your mandator id and token before starting the project with > node src/create_job.js