From the course: Calling REST APIs with Java

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Twilio API

Solution: Twilio API - Java Tutorial

From the course: Calling REST APIs with Java

Start my 1-month free trial

Solution: Twilio API

(upbeat music) - [Narrator] So, how did the challenge go, did you enjoy it? Let's take a look at one way to solve the problem. I started my work within the Twilio client interface. And here, I created a new method named sendTextMessage. On top of this method, I annotated it with the headers annotation and the request line annotation. Inside of the headers annotation I specified the content type header and used the mime type to specify we were sending form data. Inside of the request line annotation, I indicated I would be sending an HTTP post and then added the path to the messages resource. Now, inside of this path, there is a template expression that I had to provide a value for. So, to do that, I used the param annotation and put that on the first parameter in the method signature. Now, I also needed to send additional information like to, from, and body over to Twilio to send the text message. I added parameters for those as…

Contents