Skip to content

Latest commit

 

History

History
283 lines (225 loc) · 10.3 KB

File metadata and controls

283 lines (225 loc) · 10.3 KB

<<<<<<< HEAD = Restcomm JAVA Sdk - Notifications

Notifications

A Notification resource represents a single log entry made by RestComm while handling your calls or your use of the Restful APIs. It is very useful for debugging purposes. The Notifications list resource represents the set of notifications generated for an account.

From here onwards, by a Notification, we refer to a Notification Resource Object

Fetching a Notification

A Notification with a given Sid can be fetched by the following code snippet

  String Sid;
  .
  .
  .
  Notification CallNotification = Notification.getNotification(Sid);

Accessing the Fetched Notification

A Field of a Notification Object can be accessed by using the corresponding getMethod for that Field

  String Message;
  Message = CallNotification.getMessage_text().

List of Fields

Property Method

Sid

getSid().

DateCreated

getDate_created().

DateUpdated

getDate_updated().

AccountSid

getAccount_sid().

CallSid

getCall_sid().

ApiVersion

getApi_version().

Log

getLog().

ErrorCode

getErrorCode().

MoreInfo

getMore_info().

MessageText

getMessage_text().

MessageDate

getMessage_date().

RequestUrl

getRequest_url().

RequestMethod

getRequest_method().

RequestVariables

getRequest_variables().

ResponseHeaders

getResponse_headers().

ResponseBody

getResponse_body().

Uri

getUri().

Fetching List of Notifications

Fetching the Default List

The Default Notifications List can be fetched by using the following code

  NotificationList List = NotificationList.getList();

Fetching a Filtered List

A Filtered Notifications List can be fetched by using the getFilteredList() method of the class NotificationList

  NotificationList List = NotificationList.getFilteredList().ErrorCode("1").MessageText("Hello World").Filter();

The above mentioned code snippet fetches the Notifications with ErrorCode = 1 and MessageText = Hello World

List of FilterParameters

Parameter Method

StartTime

StartTime().

EndTime

EndTime().

ErrorCode

ErrorCode().

MessageText

MessageText().

RequestUrl

RequestUrl().

In addition to these, the regular Paging paramters can also be used similar to the FilterParameters

 NotificationList List = NotificationList.getFilteredList().PageSize("1").Filter().

List of PagingParameters

Paramter Method

Page

Page().

NumPages

NumPages().

PageSize

PageSize().

Total

Total().

Start

Start().

End

End().

Accessing the Fetched NotificationList

The size of the Fetched List can be known by

  int size = CallNotification.size();

The a Notification from the fetched NotificationList Object can be obtained by

  Notification a = CallNotification.get(1);

Additional Paging Information

We can also access the Additional Paging Information by using the Methods of NotificationList

  String Uri;
  Uri = CallNotification.getpreviouspageuri();

The API returns URIs to the next, previous, first and last pages of the returned list as shown in the table below:

Request Parameters

Parameter Method

Uri

geturi().

Firstpageuri

getfirstpageuri().

Nextpageuri

getnextpageuri().

Previouspageuri

getpreviouspageuri().

Lastpageuri

getlastpageuri().

Note
The Default Account from which we fetch the Notifications is the Main Account.

If we want to change the Default Account to any specific SubAccount , use the following method before Fetching the Notification(s)

  NotifactionList.SubAccountAccess(SubAccountSid);
  NotificationList List = NotificationList.getList();

= Restcomm JAVA Sdk - Notifications

== Notifications

A Notification resource represents a single log entry made by RestComm while handling your calls or your use of the Restful APIs. It is very useful for debugging purposes. The Notifications list resource represents the set of notifications generated for an account.

From here onwards, by a Notification, we refer to a Notification Resource Object

=== Fetching a Notification

A Notification with a given Sid can be fetched by the following code snippet

  String Sid;
  .
  .
  .
  Notification CallNotification = Notification.getNotification(Sid);

=== Accessing the Fetched Notification

A Field of a Notification Object can be accessed by using the corresponding getMethod for that Field

  String Message;
  Message = CallNotification.getMessage_text().

==== List of Fields

Property Method

Sid

getSid().

DateCreated

getDate_created().

DateUpdated

getDate_updated().

AccountSid

getAccount_sid().

CallSid

getCall_sid().

ApiVersion

getApi_version().

Log

getLog().

ErrorCode

getErrorCode().

MoreInfo

getMore_info().

MessageText

getMessage_text().

MessageDate

getMessage_date().

RequestUrl

getRequest_url().

RequestMethod

getRequest_method().

RequestVariables

getRequest_variables().

ResponseHeaders

getResponse_headers().

ResponseBody

getResponse_body().

Uri

getUri().

== Fetching List of Notifications

=== Fetching the Default List

The Default Notifications List can be fetched by using the following code

  NotificationList List = NotificationList.getList();

=== Fetching a Filtered List

A Filtered Notifications List can be fetched by using the getFilteredList() method of the class NotificationList

  NotificationList List = NotificationList.getFilteredList().ErrorCode("1").MessageText("Hello World").Filter();

The above mentioned code snippet fetches the Notifications with ErrorCode = 1 and MessageText = Hello World

==== List of FilterParameters

Parameter Method

StartTime

StartTime().

EndTime

EndTime().

ErrorCode

ErrorCode().

MessageText

MessageText().

RequestUrl

RequestUrl().

In addition to these, the regular Paging paramters can also be used similar to the FilterParameters

 NotificationList List = NotificationList.getFilteredList().PageSize("1").Filter().

==== List of PagingParameters

Paramter Method

Page

Page().

NumPages

NumPages().

PageSize

PageSize().

Total

Total().

Start

Start().

End

End().

== Accessing the Fetched NotificationList

The size of the Fetched List can be known by

  int size = CallNotification.size();

The a Notification from the fetched NotificationList Object can be obtained by

  Notification a = CallNotification.get(1);

== Additional Paging Information We can also access the Additional Paging Information by using the Methods of NotificationList

  String Uri;
  Uri = CallNotification.getpreviouspageuri();

The API returns URIs to the next, previous, first and last pages of the returned list as shown in the table below:

=== Request Parameters

Parameter Method

Uri

geturi().

Firstpageuri

getfirstpageuri().

Nextpageuri

getnextpageuri().

Previouspageuri

getpreviouspageuri().

Lastpageuri

getlastpageuri().

Note
The Default Account from which we fetch the Notifications is the Main Account.

If we want to change the Default Account to any specific SubAccount , use the following method before Fetching the Notification(s)

  NotifactionList.SubAccountAccess(SubAccountSid);
  NotificationList List = NotificationList.getList();

>>>>>>> 6f0540ae115c331fea5c5d11c53a855be46eb232