Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
9
Erster Beitrag:
vor 1 Woche, 3 Tagen
Letzter Beitrag:
vor 5 Tagen, 4 Stunden
Beteiligte Autoren:
Sammy Broeders, Joris, Arie

Connecting with Exact Online

Startbeitrag von Sammy Broeders am 06.01.2017 08:27

Hello all,

I try to make a app in Windev20 to connect with the financial program Exact Online. In the beginning i need to make a Authentication request to receive a code, but i tried a lot of things but without any results. https://developers.exactonline.com/#OAuth_Tutorial.html%3FTocPath%3DSecurity%7CAuthorization%2520(Oauth%25202)%7C_____2

////
My last trie is as below;

cMyRequest is httpRequest
cMyRequest..URL = "https://start.exactonline.nl/api/oauth2/auth?response_type=code&client_id=3df696da-c188-45e5-87b4-afba5b9e0ff0&redirect_uri=http://www.sabrosoft.nl/&force_login=0";
cMyRequest..Method = httpGet
cMyRequest..User = "xx"
cMyRequest..Password = "xx"
cMyResponse is httpResponse = HTTPSend(cMyRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
EDT_NoName1 = cMyResponse..Content
END

Mayby anyone with experience in this case?

Thanks,
Sammy

Antworten:

Hi Sammy,

First you have to get the authorization code from Exact online. We managed to do this by executing the URL in a HTML control. Wait until the URL is loaded. This is when we get the authorization code.

Then you have to get the 'Token' with HttpRequest and HttpGetResult

Kind regards,

Joris.

von Joris - am 06.01.2017 13:35
Hi Sammy, Joris,

a bit off topic, but I was told by an Exact consultant that I had to join the partner program to use the API. Which he said was not free and time consuming (due to certification and so on) . Is that true?

We decided to use the import/export of CSV files to upload invoices and download some info. But the direct API is much more preferred.

von Arie - am 06.01.2017 14:51
Arie,

At the moment i also use use the import of CSV files. At the link below you can make an account for apps and you get also a demo login for Exact Online.
https://apps.exactonline.com/?ReturnUrl=%2Fnl%2Fnl-NL%2FManage

And here you have the help file;
https://developers.exactonline.com/#OAuth_Tutorial.html%3FTocPath%3DSecurity%7CAuthorization%2520(Oauth%25202)%7C_____2

von Sammy Broeders - am 06.01.2017 14:56
Joris,

Thanks for the reply.
How do you get the authorization code out of the html controle?

von Sammy Broeders - am 06.01.2017 14:57
Hi Sammy,

I have extracted some of the code for you


LsUrl is string = ..........
MyHtmlControl = LsUrl
HTMLNavigate(MyHtmlControl,htmlRefresh)
WHILE NOT LbOK
Multitask(-50)
IF MyHtmlControl "" _AND_ URLDecode(MyHtmlControl) URLDecode(LsURL) THEN
LsUrl = MyHtmlControl
//Now you can extract autohorization code etc from LsURL string...
...
//Get token...
HTTPRequest(LsUrl,"","",LsCode,"application/x-www-form-urlencoded")
LsResponse = HTTPGetResult(httpResult)
//Now you can extract the token from LsResponse string...
...
LbOK = true
end
end


Kind regards,

Joris

von Joris - am 09.01.2017 08:31
Joris,

Thanks a lot for the code!
In this way the user needs to enter his username and password in the html controle every time, is that right?

von Sammy Broeders - am 09.01.2017 15:04
Hi, Sammy,

Yes indeed.

Joris.

von Joris - am 10.01.2017 08:53
Joris,

Till the AccesToken it works ok, but after that i don`t receive anythink with the accestoken in my request. Do you use the accetoken also in this format;
Authorization=Bearer gAAAADrIc.......
So with "Authorization=Bearer " in the begin?

I use the request as below;

sUrl is string = "https://start.exactonline.nl/docs/XMLDivisions.aspx";

HTTPRequest(sUrl, "", AccesToken+CR,"","application/x-www-form-urlencoded", "", "")

antwoord is string = HTTPGetResult(httpHeader)

EDT_Antw = antwoord

Tanks,

Sammy

von Sammy Broeders - am 11.01.2017 17:48
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.