Difference between revisions of "NoAuth usecase 3"
Pavel.lobko (talk | contribs) |
Pavel.lobko (talk | contribs) |
||
| Line 6: | Line 6: | ||
When the preparations are completed, all we have to do - is just compose our POST request following the [https://developer.nexmo.com/api/sms instructions]. | When the preparations are completed, all we have to do - is just compose our POST request following the [https://developer.nexmo.com/api/sms 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 <code>application/json</code> request body. The command should look like this | |
I2REST COMMAND(*POST) URL('https://rest.nexmo.com/sms/json') | I2REST COMMAND(*POST) URL('https://rest.nexmo.com/sms/json') | ||
BODY(*N '{"api_key":"40a45a89", "api_secret":"EN8AHxD6fOd1jvWD", "from":"Vonage SMS API", "to":"375297784290", | 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') | "text":"Hello from i2Rest"}' 'application/json') OUTPUT(*BOTH) DCMCLIENT(MYCLIENT) RECVLOG('/home/btpl/recvnex.log') | ||
| − | SENTLOG('/home/btpl/sentnex.log') AUTHMETHOD(*NONE) | + | SENTLOG('/home/btpl/sentnex.log') AUTHMETHOD(*NONE) |
| + | |||
| + | Let's see server response in joblog | ||
| + | [[File:Noauth3-1.png:300px]] | ||
| + | |||
Was it your phone ring? Check it.<br> | Was it your phone ring? Check it.<br> | ||
[[File:Noauth3-2.png]] | [[File:Noauth3-2.png]] | ||
| + | |||
| + | |||
---- | ---- | ||
[[I2Rest_Client|Back to i2Rest Client]] | [[I2Rest_Client|Back to i2Rest Client]] | ||
Revision as of 15:12, 12 April 2020
Two things we have to take care beforestart messaging:
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 File:Noauth3-1.png:300px
Was it your phone ring? Check it.