{"id":22729878,"url":"https://github.com/jhpyle/lsreportapi","last_synced_at":"2025-08-20T12:21:49.587Z","repository":{"id":91864452,"uuid":"66691983","full_name":"jhpyle/lsreportapi","owner":"jhpyle","description":"A web service API for retrieving the contents of Legal Server reports in JSON format","archived":false,"fork":false,"pushed_at":"2018-08-28T10:25:27.000Z","size":22805,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-01T03:03:40.049Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhpyle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-08-27T02:43:10.000Z","updated_at":"2019-03-18T20:17:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8c8f80b-050b-412d-b438-787765cf5492","html_url":"https://github.com/jhpyle/lsreportapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jhpyle/lsreportapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhpyle%2Flsreportapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhpyle%2Flsreportapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhpyle%2Flsreportapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhpyle%2Flsreportapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhpyle","download_url":"https://codeload.github.com/jhpyle/lsreportapi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhpyle%2Flsreportapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262887159,"owners_count":23379766,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T18:12:13.264Z","updated_at":"2025-07-01T03:05:01.995Z","avatar_url":"https://github.com/jhpyle.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lsreportapi\n\nThis is a web service API to the Legal Server reporting mechanism.\nGiven login credentials and a report ID number, the API returns the\ncontent of the report in JSON format.  This can be used to integrate\nother software with Legal Server.\n\nThe API uses [CasperJS](http://casperjs.org/) to scrape the contents\nof a Legal Server report from the front end of Legal Server.  The code\ngoes to the URL of the report (e.g.,\n`http://pla.legalserver.org/report/dynamic?load=360`), logs in,\nselects \"View All\", and then extracts the contents of the report from\nthe HTML table.\n\n## Invocation\n\nYou call it by sending a GET or POST request to the server.  E.g.:\n\n    curl -o output.json --data \"s=pla\u0026u=jpyle\u0026p=secr3tPass\u0026r=360\" https://ls.docassemble.org/\n\nwhere:\n\n* `-o output.json` means that output should be stored in a file called `output.json`\n* `s=pla` means that the server to use should be `https://pla.legalserver.org`.\n* `u=jpyle` means that the user to log in as should be `jpyle`.\n* `p=secr3tPass` means that the user's password is `secr3tPass`.\n* `r=360` means that the report to run is the report with ID\n  number `360`.  You can find the report number of a report by\n  inspecting the hyperlink shown in your browser when you hover over a\n  link to the given report.\n\n## Output\n\nThe output will look something like this:\n\n    {\n        \"rows\": [\n            {\n                \"Age at Intake\": \"65\",\n                \"Citizenship Status\": \"Citizen\",\n                \"City\": \"Philadelphia\",\n                \"Date of Earliest(Open, Intake, Prescreen)\": \"2016-03-14\",\n                \"Disabled\": \"Yes\",\n                \"Zip Code\": \"19143\"\n            },\n            {\n                \"Age at Intake\": \"44\",\n                \"Citizenship Status\": \"Citizen\",\n                \"City\": \"Philadelphia\",\n                \"Date of Earliest(Open, Intake, Prescreen)\": \"2016-03-11\",\n                \"Disabled\": \"No\",\n                \"Zip Code\": \"19124\"\n            }\n        ],\n        \"result\": \"success\"\n    }\n\nThe `result` key will be set to `success` unless an error occurs, in\nwhich case the `result` will contain an error message.\n\nIt is also possible that the entire output will be blank, which\nindicates that an error occurred.\n\n## Security\n\nSince a Legal Server password is transmitted to the API, it is\nimportant to take measures to protect the security of your Legal\nServer instance.\n\n* If you test the API by using a web browser to send a GET request,\ndelete your browser history afterward.  Otherwise the password will be\nstored in the browser history.\n* Note that if you use the command line, and your password is part of\nthe command, the password may become available to other users through\nthe `w` command.  It is best to write a script that uses a library to\nform HTTP requests.\n* The user in Legal Server should be a special user with a special\nrole that has very limited privileges.  Only give this role the\nprivilege of running specific reports that you want to make available\nthrough the API.\n* Note that the user can only have one Legal Server session open at a\ntime.  If you are logged in as yourself and then you use the API with\nyour own Legal Server user name, the API will log you out of your\ninitial session.\n* Sending passwords over HTTP is insecure, so you should never deploy\nthis API without using HTTPS.  To facilitate use of HTTPS, this API's\nstandard installation procedure uses Let's Encrypt to obtain SSL\ncertificates for you.\n\n## Installation\n\nThe easiest way to install this API on a server is to use Docker on\nAmazon Web Services.\n\nCreate an Amazon EC2 instance running Amazon Linux, and give it a\nsecurity group that opens ports 22, 80, and 443 to the outside world.\nNote the URL of the server, go to your DNS provider, and create a\nCNAME record that points to the server.\n\nFor example, the CNAME record might map `ls.my-organization.org` to\n`ec2-54-159-24-192.compute-1.amazonaws.com`.\n\nThen connect to the server using ssh and run the following from the\ncommand line:\n\nRun:\n\n    sudo yum -y update\n    sudo yum -y install docker git\n    sudo usermod -a -G docker ec2-user\n\nThen log off and ssh back into the instance again.  (This effectuates\nthe `usermod` command, allowing the default user `ec2-user` to gain\npermission to run Docker).\n\nThen do:\n\n    docker run \\\n    --env HOSTNAME=ls.docassemble.org \\\n    --env LETSENCRYPTEMAIL=jhpyle@gmail.com \\\n    --volume lraletsencrypt:/etc/letsencrypt \\\n    --volume lraapache:/etc/apache2/sites-available \\\n    --detach --publish 80:80 --publish 443:443 jhpyle/lsreportapi\n\nwhere you have first edited the `HOSTNAME` to be the hostname whose\nDNS you set up, and where you have edited `LETSENCRYPTEMAIL` to\nbe the e-mail address you want to use to access Let's Encrypt.\n\nThis will create a Docker container that runs Debian Linux,\nsupervisord, apache2, letsencrypt, and the API.\n\nNote that no other web servers can run on the machine (i.e. ports 80\nand 443 need to be available).  The EC2 instance will pass through\ntraffic on ports 80 and 443 to the Docker container.\n\n## How to upgrade\n\nTo upgrade to a newer version of the API, `stop` and `rm` the running\nDocker container, then run:\n\n    docker pull jhpyle/lsreportapi\n\nThis will retrieve the latest version of the code from Docker Hub.\n(The Docker image is based off of the \"master\" branch of this GitHub\nrepository.  Docker Hub \"auto-builds\" the new Docker image whenever\na new commit in the \"master\" branch is pushed to GitHub.)\n\nThen, re-run the same `docker run` command that you ran to deploy the\nAPI in the first place.  You can actually leave out the environment\nvariables because the Docker volumes will retain your Let's Encrypt\ncertificates and the web server configuration.  So this command line\nwould be enough to deploy the API:\n\n    docker run \\\n    --volume lraletsencrypt:/etc/letsencrypt \\\n    --volume lraapache:/etc/apache2/sites-available \\\n    --detach --publish 80:80 --publish 443:443 jhpyle/lsreportapi\n\n## Contact the developer\n\nIf you have questions, contact Jonathan Pyle at jhpyle@gmail.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhpyle%2Flsreportapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhpyle%2Flsreportapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhpyle%2Flsreportapi/lists"}