Git Product home page Git Product logo

api-notification-queue's Introduction

API Notification Queue

Build Status Download

Introduction

This service provides a means to persist and retrieve notifications. The upstream client is the api-notification-pull service.


Endpoints

POST /queue

Payload must be text based, e.g. XML. When each notification is put onto the queue database, a unique id will be generated. This id will be used later for deleting the notification once forwarded. Either the X-Client-ID or the api-subscription-fields-id header must be included in the request. If the api-subscription-fields-id is supplied, the Client ID will be retrieved from the api-subscription-fields service.

curl -v -X POST \
  http://localhost:9648/queue \
  -H 'Accept: application/xml' \
  -H 'Content-Type: application/xml' \
  -H 'X-Client-ID: pHnwo74C0y4SckQUbcoL2DbFAZ0b' \
  -d '<xml>foo</xml>'

Response

201 Created status and the Location header will contain the URL, e.g. /notification/ba544f92-b2dd-413e-becf-874b35eb3724.


GET /notification/[id]

Retrieves a specific notification.

Required header: X-Client-ID.

curl -v -X GET "http://localhost:9648/notification/ba544f92-b2dd-413e-becf-874b35eb3724" \
  -H "X-Client-ID: pHnwo74C0y4SckQUbcoL2DbFAZ0b"

Response

200 OK code on successful get, otherwise 404 Not Found. Note that all headers in the above POST are replayed in the response with the exception of X-Client-ID.


GET /notifications

Gets all notifications of a specific third-party application.

Required header: X-Client-ID.

curl -v -X GET "http://localhost:9648/notifications" \
  -H "X-Client-ID: pHnwo74C0y4SckQUbcoL2DbFAZ0b"

Response

200 OK code.


DELETE /notification/[id]

Deletes a specific notification.

Required header: X-Client-ID.

curl -v -X DELETE "http://localhost:9648/notification/ba544f92-b2dd-413e-becf-874b35eb3724" \
  -H "X-Client-ID: pHnwo74C0y4SckQUbcoL2DbFAZ0b"   

Response

204 No Content on successful delete, otherwise 404 Not Found.


Tests

Some tests require MongoDB to run. Thus, remember to start up MongoDB if you want to run the tests locally. There are unit tests, integration tests, acceptance tests and code coverage reports. In order to run them, use this command line:

./run_all_tests.sh

License

This code is open source software licensed under the Apache 2.0 License

api-notification-queue's People

Contributors

googley42 avatar gokyo avatar tobias1087 avatar hmrc-web-operations avatar cichockimc 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.