Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

Get Notification by ID

GET /notification/status/{project}/{clientId}/{notificationID}

The get Notifications endpoint retrieves a single notification associated with a client in a specified project.

Path Parameters

Name

Type

Required

Description

{project}

string

Yes

The name of the project where the client is going to be searched on.

{clientId}

string

Yes

Id assigned to a client.

{notificationID}

string

Yes

ID assigned to a notification.

Response

{
    "notifications": [
        {
            "channel": "",
            "clientId": "",
            "notificationId": "",
            "msg": "",
            "notificationDate": "",
            "project": "",
            "status": "",
            "templateId": "",
            "templateParams": ",
            "to": ""
        }
    ]
}

Parameter Name

Type

Description

project

string

Reference project to send notifications. This allows the app to store data in a different data persistence tool.

Supported values:

  • LAC-FP

clientId

string

Could be:

  • ID associated to a DHIS2 TrackedEntityInstance.

  • _id associated to a mongoDB client document.

msg

string

Message to be linked to the notification.

channel

string

Way of communication where the scheduled message will be sent:

Current supported values:

  • facebook

  • whatsapp

  • SMS

to

string

Identifier used by the specified channel to send the message.

templateID

string

Identifier used by the specified channel to use a pre-defined template.

templateParams

string

Parameters to be used in the template specified.

notificationDate

string

Date on which the notification will be sent.

status

string

Current status of the notification

Responses

200: Success

{
  "notifications": [
    {
      "channel": "facebook",
      "clientId": "CEWRFqwe123",
      "notificationId": "aosfACOaqw213",
      "msg": "Created from openHIM 22",
      "notificationDate": "2024-02-19T10:15:08.093",
      "project": "LAC-FP",
      "status": "canceled",
      "templateId": "template_4",
      "templateParams": "{\"quick_replies\":[{\"content_type\":\"text\",\"image_url\":\"http://example.com/img/red.png\",\"payload\":\"<POSTBACK_PAYLOAD>\",\"title\":\"Red\"},{\"content_type\":\"text\",\"image_url\":\"http://example.com/img/green.png\",\"payload\":\"<POSTBACK_PAYLOAD><\",\"title\":\"Green\"}],\"text\":\"Pick a color:\"}",
      "to": "123456767"
    }
  ]
}

404: Not Found. Request was procesed but entity was not found.

{
  "timestamp": "2024-02-29T04:12:17.603Z",
  "statusCode": 404,
  "message": "Client, project or notification not found.",
  "errors": []
}

409: Conflict. Request was processed but resource was not found.

{
  "timestamp": "2024-02-29T04:17:07",
  "statusCode": 409,
  "message": "Tracked entity instance is specified but does not exist: cMyjKYJtgSIasdasd",
  "errors": [
    {
      "httpStatus": "Conflict",
      "httpStatusCode": 409,
      "status": "ERROR",
      "message": "Tracked entity instance is specified but does not exist: cMyjKYJtgSIasdasd"
    }
  ]
}

500: Internal Server Error.

{
  "timestamp": "2024-02-29T04:26:43.447Z",
  "statusCode": 500,
  "message": "Request failed with status code 500",
  "errors": [
    "<!doctype html><html lang=\"en\"><head><title>HTTP Status 500 – Internal Server Error</title><style type=\"text/css\">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 500 – Internal Server Error</h1><hr class=\"line\" /><p><b>Type</b> Exception Report</p><p><b>Message</b> The request was rejected because the URL contained a potentially malicious String &quot;;&quot;</p><p><b>Description</b> The server encountered an unexpected condition that prevented it from fulfilling the request.</p><p><b>Exception</b></p><pre>org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String &quot;;&quot;\n\torg.springframework.security.web.firewall.StrictHttpFirewall.rejectedBlocklistedUrls(StrictHttpFirewall.java:535)\n\torg.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:505)\n\torg.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:210)\n\torg.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:190)\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)\n\torg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)\n\torg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:354)\n\torg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:267)\n\torg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)\n\torg.springframework.orm.hibernate5.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:156)\n\torg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)\n</pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class=\"line\" /><h3>Apache Tomcat/8.5.98</h3></body></html>"
  ]
}

  • No labels