Jump to content

API with Http post


WaQas

Recommended Posts

Hello everyone,

i try to use API with http but i getting Authentication Failed message..

I do all setup

 

1. add IP address

2. Admin have right to access API..

 

but fail to solve the problem..

 

 

 

http://www.yourdomain.com/whmcs/includes/api.php?username=User&password=67f7d93669a0e7d705fe96c7cd7&action=getsupportstatuses&responsetype=xml

 

<?xml version="1.0" encoding="utf-8"?> 
<whmcsapi version="4.4.2"> 
<action></action> 
<result>error</result> 
<message>Authentication Failed</message> 
</whmcsapi>

 

 

 

ANYONE help me out...

Link to comment
Share on other sites

The request is hitting the server correctly and not producing a 404 error. This means that your permissions are wrong or your code is wrong. Are you sure you added the right domain ip to WHMCS API and granted your users API access?

 

Mind sharing the API request call script you are using to get this result? It would help us, help you resolve the problem.

Link to comment
Share on other sites

The request is hitting the server correctly and not producing a 404 error. This means that your permissions are wrong or your code is wrong. Are you sure you added the right domain ip to WHMCS API and granted your users API access?

 

Mind sharing the API request call script you are using to get this result? It would help us, help you resolve the problem.

Hello sir,

Please change the path of yours WHMCS... and you will get the result..

Link to comment
Share on other sites

  • 3 months later...
Hello sir,

Please change the path of yours WHMCS... and you will get the result..

 

 

I have the same problem, with the allowed IP address in the General > Security settings. (one ip per line, and I tried just the single IP of the user whos testing the API)

 

Language vb.net

       Dim WHMCSClient As New WebClient()
       Dim form As New NameValueCollection()
       form.Add("username", "admin")
       form.Add("password", "12345")
       form.Add("action", "getsupportstatuses")
       form.Add("responsetype", "xml")
       Dim responseData As Byte() = WHMCSClient.UploadValues("http://mysite.com/includes/api.php", form)
       Dim pass As String = "12345"
       TextBox1.Text = String.Format("{0}", Encoding.ASCII.GetString(responseData))

 

Returns:

<?xml version="1.0" encoding="utf-8"?>
<whmcsapi version="4.5.2">
<action>getsupportstatuses</action>
<result>error</result>
<message>Authentication Failed</message>
</whmcsapi>

Link to comment
Share on other sites

I have the same problem, with the allowed IP address in the General > Security settings. (one ip per line, and I tried just the single IP of the user whos testing the API)

 

Language vb.net

       Dim WHMCSClient As New WebClient()
       Dim form As New NameValueCollection()
       form.Add("username", "admin")
       form.Add("password", "12345")
       form.Add("action", "getsupportstatuses")
       form.Add("responsetype", "xml")
       Dim responseData As Byte() = WHMCSClient.UploadValues("http://mysite.com/includes/api.php", form)
       Dim pass As String = "12345"
       TextBox1.Text = String.Format("{0}", Encoding.ASCII.GetString(responseData))

 

Returns:

<?xml version="1.0" encoding="utf-8"?>
<whmcsapi version="4.5.2">
<action>getsupportstatuses</action>
<result>error</result>
<message>Authentication Failed</message>
</whmcsapi>

 

Desktop applications are a whole different ball game. You maybe sending your computers IP rather then your internet IP which could cause the error you are getting. As well I hope you are MD5-ing your passwords before they are sent.

 

You may benefit from using the OAuth addon available on my site. This will remove the IP limitation. OAuth returns json rather than XML. I am sure their is a json library available for vb.net somewhere.

Link to comment
Share on other sites

Modified my code, the system requires that you send an MD5 hashed password to the API,otherwise it will not work in plaintext. --- Works just great now. Resolved.

 


form.Add("username", My.Settings.WHMCSUser.ToString())

       'Requires MD5 hash

       form.Add("password", Md5Hash(Crypto.RijndaelSimple.Decrypt(My.Settings.WHMCSPass.ToString(), "5123123123zxczxc!@#", "5123123ASD@", "SHA1", 2, "5585885885852428", 256)))

Public Shared Function Md5Hash(ByVal pass As String) As String
       Dim md5 As System.Security.Cryptography.MD5 = MD5CryptoServiceProvider.Create()
       Dim dataMd5 As Byte() = md5.ComputeHash(Encoding.[Default].GetBytes(pass))
       Dim sb As New StringBuilder()
       For i As Integer = 0 To dataMd5.Length - 1
           sb.AppendFormat("{0:x2}", dataMd5(i))
       Next
       Return sb.ToString()
   End Function

Link to comment
Share on other sites

  • 1 year later...

Hi have the same issue as you cmsplushosting but I am trying to call the API using a browser. Has anybody been able to get past the Authentication Failed Error.

/http://mydomain.co.za/whmcs/includes/api.php?username=api&password=md5hash&action=getclientsproducts&clientid=1&responsetype=xml

 

This is starting to annoy me now, especially since nobody has actually come up with a solution that works.

 

Bottom-line question: Can one call the API from a Browser???

 

Thanking you in advance for your replies.

Edited by Infopro
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated