A Spring Boot REST API for managing organizations within the Ministry of Health.
All resources require JWT authorization.
Application configuration is specified in application.yml. Of particular importance are:
base-oauth-url: the token issuer.organization-api-client-id: the client ID of this bearer-only client, used foraudvalidation. The client is expected to haveadd-organdget-orgroles.
To run with Maven:
mvn spring-boot:runTo run without Maven installed:
./mvnw spring-boot:run
# or double-click mvnw.cmd on WindowsTo compile and then run with Java:
mvn package -DskipTests=true
java -jar target/organizations-api.jarThe application does not use environment variables, but to run the integration tests you will need to provide credentials for the token issuer.
ORGANIZATIONS_API_TOKEN_CREDENTIALS
Example values:
client_id=SOME_CLIENT&client_secret=SOME_SECRET&grant_type=client_credentialsclient_id=SOME_CLIENT&username=SOME_USER&password=SOME_PASSWORD&grant_type=password
The token issuer is specified by ORGANIZATIONS_API_TOKEN_URL in application-test.yml.
To run just the tests, execute:
mvn testDuring development you may also find the tests written for the IntelliJ HTTP Client useful. They are in requests.http.
Requires a token with get-org.
GET /organizations
Authorization: Bearer {{auth_token}}
RESPONSE: HTTP 200
[
{
"organizationId": "00000010",
"name": "MoH"
},
{
"organizationId": "00002855",
"name": "Other"
}
]Requires a token with add-org.
POST /organizations
Authorization: Bearer {{auth_token}}
Content-Type: application/json
{
"organizationId": "12345678",
"name": "Hi Mom"
}
RESPONSE: HTTP 200
Location: http://localhost:8082/organizations/12345678Requires a token with get-org.
GET /organizations/{{organization-id}}
Authorization: Bearer {{auth_token}}
RESPONSE: HTTP 200
{
"organizationId": "12345670",
"name": "Hi Mom"
}Requires a token with add-org.
The organization ID must exist.
PUT /organizations/{{organization-id}}
Authorization: Bearer {{auth_token}}
Content-Type: application/json
RESPONSE: HTTP 200
{
"name": "Hi Dad"
}Requires a token with delete-org.
The organization ID must exist.
DELETE /organizations/{{organization-id}}
Authorization: Bearer {{auth_token}}
RESPONSE: HTTP 200| Parameter | Type | Description |
|---|---|---|
organizationId |
string |
Unique, Required |
name |
string |
Optional |
Example:
{
"organizationId": "12345678",
"name": "Test Name"
}