Skip to content

Latest commit

 

History

History
132 lines (103 loc) · 2.53 KB

README.md

File metadata and controls

132 lines (103 loc) · 2.53 KB

Institutions Read Only API

Testing

Running project and database

First, run a postgres database in Docker:

docker run -p 54321:5432 postgres

Confirm that database server is up and running by connecting to it (adjust IP for Docker host as appropriate):

$ psql hmda -h 192.168.99.100 -U postgres

To load the data, issue the commands in the following script from the psql prompt

To run the project:

$sbt
sbt:root> project institutions-api
sbt:institutions-api> reStart

In order to confirm that the API is up and running:

curl -XGET http://localhost:9092

The response should be similar to the following:

  {
    "status":"OK",
    "service":
    "hmda-institution-api",
    "time":"2018-08-08T19:08:20.655Z",
    "host":"localhost"
  }

Test that the data has been loaded and that the API responds to queries:

$ curl -XGET http://localhost:9092/institutions/54930084UKLVMY22DS16

Response:

   {
     "activityYear":2019,
     "LEI":"54930084UKLVMY22DS16",
     "agency":"1",
     "institutionType":"17",
     "institutionId2017":"12345",
     "taxId":"99-00000000",
     "rssd":"Pb",
     "emailDomains":
        ["aaa.com","bbb.com"],
     "respondent": {
        "name":"xvavjuitZa",
        "state":"NC",
        "city":"Raleigh"
     },
     "parent":{
        "idRssd":"1520162208",
        "name":"Parent Name"
     },
     "assets":"450",
     "otherLenderCode":"1406639146",
     "topHolder":{
        "idRssd":"442825905",
        "name":"TopHolder Name"
     },
     "hmdaFiler":true
   }
$ curl -XGET http://localhost:9092/institutions?domain=aaa.com

Response:

  {"institutions":
     [
        {
            "activityYear":2019,
            "LEI":"54930084UKLVMY22DS16",
            "agency":"1",
            "institutionType":"17",
            "institutionId2017":"12345",
            "taxId":"99-00000000",
            "rssd":"Pb",
            "emailDomains":
                ["aaa.com"],
            "respondent":{
                "name":"xvavjuitZa",
                "state":"NC",
                "city":"Raleigh"
            },
            "parent":{
                "idRssd":"1520162208",
                "name":"Parent Name"
            },
            "assets":"450",
            "otherLenderCode":"1406639146",
            "topHolder":{
                "idRssd":"442825905",
                "name":"TopHolder Name"
            },
            "hmdaFiler":true
        }
     ]
  }