recursive.codes

recursive.codes

recursive.codes


The Personal Blog of Todd Sharp

Ring Central - Create A Glip Team

Posted By: Todd Sharp on 2/21/2020 1:19 GMT
Tagged: APIs, Java

In my last post, I showed you how to make a voice call with Java and Ring Central. In this post, I'll show you how to create your first Glip team. If you get stuck, refer to the developer portal docs, but it's pretty simple.

As always, first include the dependency:

compile 'com.ringcentral:ringcentral:1.0.0-beta10'

Next, in your class, set some variables:

static String RECIPIENT_NUMBER = "<ENTER PHONE NUMBER>";
static String RINGCENTRAL_CLIENTID = "<ENTER CLIENT ID>";
static String RINGCENTRAL_CLIENTSECRET = "<ENTER CLIENT SECRET>";
static String RINGCENTRAL_SERVER = "https://platform.devtest.ringcentral.com";
static String RINGCENTRAL_USERNAME = "<YOUR ACCOUNT PHONE NUMBER>";
static String RINGCENTRAL_PASSWORD = "<YOUR ACCOUNT PASSWORD>";
static String RINGCENTRAL_EXTENSION = "<YOUR EXTENSION, PROBABLY '101'>";
static RestClient restClient;
view raw rcjava1.java hosted with ❤ by GitHub

Create an instance of the client:

try {
restClient = new RestClient(RINGCENTRAL_CLIENTID, RINGCENTRAL_CLIENTSECRET, RINGCENTRAL_SERVER);
restClient.authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);
}
catch (RestException | IOException e) {
e.printStackTrace();
}
view raw rcjava2.java hosted with ❤ by GitHub

Now you're ready to create the team:

var parameters = new GlipPostTeamBody();
parameters._public = true;
parameters.name = "Fun team";
parameters.description = "Let chit chat here";
HashMap<String, String> members = new HashMap<String, String>();
members.put("email", "member.1@gmail.com");
members.put("email", "member.2@gmail.com");
parameters.members = new HashMap[] { members };
var response = restClient.restapi().glip().teams().post(parameters);
String jsonStr = JSON.toJSONString(response);
System.out.println(jsonStr);
view raw rc-glip.java hosted with ❤ by GitHub
 
MakeRingOutRequest requestBody = new MakeRingOutRequest();
requestBody.from(new MakeRingOutCallerInfoRequestFrom().phoneNumber(RINGCENTRAL_USERNAME));
requestBody.to(new MakeRingOutCallerInfoRequestTo().phoneNumber(RECIPIENT_NUMBER));
requestBody.playPrompt = false;
var response = restClient.restapi().account().extension().ringout().post(requestBody);
System.out.println("Call Placed. Call status: " + response.status.callStatus);
view raw rcjava4.java hosted with ❤ by GitHub

And that's all it takes to create a Glip team with Ring Central and Java. You can learn more about Glip here.

Image by SoapWitch from Pixabay


Share Facebook Twitter Pinterest LinkedIn Messenger WhatsApp Viber Telegram Tumblr Reddit Pocket Email SMS

Related Posts

Querying Autonomous Database from an Oracle Function (The Quick, Easy & Completely Secure Way)

Querying Autonomous Database from an Oracle Function (The Quick, Easy & Completely Secure Way)

I've written many blog posts about connecting to an Autonomous DB instance in the past. Best practices evolve as tools, services, and frameworks become...

Sending Email With OCI Email Delivery From Micronaut

Sending Email With OCI Email Delivery From Micronaut

Email delivery is a critical function of most web applications in the world today. I've managed an email server in the past - and trust me - it's not fun...

Brain to the Cloud - Part III - Examining the Relationship Between Brain Activity and Video Game Performance

Brain to the Cloud - Part III - Examining the Relationship Between Brain Activity and Video Game Performance

In my last post, we looked at the technical aspects of my Brain to the Cloud project including much of the code that was used to collect and analyze the...

Note: Comments are currently closed on this blog. Disqus is simply too bloated to justify its use with the low volume of comments on this blog. Please visit my contact page if you have something to say!