Git Product home page Git Product logo

corporate-connections's Introduction

Corporate Connections

Build an API for looking up corporate connections using the Companies House api.

Companies House API

E.g. for officerId aEdQfmEjiBuB7tLwOP_Wfg-JA-8, this curl request returns their companies:

curl -XGET -u <api-key>: https://api.company-information.service.gov.uk/officers/aEdQfmEjiBuB7tLwOP_Wfg-JA-8/appointments

And for companyNumber 03114488, this curl request returns its officers:

curl -XGET -u <api-key>: https://api.company-information.service.gov.uk/company/03114488/officers

API Docs.

Running the webserver

Use the API_KEY environment variable to set the Companies House api key:

webserver-project$ API_KEY=my-api-key sbt

...

[webserver-project] $ run

--- (Running the application, auto-reloading is enabled) ---

[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

(Server started, use Enter to stop and go back to the console...)

Task 1: proxy appointments data for an officer

Implement the /officer/:id/appointmentsProxy endpoint.

Pass through the unaltered Companies House API appointments response for an officerId.

E.g. for officerId aEdQfmEjiBuB7tLwOP_Wfg-JA-8: https://api.company-information.service.gov.uk/officers/aEdQfmEjiBuB7tLwOP_Wfg-JA-8/appointments

Build on the CompaniesHouseService class in the services package for talking to the Companies House API.

Task 2: return companyNumbers for an officer

Implement the /officer/:officerId/appointments endpoint.

Use Circe to decode the Companies House response into Scala case classes. Use the OfficerAppointmentResponse model in models/CompaniesHouseModels.scala.

Then return just the list of companyNumbers, as a JSON array.

Task 3: return officer names for a given companyNumber

Implement the /company/:companyNumber/officers endpoint.

E.g. for companyNumber 03114488: https://api.company-information.service.gov.uk/company/03114488/officers

Use Circe to decode the Companies House response into Scala case classes. Use the CompanyOfficersResponse model in models/CompaniesHouseModels.scala.

Task 4:

Implement the /officer/:officerId/connections endpoint.

It should take an officerId and return a JSON array of connected officer names.

To do this, the backend must find their companies, then find all other officers of those companies.

corporate-connections's People

Contributors

tomrf1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.