Difference between revisions of "NoAuth usecase 3"

From i2Rest
Jump to: navigation, search
Line 10: Line 10:
 
   OUTPUT(*BOTH)  
 
   OUTPUT(*BOTH)  
 
   DCMCLIENT(MYCLIENT)
 
   DCMCLIENT(MYCLIENT)
   RECVLOG('/home/btpl/recvnex.log')  
+
   RECVLOG('/home/logs/recvnex.log')  
   SENTLOG('/home/btpl/sentnex.log')  
+
   SENTLOG('/home/logs/sentnex.log')  
 
   AUTHMETHOD(*NONE)                                   
 
   AUTHMETHOD(*NONE)                                   
 
    
 
    

Revision as of 21:06, 21 May 2020

Such a common task as SMS confirmation or any type of Viber/Whatsapp messages can be solved pretty easy with the help of numerous web services. Now we will show you how to send SMS from the green screen with the only command using i2Rest client. Two things we have to take care before start messaging:

registration on Nexmo.com
adding Nexmo.com SSL certificate CA to your DCM - see "how to" instructions

When the preparations are completed, all we have to do - is just compose our POST request following the instructions. And here is our i2Rest client command:

 I2REST COMMAND(*POST) URL('https://rest.nexmo.com/sms/json') 
 BODY(*N 'api_key=<your_nexmo_api_secret>&api_secret=<your_nexmo_api_secret>&from=Vonage%20SMS%20API&to=<your_telephone_number>
   &text=Hello%20from%20i2Rest' 'application/x-www-form-urlencoded') 
 OUTPUT(*BOTH) 
 DCMCLIENT(MYCLIENT)
 RECVLOG('/home/logs/recvnex.log') 
 SENTLOG('/home/logs/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":"<your_nexmo_api_key"api_secret":"<your_nexmo_api_secret>", "from":"Vonage SMS API",  "to":"<your_telephone_number>",
   "text":"Hello from i2Rest"}' 'application/json') 
 OUTPUT(*BOTH) 
 DCMCLIENT(MYCLIENT)
 RECVLOG('/home/logs/recvnex.log') 
 SENTLOG('/home/logs/sentnex.log') 
 AUTHMETHOD(*NONE) 

Let's see server response in joblog
Хорошо бы замазать номер телефона -> Noauth3-1.png


Was it your phone ring? Check it.
Хорошо бы убрать текст "5 мин." -> Noauth3-2.png