Giter Club home page Giter Club logo

callerid's Introduction

callerid

Caller ID API Service.

This service responds to requests for caller ID information. Presently, adding or retrieving Caller ID info is supported. The API listens on port 8080 by default, and can be overridden with the PORT environment variable.

Note that from the seed data, numbers in (XXX) XXX XXXX get converted to E.164 format of +1XXXXXXXXXX.

Endpoints

GET /query

Fetches caller ID information.

Params: number - the number we want caller ID information for.

Example: GET http://localhost:8080/query?number=%2B15556789090

Curl Example:

curl -H 'Content-Type: application/json; charset=utf-8' http://localhost:8080/query?number=%2B15556789090

Response:

{results: [{ “name”: “Bob Barker”, “number”: “+15556789090”, “context”: “personal”}]}

Reponse Codes:

  • 200 - Successfull query
  • 404 - Phone Number Not Found

POST /number

Adds caller ID data to the service.

POST Body:

  • name - contact name
  • number - the number in E.164 format
  • context - the context for the phone number.

Note: A phone number may be present multiple times, but can only appear once per context. In other words you can think of a <number,context> pair as unique.

The project spec didn't specify that the POST body must be a JSON string so we're doing a standard HTTP POST body here.

Curl Example:

curl -d "name=Donald%20Knuth&number=+15555551212&context=personal" http://localhost:8080/number

Response Codes:

  • 200 - Success: The caller ID info was successfully entered
  • 409 - Conflict: A record with this number and context already exists
  • 400 - Bad Request: A required parameter is missing

Running Tests

In order to run tests, leiningen must be installed, then run:

lein test

Running

With leiningen

To start a web server for the application, run:

lein run

To force the application to listen on an alternate port:

PORT=8081 lein run

Standalone

From the root of the project, run:

lein uberjar
./bin/startup.sh

With an alternate port:

PORT=8081 ./bin/startup.sh

License

Copyright © 2017 Jason Stewart

callerid's People

Stargazers

Kelly avatar

Watchers

Jason Stewart avatar James Cloos 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.