noms-digital-studio/delius-offender-api

Name: delius-offender-api

Owner: NOMS Digital Studio

Description: New Tech Delius: Offender API

Created: 2017-10-03 10:19:38.0

Updated: 2018-04-27 16:16:26.0

Pushed: 2018-04-27 16:22:10.0

Homepage: null

Size: 3990

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Delius API

New Tech Delius: Offender API.

The service provides REST access to the Delius Oracle DB offender information.

Continuous Integration

https://circleci.com/gh/noms-digital-studio/delius-offender-api

Gradle commands
Build and run tests
adlew build
Assessmble the app
adlew assemble

This makes the JAR executable by including a manifest.

Start the application default profile

Without additional configuration this mode uses an in memory H2 (empty) database and an in memory LDAP service which references a file resource in the JAR (schema.ldif).

 -jar build/libs/delius-offender-api.jar
Start the application with Delius Oracle db

set SPRING_PROFILES_ACTIVE=oracle

NG_DATASOURCE_URL=jdbc:oracle:thin:@<VM Oracle IP address>:1521:DNDA SPRING_PROFILES_ACTIVE=oracle java -jar build/libs/delius-offender-api.jar
Start the application with real LDAP
NG_LDAP_URLS=ldap://<ldap_addr>:<ldap_port> SPRING_LDAP_USERNAME=cn=orcladmin SPRING_LDAP_PASSWORD=<secret> java -jar build/libs/delius-offender-api.jar
Additional configuration

The application is conigured with conventional Spring parameters. The Spring documentation can be found here:

https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

Default port

Starts the application on port '8080'. To override, set server.port (eg SERVER_PORT=8099 java -jar etc etc)

Documentation

http://localhost:8080/api/swagger-ui.html

Endpoints curl examples
Logon

The logon body must be a fully qualified LDAP distinguished name:

cn=nick.redshaw,cn=Users,dc=moj,dc=com

 -X POST http://localhost:8080/api/logon -H 'Content-Type: text/plain' -d 'uid=jihn,ou=people,dc=memorynotfound,dc=com'
Get offender details
 -X GET http://localhost:8080/api/offenders/12344568 -H 'Authorization: <token>'
Application info
 -X GET http://localhost:8080/api/info
Application health
 -X GET http://localhost:8080/api/health

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.