Difference between revisions of "NoAuth usecase 3"

From i2Rest
Jump to: navigation, search
Line 1: Line 1:
 
{{DISPLAYTITLE:Sending SMS via Vonage APIs}}
 
{{DISPLAYTITLE:Sending SMS via Vonage APIs}}
  
Two things we have to take care beforestart messaging:
+
Two things we have to take care before start messaging:
 
: [https://www.nexmo.com registration on Nexmo.com]
 
: [https://www.nexmo.com registration on Nexmo.com]
 
: [[adding SSL certificate]]
 
: [[adding SSL certificate]]

Revision as of 15:26, 12 April 2020


Two things we have to take care before start messaging:

registration on Nexmo.com
adding SSL certificate

When the preparations are completed, all we have to do - is just compose our POST request following the instructions.

 I2REST COMMAND(*POST) URL('https://rest.nexmo.com/sms/json') 
 BODY(*N 'api_key=40a45a89&api_secret=EN8AHxD6fOd1jvWD&from=VonageSMS API&to=375297784290
 &text=Hello from i2Rest' 'application/x-www-form-urlencoded') OUTPUT(*BOTH) DCMCLIENT(MYCLIENT)
 RECVLOG('/home/btpl/recvnex.log') SENTLOG('/home/btpl/sentnex.log') AUTHMETHOD(*NONE)                                   
 

The same result can be also achieved with application/json request body. The command should look like this

 I2REST COMMAND(*POST) URL('https://rest.nexmo.com/sms/json')
 BODY(*N '{"api_key":"40a45a89", "api_secret":"EN8AHxD6fOd1jvWD", "from":"Vonage SMS API",  "to":"375297784290",
 "text":"Hello from i2Rest"}' 'application/json') OUTPUT(*BOTH) DCMCLIENT(MYCLIENT) RECVLOG('/home/btpl/recvnex.log') 
 SENTLOG('/home/btpl/sentnex.log') AUTHMETHOD(*NONE) 

Let's see server response in joblog
Noauth3-1.png


Was it your phone ring? Check it.
Noauth3-2.png




Back to i2Rest Client