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

SOAP API: API Key for non partner app

0
We want to use economic for our webshop but the webshop is custom developed.

How can I get an api key so that I can connect using SOAP?

Thanks!
created Jul 26, 2016 by benjaminbenjaminus
0% Accept Rate
Q 1 A 0 C 5

1 Answer

0

Hi Benjamin

All apps, partner or not, are created on developer agreements.

AgreementGrantTokens are then created using the app-requestURL.

You can read a full guide here: https://www.e-conomic.com/developer/connect

answered Jul 26, 2016 by olej
I followed the full guide.  I was emailed the developer account and I have the secret and public token.

When I connect via soap I get the error below:

soap:ClientEconomic.Api.Exceptions.AuthenticationException(E02250): Not logged in - could not resolve authenticationContext. This may be caused by invalid session cookie header. Read more at: https://www.e-conomic.com/developer/about-the-soap-api. (id=447a63ca-085d-4b7e-87d5-92b499698d9c)

Here is my soap xml:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <ConnectWithToken xmlns="http://e-conomic.com">
      <token>1149941</token>
      <appToken>AppSecretToken</appToken>
    </ConnectWithToken>
  </soap12:Body>
</soap12:Envelope>
Hi Benjamin

<token> must be the agreementGrantToken that you generate using your apps requestURL when hooking up your app to an agreement that contains accounting data.
PS: I've edited out your appToken so you don't share it publicly. You should delete the app and create a new unless you already masked it.
The guide is confusing.  I have a test environment via clicking Denmark.

"Note: If you need a test environment, sign up for a trial or demo agreement in the country of your primary user: Denmark Sweden Norway. Should you need it to live longer than the default trial period, please contact apps@e-conomic.com."

It did not give me an agreement grant token
I was able to get the Agreement Grant Token by clicking the "Request Url" link under the Developer icon when logged in to https://secure.e-conomic.com/secure/#!.

Please see jing -> http://screencast.com/t/88gDNYfpBBaa

When I put this in my soap request I as the token value, I still get the same error I mentioned in my first post.
Hi Benjamin

Your problem isn't your ConnectWithToken.
SOAP works by creating a server session for you once you supply valid credentials.
This is done by returning a SET-COOKIE header in the success response to the connect method.
You need to use this cookie for any following calls to the SOAP API where you interact with this agreement.
When all operations are done you can use Disconnect() to destroy the session and invalidate the session cookie.
With no code change, I am now getting a soap response.

Maybe the tokens needed time to be available?
Hi Ole J,

How can I now connect the "Danish" test environment account that has dummy data to the developer api.

I got 2 emails with 2 different accounts when following the documentation:

1) Has the developer menu containing the secret key and public key

2) Has dummy data in it.

As I can now "connect with token" how do I link the info from #2 to #1 as #1 is the one authorized to connect to your servers?
Visma e-conomic A/S
...