1

I am trying to include SMS sending feature in my project. For this I am trying the below html form :

<form enctype="application/json" authorization="Basic VVRTSE9MYWIyOTg6cmFoYXQyMjE=" method="post" action="http://107.20.199.106/restapi/sms/1/text/single" >

<input name="from" type="text" value="UTSHOLab298" /> 
<input name="to" type="number" value="8801737513858" />
<textarea name="text" required >My first SMS</textarea>
<input type="submit" value="Send SMS" required />

</form>

And I need to make a request like:

    POST /restapi/sms/1/text/single HTTP/1.1
    Host: 107.20.199.106
    Authorization: Basic VVRTSE9MYWIyOTg6cmFoYXQyMjE=
    Content-Type: application/json
    Accept: application/json

    {  
   "from":"UTSHOLab298",
   "to":"8801737513858",
   "text":"My first SMS"
    }

Now I can't understand what will be the code to to make a request like that and send my sms to desired Mobile number when submitting the form.

And also I want to receive the response and show to user. The response will be like:

HTTP/1.1 200 OK
Content-Type: application/json

{  
   "messages":[  
      {  
         "to":"8801737513858",
         "status":{  
            "id":0,
            "groupId":0,
            "groupName":"ACCEPTED",
            "name":"MESSAGE_ACCEPTED",
            "description":"Message accepted"
         },
         "smsCount":1,
         "messageId":"2250be2d4219-3af1-78856-aabe-1362af1edfd2"
      }
   ]
}

Now I am requesting anyone to help me to solve the coding. Thanks.

Rahat Vuban
  • 49
  • 10

0 Answers0