/IdeathonIot

codes for Ideathon in Baxter

Primary LanguageJava

PACRestService Specifications

The PAC Service schema is defined as below:

  • basePath: /delegate
  • schemes: [https]

Endpoint URL: /pulse

Method: POST

Success Response:

  • Code: 200
  • Content: {patientId: 1000003, activationCode: 1000067620, regionCode: R1}
    • Match all:
      • Pass JWT verification
      • Pass parameters value verify
      • Find activation code

Error Response:

  • Code: 404 NOT FOUND

  • Content: { error: "Patient Activation Code 1000067621 doesn't exist" }

    • Match:
      • Fail to find Patient Activation code.
  • Code: 400 INVALID REQUEST

  • Content: { error: "Invalid request, check parameters or token payload." }

    • Match One of them:
      • Fail to verify require information in JWT payload.
      • Fail to verify JWT signature
      • Fail to verify JWT issuer
      • Fail to verify JWT expiration
      • Fail to verify JWT audience
      • Pass non-applicable parameter values
  • Code: 403 FORBIDDEN

  • Content: { error: "You don't have permissions to access this resource." }

    • Match:
      • Failed on JWT verification for endpoint access.
  • Code: 500 INTERNAL SERVER ERROR

  • Content: {error: "Internal Server Error. Please try again later."}

    • Match:
      • Any runtime exception.

Sample Call:

$.ajax({

    url: localhost:8091/delegate/,

    dataType: json,

    type : POST,

    success : function(data) {

     console.log(data);

    }

});

How to run:

  • Command line (JAVA 8 must be installed)
    • mvn clean install
    • cd target
    • java -jar "target/NH-PMA-PACRestService-Service.jar" --spring.profiles.active=development