HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Customer.getRequests Api method, sPassword parameter


#1

hello,

I am trying to use some of the Api public methods.

they seem to work but I have problems with customer.getRequests. this method need two parameters: sEmail and sPassword.

I guess sEmail should be the email of the customer that have inserted a ticket, while sPassword should be the random six letter string that is appended to the ticket number to have the Access key.

anyway when calling this method and passing these parameters I obtain this error: “Email or password not valid”.

To be safe I copied/pasted both parameters from the result of a call to another Api method, request.get, passing also the AccessKey.

so, for instance, if my ticket Access key is 12345abcdef I’ll call the method this way:

http://helpspot.example.com/api/index.php?method=customer.getRequests&sEmail=me@customeraddress.tld&sPassword=abcdef

is this the correct way to do it?

I also tried using the full Access key as sPassword:

http://helpspot.example.com/api/index.php?method=customer.getRequests&sEmail=me@customeraddress.tld&sPassword=12345abcdef

but I still obtained the error.

thanks.


#2

Hi, the sPassword parameter isn’t the access key for the request (an access key isn’t valid here as this API method returns all requests for a particular customer :slight_smile: ). Instead, it’s the customer’s portal password.


#3

Hi Andrews, thanks.

our users do not pass through the portal, so I guess I can use this private api method:

private.customer.getPasswordByEmail

anyway, I am having troubles with passing authentication data to Curl using php.

could you provide me some copy and paste sample to use?

many thanks,

L.


#4

Hi Luca,

Why don’t you use the the “private.request.search” method to pull back all requests based on the criteria you want, i.e. all requests from a particular email address? Otherwise you’d be using two calls - one to get the user’s portal password, and another to get the requests. That is, if I understand what you’re trying to pull back.

I’m afraid I’m not familiar with Curl, although I see a brief example on the KB article below:

http://www.userscape.com/helpdesk/index.php?pg=kb.page&id=164#private.request.search


#5

thanks Andrew, private.request.search seem to be more useful.

actually I am just making some random try to help myself understand practically how the whole system work.

the problems I had were with passing authentication credentials to curl.

I’ll copy and paste some php code I successfully use to call the private method just in case someone else has similar problems:

$url = “http://example.com/api/index.php?method=private.request.search&sEmail=someone@somewhere.tld”;

$curl = curl_init();
curl_setopt($curl, CURLOPT_USERPWD, ‘me@example.com: mypassword’);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($curl);


#6

Thanks for all the great information guys.

One thing that may be on interest to you both is that we’re currently working on a PHP framework for working with the HelpSpot API. This will make doing so much easier (for PHP users) as it implements all the HTTP components for you, provides an error framework and much more. It’s still very very early, but we hope to have it available in a few months.