Publishers using ATS will be able to manage their vacancies through an API.
The API clients will be able to do these operations:
- Create a vacancy
- Retrieve a vacancy
- Update a vacancy
- Delete a vacancy
- List all their vacancies
To onboard new clients to the API, we will first give them access to build and test their API client against our Staging environment.
The technical process is as follows:
-
Add add a new API client for the new integration on the Staging support users ATS API clients dashboard.
For clarity use the name of the ATS we're integrating with (eg: My New Term).
This will generate an API token for the client.
-
Go back to the client contact email and provide them with:
-
The Staging API endpoint URL:
https://staging.teaching-vacancies.service.gov.uk/ats-api/v1 -
Their staging client API token
-
The HTTP credentials for the Staging environment.
-
Once both parts are happy with the testing, we can move the integration to production.
-
Generate a new production API client in the Support users Publisher ATS API Clients page.
-
Provide the client with:
-
The ATS API production endpoint URL:
https://teaching-vacancies.service.gov.uk/ats-api/v1 -
Their production client API token
-
A link to the production ATS API docs that they can use as reference in the future.
-
The HTTP credentials for the API documentation (
SWAGGER_USERNAME/SWAGGER_PASSWORDin our production secrets).
-
The client should be able to use start publishing vacancies in TV production by pointing their API client to the production endpoint URL and using the production client token.
We use rswag for documenting the API.
The API main description, schemas and examples are defined in the swagger spec helper file
The vacancies request spec file is also used for the documentation output and serves as integration test for the API endpoints.
The spec file is used to test the API endpoints behaviour in the CI tests run and to generate the API documentation assets in the CI build and deploy.
The following command generates the 'swagger.yml' file which is used to generate the documentation, and also to validate incoming requests against the schema:
bundle exec rake rswag:specs:swaggerize
Changes on the API must be manually tested end-to-end (ideally on a review app) before being released.
To do so:
- Ensure the main integration specs pass.
- Build a PR review app (or start the app locally for local testing) and visit the
/ats-api-docs/path. - Click on the
Authorizebutton and fill theX-Api-Keyauthorisation using the the api key defined inATS_API_CLIENT_TESTING_API_KEYenv variable. - Test the different API endpoint using their
Try it outbutton, modifying each request payload as needed.