Having just gotten some code working to use the API I wrote some documentation. The main weirdness is the use of HTTP response codes in the form of redirects to determine if you need to login, and if so if you've succeeded at each stage.Can someone provide links to the existing API resources, code, etc. I am interested in developing a 3rd party tool in C#, for example.
Thanks! This is an excellent starting point.Having just gotten some code working to use the API I wrote some documentation. The main weirdness is the use of HTTP response codes in the form of redirects to determine if you need to login, and if so if you've succeeded at each stage.
NB: I've been updating those docs slightly since first posting here. Take note of the bits about 'discard' cookie and having to handle redirects yourself (else parsing HTML to check what page you're on).
Time to become more proficient in python it seemsI wrote a primitive scraper in Python many months back, which worked well enough for me to stick it in a cron job. https://gist.github.com/nickludlam/888aae12b126cd904fb1
Or you could puzzle over my perl: https://github.com/Athanasius/fd-apiTime to become more proficient in python it seems![]()
Having just gotten some code working to use the API I wrote some documentation. The main weirdness is the use of HTTP response codes in the form of redirects to determine if you need to login, and if so if you've succeeded at each stage.
NB: I've been updating those docs slightly since first posting here. Take note of the bits about 'discard' cookie and having to handle redirects yourself (else parsing HTML to check what page you're on).
I wrote a primitive scraper in Python many months back, which worked well enough for me to stick it in a cron job. https://gist.github.com/nickludlam/888aae12b126cd904fb1
Time to become more proficient in python it seems![]()
Credit where it's due, I got that out of https://bitbucket.org/orphu/edapi/src/ae95e51eaccb7e3faab4b670d0df1d830ad99313/edapi.py?at=masterLooking at Athan's Perl code I found that you need to supply an user agent compatible with Apple's Safari for iOS, otherwise the API returns 403 Forbiden. Tests I done using wget on a Linux shell were returning 403s both with wgets default UA (whatever that is) and when supplying Firefoxes UA (Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0) as a a UA.
The one that worked was the one from Athans script: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B411"
There is a lot of stuff on the EDCodex, maintained by Wolverine. It was the only place we could share API code before the approval of use.
EDIT: This will take you to the EDDN stuff: http://edcodex.info/?m=search&cat=9
I wonder if someone at Microsoft mis-read RFC6265 - 5.1.1 Dates and is simply barfing on the Day of Week. I can't blame 'em as there's no mention of day-of-week there, but I do note that RFC6265 - 3.1 Examples does contain "Set-Cookie: lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT" as an example. To be fair to that RFC 'Dates' excerpt it does seem defined as to allow any amount of extra text in a date, just so long as it can find all of "day-of-month, month, year, and time".Eugh! Finally! I now have some C# code which can authenticate with the API servers and download a profile
The biggest hurdle was that the .NET library really does not like the cookies returned by the API server, specifically the comma in the expires= value.
IIRC from my various googlings it seems like this is a "well known" issue in the 4.0 runtime which was "fixed" in 4.5. I only have Visual Studio 2010 (runtime 4.0) at home but I did give it a quick try using 4.5 at work, however as I was experiencing the "failure to send cookies back" issue at the time I did not specifically notice if the other issue was in fact resolved.If you're positive this it is .NET's behaviour to barf on that I'd file a bug report with Microsoft.
I will share my C# when it's ready.I was thinking: there seem to be a few of us who are writing the same basic code. Would it make sense to turn this in to a dll and share it? We can then fix all the little gotchas that we find (the whole cookies thing and FD redirecting all over the place is a little annoying).
I think each application should login itself, so the user is aware what it is doing.And on a similar basis, once we have the required cookies it would be nice to put them in a more sanely accessible place. I'm currently writing them to a JSON file in %APPDATA% to make them more easily available to other apps in some possible future.