admin is invalid account_id ?

Talk with others about developing applications for Switchvox

Moderators: bmdhacks, dpodolsky, tristand, jwitt, joshuas

admin is invalid account_id ?

Postby cunimb » Fri Apr 06, 2012 9:31 am

Hello,

Sorry, but I started with Switchvox and does not communicate well in English. Thank you in advance for your understanding.

I'm just trying to connect to the PBX using the example provided in the documentation page: http://developers.digium.com/switchvox/?pageView=phpLibrary

If I use the username and password admin, the answer is:

Code: Select all
SwitchvoxResponse Object ( [apiStatus:private] => fault [apiErrors:private] => Array ( [error] => Array ( [0] => Array ( [code] => 84711 [message] => That account_id is invalid. ) [1] => Array ( [code] => 84711 [message] => That account_id is invalid. ) ) ) [apiResult:private] => Array ( ) [rawXML:private] => )


If I use a code and a user password, the answer is: You do not Have the proper permissions to run That API method

I do not know what to do.

Can you help me ?

Thank you.
cunimb
Newsterisk
 
Posts: 8
Joined: Fri Apr 06, 2012 8:36 am

Re: admin is invalid account_id ?

Postby dpodolsky » Fri Apr 06, 2012 9:41 am

What API are you trying to call? We have APIs for admins and we have APIs for users.

If you are calling the admin API then try using the superadmin ("admin") for your API requests. If that works, then it might be that you haven't granted the subadmin the proper permissions in the product.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: admin is invalid account_id ?

Postby cunimb » Fri Apr 06, 2012 10:12 am

Thank you very much for your quick response.
For now, I simply try to discover how to interact with the IPBX. I just follow the advice given on the site. I'm progressing slowly.
The example I am using is:
Code: Select all
require_once ("SwitchvoxRequest.php");
$ request = new SwitchvoxRequest ("YOUR.PBX.IP.OR.HOSTNAME", "admin", "admin.password");
$ requestParams = array ('account_ids' => array ('account_id' => array (1101, 1102)));
$ response = $ request-> send ("switchvox.extensions.getInfo", $ requestParams);
print_r ($ response);

I still do not understand if I must call an API user or API administrator.
My first goal, when I understand a little better, will recover the statistics of connections from a php script to integrate them into an intranet.
Again thank you for your help.
cunimb
Newsterisk
 
Posts: 8
Joined: Fri Apr 06, 2012 8:36 am

Re: admin is invalid account_id ?

Postby dpodolsky » Fri Apr 06, 2012 10:16 am

That all looks correct. I would just make sure you are using the correct password for your "admin" account.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: admin is invalid account_id ?

Postby cunimb » Fri Apr 06, 2012 11:27 am

The password I use is the password that allows me to connect to the administration part of Switchbox.
Does your answer is that it is correct that the Switchbox replied still "account_id is invalid"?
cunimb
Newsterisk
 
Posts: 8
Joined: Fri Apr 06, 2012 8:36 am

Re: admin is invalid account_id ?

Postby dpodolsky » Mon Apr 09, 2012 1:05 pm

If you are getting an "account_id is invalid" error then you probably don't have those accounts on your system. 1101 and 1102 are on the demo but might not be on your system. Try to run a extensions getList to get the list of valid accounts on your system and use one of those ids.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: admin is invalid account_id ?

Postby cunimb » Tue Apr 10, 2012 3:48 am

Thank you very much for your advice.
When I found that my request was unanswered, I replaced 1101 and 1102 for existing accounts on my system, but nothing has changed.
I'll try running a extensions.getList.
cunimb
Newsterisk
 
Posts: 8
Joined: Fri Apr 06, 2012 8:36 am

Re: admin is invalid account_id ?

Postby cunimb » Tue Apr 10, 2012 8:39 am

If I run :
<?php
require_once("SwitchvoxRequest.php");
$request = new SwitchvoxRequest ("MY.PBX.IP.OR.HOSTNAME", "admin", "admin.password");
$response = $request->send("switchvox.extensions.getList", "");
print_r($response);
?>

the answer is :
SwitchvoxResponse Object ( [apiStatus:private] => fault [apiErrors:private] => Array ( [error] => Array ( [code] => 10005 [message] => Your requested method (switchvox.extensions.getList) was not found. ) ) [apiResult:private] => Array ( ) [rawXML:private] => )

Did I make a mistake ?

Thank you in advance for your help.
cunimb
Newsterisk
 
Posts: 8
Joined: Fri Apr 06, 2012 8:36 am

Re: admin is invalid account_id ?

Postby dpodolsky » Tue Apr 10, 2012 9:17 am

Sorry. There isn't a getList. Use switchvox.extensions.search to get a list of extensions and their account Ids on the system:

http://developers.digium.com/switchvox/ ... ons.search
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: admin is invalid account_id ?

Postby cunimb » Tue Apr 10, 2012 10:18 am

By running a switchvox.extensions.search I realized that I indicated the extension number and not the account_id.
(I'd just do it before reading your message).
Now things are clearer.
Thank you for your patience dpodolsky :)
cunimb
Newsterisk
 
Posts: 8
Joined: Fri Apr 06, 2012 8:36 am


Return to Switchvox Developers

Who is online

Users browsing this forum: No registered users and 1 guest