Android Question How to invoke an API

Discussion in 'Android Questions' started by Juzer Hussain, Jun 18, 2015.

  1. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi Eril,

    I am now a member.Just trying to get the hang of B4A to convert my library for android. Pls tell me how to call API and get the response in a variable.Following is the API.
    http://59.161.167.52/api/MessageCompose?admin=admin@yahoo.com&user=" & sUser & ":" & sPwd & "&senderID=" & sSenderID & "&receipientno=" & sNo & "&msgtxt=" & sMsg & "&state=4"

    Thanks
     
  2. lemonisdead

    lemonisdead Well-Known Member Licensed User

    Last edited: Jun 18, 2015
    Johan Schoeman and DonManfred like this.
  3. Juzer Hussain

    Juzer Hussain Active Member Licensed User

  4. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi,
    I tried this way it say connection refused.
    Error: org.apache.http.conn.HttpHostConnectException: Connection to http://59.162.167.52 refused
    I have supplied each variable a value in key value pair.

    Sub Button1_Click
    Dim job1 As HttpJob
    job1.Initialize(job1,Me)
    job1.Download2("http://59.162.167.xx/api/MessageCompose", Array As String("admin", "xx" , "user", "xx:xx","senderID","STVPSB","receipientno","9827973052","msgtxt","This is a test msg from App","state","4"))

    This is an API which i use to send SMS from VB.Net.It goes smoothly. No username or pwd required other than this.

    Pls guide me.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It seems like some network problem. Are you testing it on a real device? Is the device connected to the internet?
     
  6. Juzer Hussain

    Juzer Hussain Active Member Licensed User


    I m trying with USB Debugging, There is no network problem.
    I thought this would be pretty straightforward.
    Is there any way to create Microsoft.xmlHTTP object so i can use Send method as in VB.Net

    Juzer
     
  7. Juzer Hussain

    Juzer Hussain Active Member Licensed User

    Hi Erel,

    Sorry.....,My internet was loosing network intermittently.
    Now its working ok.Internet was the problem.

    Thanks

    Juzer
     
Loading...