Our preferred way of specifying server APIs is using OpenAPI (version 3.0).
Ideal way is to kick this off is collaboratively. It does not need to be a backend developer who starts the documentation. Whoever need this most and/or has the most free time during the initial phase of the project is perfect person to do it.
To edit specifications we recommend using Stoplight Studio to prevent any conflicts in the team.
We have compiled these templates to help with kick-starting specifications:
- OpenAPI project template
- Apiary project template – deprecated, used on older project or where required by our partner.
Start with the template. The OpenAPI template contains has basic setup for linting, generating documentation and starting mock servers.
Keep in mind that to make it work properly you need to do few things:
- Required steps:
- Create mock dyno on Heroku.
- Add
HEROKU_API_KEY
to repository secrets. - Run
yarn
to create up-to-dateyarn.lock
file. - Replace
project-name-mock
inMakefile
with your new hyphenated project name.
- Optional (but recommended) steps:
Be aware: It is publicly accessible, which might be a security risk for some projects.
- Enable GitHub Pages for
main
branch.
- Create API dyno on Heroku.
- Add
HEROKU_API_KEY
to repository secrets. (This is the same secret as for the mock server) - Replace
project-name-api
inMakefile
with your new hyphenated project name. - Uncomment deploy-api job in the
./github/workflows/deploy.yml
- Run
bundle install
to create up-to-dateGemfile.lock
file. - Create heroku environment variables USERNAME and PASSWORD
- Replace the project name in title tag in the
index.html
file to make your documentation usable better in a browser. - Update deployed server addresses in
api.yml
. - Update you API name in
api.yml
.
Now you are ready to start documenting your API!