1. This forum section contains Blog style threads from the Developers, and/or threads with details about what they have been working on, previews of upcoming content, and sometimes backstory associated with the content. Players are permitted to reply to these threads if the developer has indicated it is permissible by leaving the thread unlocked. Please note that TOS applies, and any abuse or trolling will be moderated.
    Dismiss Notice

Public Stats API

Discussion in 'Developer Work and Blog posts' started by Undone, May 9, 2017.

Thread Status:
Not open for further replies.
  1. Phil Scott

    Phil Scott Avatar

    Messages:
    74
    Likes Received:
    41
    Trophy Points:
    20
    Gender:
    Male
    Nope (I have a process that runs a few times a day and samples all of the data and looks for new stuff).
     
  2. Cebrimal

    Cebrimal Avatar

    Messages:
    20
    Likes Received:
    26
    Trophy Points:
    3
    I must admit that I am green to everything coding. That said, I went by the elasticsearch website and took a look at the client options and wanted to try and put something together in Javascript as per this document. However, I'm getting a 403 Forbidden error just trying to check to see if the cluster exists. Is the shroudoftheavatar elasticsearch setup so differently that the standard documentation no longer applies? Or any other insight here on something obvious I'm missing?

    [​IMG]
     
    Last edited: Jul 9, 2017
  3. Umuri

    Umuri Avatar

    Messages:
    527
    Likes Received:
    1,828
    Trophy Points:
    63
    IIRC, Shroud's elasticsearch only responds to GET type requests. So you can't use POST/HEAD/etc. Hence the 403 error.
     
  4. Cebrimal

    Cebrimal Avatar

    Messages:
    20
    Likes Received:
    26
    Trophy Points:
    3
    Awesome! Thanks, I now have something that works to play with.
     
  5. Black Knight

    Black Knight Avatar

    Messages:
    73
    Likes Received:
    148
    Trophy Points:
    20
    Gender:
    Male
    Location:
    Denmark
    @Chris & @Undone - any chance of enabling POST, since body on GET requests is incredibly bad form (I have no idea why ES even still allows that), and a lot of systems (and several proper elastic clients reject any such attempt)
     
  6. Katu

    Katu Avatar

    Messages:
    454
    Likes Received:
    777
    Trophy Points:
    55
    Gender:
    Male
    Location:
    Finland
    GET, POST, PUT, DELETE etc all have almost identical behaviour. Like 99,9% identical. Difference comes from contract, that API developer has used correct VERB to annotate certain action. GET should and is used as a end point, that only gets data from server. It does NOT alter the data, it does not change the state of the server. GET with same parameters, should always return same response, unless state has changed.
    POST, is something that is used to send data to server, new data.

    GET and POST are just verbs. Http works almost identical no matter what you use. Its all about the contract. Internet and browsers are built on that contract, that get gets, post posts, everything else, is bad.
     
    Alley Oop likes this.
  7. Black Knight

    Black Knight Avatar

    Messages:
    73
    Likes Received:
    148
    Trophy Points:
    20
    Gender:
    Male
    Location:
    Denmark
    I'm completely lost here, are you trying to agree with me? Or are you trying to explain how the internet works?

    If it's the latter and you are going to talk technical, please review sections 4.3 and 9.3 of the Hypertext Transfer Protocol -- HTTP/1.1
     
    liz_the_wiz likes this.
  8. Katu

    Katu Avatar

    Messages:
    454
    Likes Received:
    777
    Trophy Points:
    55
    Gender:
    Male
    Location:
    Finland
    Just realized how weird the ES api is. It indeed allows and consumes GET bodies for the cases where client does not have POST or some other reasons.
    Thats my bad.

    However, if using GET, i think using the source param is the way to go?
     
  9. Black Knight

    Black Knight Avatar

    Messages:
    73
    Likes Received:
    148
    Trophy Points:
    20
    Gender:
    Male
    Location:
    Denmark
    The source parameter in the above examples provides the query as message body on the GET requests. If you do "clean" GET requests with everything in the URL (query string) you cannot structure your query as a JSON document.
    You can do a lot with just query string parameters, it just doesn't facilitate a very clean interface when doing complex queries.

    While the node.js api does allow changing the method on the search endpoint to GET by using the source parameter it is essentially a hack, and while that works for the search api, is does not work with the scroll api. So if for some reason you should wish to scroll through a larger data set, you cannot do this without writing a framework to do the requests yourself - again a hack of sorts.

    Hence my proposal to enable POST on the endpoint so we don't have to "break" the protocol or write our own libraries to utilize the ES api.
     
  10. that_shawn_guy

    that_shawn_guy Bug Hunter

    Messages:
    1,414
    Likes Received:
    3,748
    Trophy Points:
    125
    Location:
    earth... mostly
    @Undone / @Chris, Are any changes to the API planned for R45?
     
  11. Undone

    Undone Trap Master Moderator SOTA Developer

    Messages:
    346
    Likes Received:
    848
    Trophy Points:
    43
    None planned for R45
     
    Umuri likes this.
  12. xadoor

    xadoor Avatar

    Messages:
    261
    Likes Received:
    337
    Trophy Points:
    28
    is thre a delay in the merchSale data? I fully admit I'm a hack at this api thing but I was trying to see the lottery transactions and I'm not seeing any for the last 3 days and I gotta believe there were tons of them 2 days ago(1 day before the draw). I removed lottery fields for Ss and Giggles and it seems I can't see any merch data for the last 3 days? Is that on purpose?(or am I just stupid, certainly possible)

    Gets data(I think the last 4 days):
    http://54.224.243.98:9200/_all/_sea...tionEvent:ItemGained_Merchant&size=500&pretty

    No data(I think the last 3 days):
    http://54.224.243.98:9200/_all/_sea...tionEvent:ItemGained_Merchant&size=500&pretty
     
    mystarr and Titania Xylia like this.
  13. DavidDC

    DavidDC Programmer Moderator SOTA Developer

    Messages:
    1,532
    Likes Received:
    3,236
    Trophy Points:
    113
    Gender:
    Male
    same problem here, people reported me that it stopped at 28 august at midnight, dunnoh what happened
     
  14. Undone

    Undone Trap Master Moderator SOTA Developer

    Messages:
    346
    Likes Received:
    848
    Trophy Points:
    43
    you all did it....you finally did it...
     
    xadoor likes this.
  15. LoneStranger

    LoneStranger Avatar

    Messages:
    3,023
    Likes Received:
    4,761
    Trophy Points:
    165
    Gender:
    Male
    Location:
    Petaluma, CA
    ****! It's the APIcolypse!
     
    Undone likes this.
  16. Undone

    Undone Trap Master Moderator SOTA Developer

    Messages:
    346
    Likes Received:
    848
    Trophy Points:
    43
    disk filled up....give me a few to see if I can clean this thing up =O

    and it should be back! sorry for the interruption!
     
    Last edited: Sep 1, 2017
    Alleine Dragonfyre and Rentier like this.
  17. null2

    null2 Avatar

    Messages:
    373
    Likes Received:
    1,152
    Trophy Points:
    55
    Was just about to bug you about the same thing with pvp :)
     
  18. Black Knight

    Black Knight Avatar

    Messages:
    73
    Likes Received:
    148
    Trophy Points:
    20
    Gender:
    Male
    Location:
    Denmark
  19. Umuri

    Umuri Avatar

    Messages:
    527
    Likes Received:
    1,828
    Trophy Points:
    63
    Looks like it's operating fine to me, SotaSTATS is still chugging away.
     
  20. Undone

    Undone Trap Master Moderator SOTA Developer

    Messages:
    346
    Likes Received:
    848
    Trophy Points:
    43
    Looks ok on my end? Let me know if it continues to be weird and I'll restart it.
     
    Black Knight likes this.
Thread Status:
Not open for further replies.