Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Weird API behavior

AdaAda Posts: 203Member ✭✭✭✭ - Eminent
edited April 2013 in Tech Support
Hi! I've been trying to use IRE's open API ( http://www.ironrealms.com/IREAPIdocumentation.pdf ) to collect orglogs. But I've been having some weird issues accessing the api server.

1. The server returns an Http 403 (Forbidden) when there are no logs for an org for a given day, I can handle that but shouldn't that return an empty JSON object?
2. The 'count' items in the /orglogs.json endpoint never change when I give day=x parameter, they always reflect the state for day 0. Here are sample uris I'm using,

http://api.achaea.com/orglogs.json?password=secret&character=Ada&day=0
http://api.achaea.com/orglogs.json?password=secret&character=Ada&day=1
http://api.achaea.com/orglogs.json?password=secret&character=Ada&day=2

The count is always the same O_o
My script is hosted here:

https://bitbucket.org/adayoung/adacode/src/master/irelogs.py

Anyone know what might be causing the weird behavior? Thanks in advance!
Tagged:

Comments

  • CardanCardan The GardenPosts: 437Member Immortal
    orglogs.json displays the count of log entries for the current day only and 'day' isn't an optional parameter for it, which is why you keep getting the same numbers back.

    Theoretically you should only be getting a 403 error for an authentication failure but from looking at the code itself, it does appear that it is correctly (code-wise) returning a 403 error when the log file in question doesn't exist.

    I'll see if I can find out how people should report bugs/submit ideas for the API server (since it's IRE-wide not Achaea specific) and I'll let you know.
    KardAda
  • AdaAda Posts: 203Member ✭✭✭✭ - Eminent
    Oh oops, thanks for clarification!
  • OrzaansynOrzaansyn Posts: 663Member @@ - Legendary Achaean

    Hello @Cardan‌.

    Would it be possible to allow Access-Control-Allow-Origin on the API urls? Or at least return a JSONP callback?

    image
  • OrzaansynOrzaansyn Posts: 663Member @@ - Legendary Achaean
    @Tecton ? @Sarapis‌ ? Please would you tell me where to address this request?
    image
  • AdaAda Posts: 203Member ✭✭✭✭ - Eminent

    Hi @Orzaansyn‌! http://api.achaea.com/gamefeed.json?jsonp=parseResponse already gives this:

    HTTP/1.1 200 OK
    Content-Length: 661
    Date: Thu, 19 Jun 2014 00:07:37 GMT
    Expires: Thu, 19 Jun 2014 00:07:37 GMT
    Server: Apache
    X-Powered-By: PHP/5.4.22
    Access-Control-Allow-Origin: *
    Vary: Accept-Encoding
    Content-Encoding: gzip
    Content-Type: application/json
    Age: 1
    Connection: keep-alive

    That's not usable for JSONP but yay for pretty *'s!! :smiley: 
  • OrzaansynOrzaansyn Posts: 663Member @@ - Legendary Achaean

    Oh. Damn. Thank you very much @Ada ... How comes it returned me a cross domain error when I tried?

    image
    Ada
  • OrzaansynOrzaansyn Posts: 663Member @@ - Legendary Achaean
    Anyway, it works and it is exactly what I needed. Thank you very much.

    image
    Ada
Sign In to Comment.