Java Helper

The Plivo Java SDK makes it simpler to integrate communications into your Java applications using the Plivo REST API. Using the SDK, you will be able to make voice calls, send SMS and generate Plivo XML to control your call flows.

Supported Java versions: This SDK works with Java 1.8 & 1.9 i.e., JDK 8 and JDK 9. While using the SDK with Java 1.9, you may have to use the –add-modules java.se.ee flag to include modules that are no longer present by default.

Getting started

Authentication

We recommend that you store your credentials in the PLIVO_AUTH_ID and the PLIVO_AUTH_TOKEN environment variables, so as to avoid the possibility of accidentally committing them to source control. If you do this, you can initialise the client with no arguments and it will automatically fetch them from the environment variables:

classExample{publicstaticvoidmain(String[]args){Plivo.init();}}

Alternatively, you can provide these to Plivo.init()’s constructor yourself:

Using Resource.lister().list() would list the first 20 resources by default (which is the first page, with limit as 20, and offset as 0). To get more, you will have to use limit and offset to get the second page of resources.

To list all objects of any resource, simply use the request object itself as an iterable: