App Status URL endpoint
This endpoint is expected to be invoked by AMS or a product to inquire application status
Service URL
<app-base-url><app-status-url>
These URLs are registered with AMS when creating an app.
Request Method
GET
Request Header
Authorization: Bearer <JWT>
Content-Type=application/json
JWT claims
In the case where it is AMS making the request to the App, the key and value pairs bear the following meanings:
Key | Value Definition | Context |
---|---|---|
iss
|
The issuer of the token. | The App's Token Key. |
sub
|
The subject of the token. | Set to the app's associated product uuid. |
aud
|
The audience of the token. | The App Provider Token Key. |
exp
|
The date and time the token will expire, expressed as a Unix timestamp. Must be after the current date/time. | Set to 60 seconds after the JWT was created. |
iat
|
The date and time the JWT was issued, expressed as a Unix timestamp. | Set to the current time. |
jti
|
The unique identifier for the JWT token | Set to a random UUID |
Sample JWT Payload
Below is an example JWT payload that AMS uses to call the application status endpoint:
{
"iss": "ams",
"sub": null,
"aud": "03a22eb2-537b-471c-bf2b-2055e2f71618",
"exp": 1507072485000,
"iat": 1506964485000,
"jti": null
}
Sample Response in case of success
{
"info": {
"name": "Demo App"
},
"warnings": [],
"errors": [],
"services": [
{
"info": {
"name": "Demo App Service"
},
"warnings": [],
"errors": []
}
]
}
Sample Code
@GetMapping("/status")
public ResponseEntity<ApplicationStatus> getApplicationStatus(){
//get Application & service status from desired source and set the status
ApplicationStatus applicationStatus = new ApplicationStatus();
applicationStatus.getInfo().setName("Application Name");// Set Application Name
//set errors or warning for application, if any (both are Array of string)
applicationStatus.setErrors(Collections.EMPTY_LIST);
applicationStatus.setWarning(Collections.EMPTY_LIST);
//set all service status
ServiceStatus serviceStatus = new ServiceStatus();
serviceStatus.getInfo().setName("serviceName");
//set errors or warning for service, if any (both are Array of string)
serviceStatus.setErrors(Collections.EMPTY_LIST);
serviceStatus.setWarning(Collections.EMPTY_LIST);
applicationStatus.setServiceStatus(Arrays.asList(serviceStatus));
return new ResponseEntity<>(applicationStatus, HttpStatus.OK);
}