-
Notifications
You must be signed in to change notification settings - Fork 6
Testing using Swagger UI
Erik Nelsestuen edited this page May 20, 2024
·
12 revisions
VRO's Swagger UI is available for testing VRO's API endpoints
- Run VRO:
./gradlew :dockerComposeUp :app:dockerComposeUp
-- see Docker Compose and Development process for details and alternatives - Open a browser to http://localhost:8110/swagger or http://localhost:8111/swagger
Testing MVP endpoints:
- Verify VRO is running by testing an endpoint (without authenticating) by expanding an endpoint (e.g.,
/v1/health-data-assessment
) and clicking the "Try it out" button, then "Execute". The response should be code 403 with"error": "Forbidden"
. - Authenticate by clicking the "Authorize" button (near the top of the page), fill in the X-API-Key (at the bottom of the popup window) with one of these values (original PR), then click the "Authorize" button (NOTE: use just
test-key-01
ortest-key-02
in the Authorize dialog). A "Logout" button should appear. Click "Close". - Retry the endpoint (now with the
X-API-Key
header).
Testing iMVP endpoints:
- Verify VRO is running by testing an endpoint (without authenticating) by expanding an endpoint (e.g.,
/v2/automatedClaim
) and clicking the "Try it out" button, then "Execute". The response should be code 401. - Authenticate by clicking the "Authorize" button (near the top of the page), fill in the "Bearer Authentication (http, Bearer)" (at the bottom of the popup window) with a valid JWT token, then click the "Authorize" button. A "Logout" button should appear. Click "Close". Use an example JWT, or use python to create a mock JWT:
- Install PyJWT
python3 -m pip install PyJWT
- Checkout generate-mock-jwt.py
- Run the script
python3 jwt-maker.py
- Retry the endpoint (now with the "Bearer Authentication (http, Bearer)" header)
To connect to Lighthouse, a service-data-access/src/main/resources/private.pem
file is needed. If it doesn't exist, create it using this.
Swagger UI can be accessed on the VA network at https://dev.lighthouse.va.gov/abd-vro/swagger.