API Call

This forum is for eXpress++ general support.
Message
Author
c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: API Call

#11 Post by c-tec »

Hello,
I would never more use CURL or other tools that are working based on runshell or so. You will never have the control like using Chilkat whe you get errors. I am just eleminating using SEE4XB for emails and OT4XB and the WINSCPE commandline tool andr TServerXMLHTTPRequest of OT4XB. I do very complicated things on Linux Servers, Chilkat does it much better, with more features and with much better control over the workflow and errors. Look at the price and the docs, then you never will use another tool, and it costs less then 300 €
And: I get no fee for recommonding this tools ;-)
It someone need samples, I have a lot in xBase++ and eXpress++
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

omni
Posts: 554
Joined: Thu Jan 28, 2010 9:34 am

Re: API Call

#12 Post by omni »

Thanks for your help...

Still using loadfromurl with the proper headers but it will not change the content-type.
When it goes out it uses what I guess is the default from Alaska and posts the content type sent under Cookie(?)
See below for what the test server is getting.
Is there a special trick to not use the www-form type? The header does not work, apparently.
Nothing I see in their docs.

POST /svc1.transflomobile.com/integration/api/v1/notifications/ HTTP/1.1
Cache-Control: no-cache
Content-Length: 149
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Authorization: Basic dGZsbzA2YzpMTGJCUnYyTFNkTnJUdkZlbG85M2VnPT0=
Cookie: Content-Type: application/json
Host: webapp.transflodev.com
User-Agent: Mozilla/4.7+[ja]+(WinNT;+I)

Fred
Omni

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: API Call

#13 Post by rdonnay »

Chilkat does it much better
I agree that Chilkat makes very good products.
I use their SFTP solution in several applications.
The eXpress train is coming - and it has more cars.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: API Call

#14 Post by rdonnay »

http://webapp.transflodev.com/svc1.tran ... ifications

I still don't understand what you are trying to do.
The above URL doesn't tell me anything about their specification.

What is this API?
What is it for?
Where is the website that has the specs?

Please be more specific.
The eXpress train is coming - and it has more cars.

omni
Posts: 554
Joined: Thu Jan 28, 2010 9:34 am

Re: API Call

#15 Post by omni »

Roger,

Not necessary to connect do their docs page, but its
http://webapp.transflodev.com/svc1.tran ... ration/sdk

The "notify" post is the simplist and the one they use for initial testing.No issue at all with that. tested at a couple of web site that allow test posting with headers and using the same headers as we are using Alaska, it is successful.

The issue is Alaska's Loadfromurl(), apparently.

Our post matches to what the web site wants except the loadfromurl has :

Content-Type: application/x-www-form-urlencoded

Cannot get rid of their Content-Type. Put the proper Content-Type in the Header and the Loadfromurl put it down as a Cookie, so it did not use it.

Below is what is expected..anything additional is ignored:

POST http://webapp.transflodev.com/svc1.tran ... ifications HTTP/1.1
Authorization: Basic dGZsbzA2YzpMTGJCUnYyTFNkTnJUdkZlbG85M2VnPT0=
Content-type: application/json
Host: webapp.transflodev.com
Content-Length: 175

And here is what they get, which errors out due to the content type

POST /svc1.transflomobile.com/integration/api/v1/notifications/ HTTP/1.1
Cache-Control: no-cache
Content-Length: 149
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Authorization: Basic dGZsbzA2YzpMTGJCUnYyTFNkTnJUdkZlbG85M2VnPT0=
Cookie: Content-Type: application/json
Host: webapp.transflodev.com
User-Agent: Mozilla/4.7+[ja]+(WinNT;+I)

I did look at chiklat and their post example and it would post exactly as they request. I have not downloaded it yet, but I did copy their examples to use for next week if the content-Type cannot be fixed for Loadfromurl(). I would have sworn one of the other responders said they did use Loadfromurl() for jasn. Maybe Alaska does not support Jasn, or I do not have a current version. Using 2.0

Have a good weekend (or rest of it)

Fred

c-tec
Posts: 379
Joined: Tue Apr 20, 2010 1:36 am
Location: SALZBURG/AUSTRIA
Contact:

Re: API Call

#16 Post by c-tec »

Hello,
and you really took a look at this example ?
https://www.example-code.com/foxpro/http_post_json.asp
Here is all you need, desrciption of additional parameters you find in the docs.
If you post your code, its easier to find the problem.
regards
Rudolf
Rudolf Reinthaler
digital pen & paper systems
http://www.formcommander.net

omni
Posts: 554
Joined: Thu Jan 28, 2010 9:34 am

Re: API Call

#17 Post by omni »

Yes, i am certain Chiklat will work...the issue is loadfromurl(). I was not aware of Chiklat until it was posted here....if loadfromurl will work I do not have to buy software and rewrite code.
thx

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: API Call

#18 Post by skiman »

Hi,

Use the loadfromurl() which was created by Phil Ide. it will work.
http://www.idep.nl/xbase/datpage/lfu.html
Best regards,

Chris.
www.aboservice.be

omni
Posts: 554
Joined: Thu Jan 28, 2010 9:34 am

Re: API Call

#19 Post by omni »

Tried that and it gives an error that his dll needs version 1.70. Guessing that his loadfromurl will not work in 2.0. I cannot find my 1.9 xppdui.dll, which causes it to error in 1.9.

Fred

skiman
Posts: 1199
Joined: Thu Jan 28, 2010 1:22 am
Location: Sijsele, Belgium
Contact:

Re: API Call

#20 Post by skiman »

Hi,

Source code is included, just recompile it to get the DLL version you need.
Best regards,

Chris.
www.aboservice.be

Post Reply