API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Connect to specific database in an administrator agreement?

0
Hi

My PHP API connection source code is working fine when I want to connect to a normal agreement (one account database) doing it the old way like this:

try {
        $client = new SoapClient(https//apie-conomiccom/secure/api1/EconomicWebserviceasmx?WSDL, array(trace = 1, exceptions = 1));

        $client-Connect(array(
            'agreementNumber' = $agreement_number,
            'userName' = $user_name,
            'password' = $password
        ));
    } catch (SoapFault $fault) {
        trigger_error(sprintf(Soap fault %s - %s, $fault-faultcode, $fault-faultstring), E_USER_ERROR);
    }

But when I want to connect to a specific accounting database in an administrator agreement I need 3 more parameters. Like:

Token
App_Token
Accounting Database

I tried with this code but it is not recognizing the 3 new parameters:

try {
        $client = new SoapClient(https//apie-conomiccom/secure/api1/EconomicWebserviceasmx?WSDL, array(trace = 1, exceptions = 1));

        $client-Connect(array(
            'agreementNumber' = $agreement_number,
            'userName' = $user_name,
            'password' = $password,
            'token' = $token,
            'appToken' = $app_token,
            'database' = $database
        ));
    } catch (SoapFault $fault) {
        trigger_error(sprintf(Soap fault %s - %s, $fault-faultcode, $fault-faultstring), E_USER_ERROR);
    }

Furthermore my client that I am trying to assist is getting this error when trying to grade access via the new token / grading system:



I got the impression that new token / grading system would offer this access for administrator agreements? What to do now?  I have been stuck for some days.
created Mar 14, 2013 by Jens Kirk
14% Accept Rate
Q 15 A 9 C 7

2 Answers

0
Hi Jens,

It isn't possible for an administrator account to use the API. Each individual account has to enable access to the app in question.

In addition you need to use the ConnectWithToken method:
http://e-conomic.github.com/eco-api-sdk ... Token.html
answered Mar 19, 2013 by rbb
0
Hi Jens,

I have a little correction to the answer I just gave you. You can connect as administrator by using the method ConnectAsAdministrator:

http://www.e-conomic.com/apidocs/Docume ... rator.html

But this will not give you access to administrator tools. It is just an alternative way to access a specific account, and you are not able to change between the accounts you administer, when logged in. You have to login for each account you wish to access.

This is not available for when using Token access, as user credentials are not used to connect. The account in question has granted access to a specific app, not a user.
answered Mar 19, 2013 by rbb
Visma e-conomic A/S
...