These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Why are we not combining market data, player devs?

Author
Ilyk Halibut
Deep Core Mining Inc.
Caldari State
#261 - 2012-05-07 21:53:22 UTC
Packtu'sa wrote:
To nitpick, must every endpoint have the "/api/upload" path? Why does the URI of an endpoint need to be defined in the spec?


It probably doesn't need to be. Consistency is nice, but having differing hostnames kills that from the start, so we're not really any better off with consistent endpoint paths.

EVE Market Data Relay - A real-time feed of EVE Market data http://www.eve-emdr.com

Ilyk Halibut
Deep Core Mining Inc.
Caldari State
#262 - 2012-05-07 22:00:57 UTC
Desmont McCallock wrote:

Edit: Having worked with site devs that uses, from Python, to PHP and Scala, the PUT method seems the most convenient of all, for all.

It's trivial to support POST and PUT on my side at EMDR, which I can do. Technically, PUT is the "correct" way to upload market data, in this case.

That said, most well-designed libraries should be equally easy for PUT and POST. Here's a good Python example:

http://docs.python-requests.org/en/latest/api/#requests.head

You're basically just changing requests.post to requests.put. It shouldn't be any more difficult than that, especially if we're not form encoding.

EVE Market Data Relay - A real-time feed of EVE Market data http://www.eve-emdr.com

Dragonaire
Here there be Dragons
#263 - 2012-05-08 05:19:08 UTC  |  Edited by: Dragonaire
Ok I guess it wasn't clear from my link why PUT would be wrong so I'll try to explain it. PUT is for creating or updating an existing end point. So if you PUT to SITEROOT/api/item123.xml and can read it back from SITEROOT/api/item123.xml then you can use PUT but if you can't you need to use POST as it's not expected that you can get the data back from the same location with it. If you want to understand this more fully you'll need to read the RFCs related to both POST and PUT.

On the part about form encoding it needs to either be done as application/x-www-form-urlencoded or multipart/form-data. Note that both of them require key-value pairing so if we are going to be in line with the standards we will need to use a key P. Most libraries people will use probably can work without it but I'm sure there end up being a popular one out there that requires it so we need to just bite the bullet now and decided what the key name should be so we all use the same thing since both the sources and sinks need to agree what it should be in this case.

I updated the Wiki page while I was at it to reflect using only POST and needing the key-value pair. I used UUDIF as the key in the example but if someone else has another idea for it that could be changed I just thought it would be something that is unlikely to be mistaken for something else like more common keys like data etc. It could also be done lower case and probably should be but I was lazy on my edit when I copied it form a titleBlink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Kaladr
Viziam
Amarr Empire
#264 - 2012-05-08 05:52:49 UTC
As a note, when form encoding, please remember to actually form encode the contents. While most characters are safe in the message, the + in the timestamps gets decoded to a space, leading to an invalid date/time.

As for what key? Why not data. Its a nice four letter word, and I don't have to change anything Lol

Creator of EVE-Central.com, the longest running EVE Market Aggregator

Desmont McCallock
#265 - 2012-05-08 06:06:08 UTC
Kaladr wrote:
Why not data. Its a nice four letter word, and I don't have to change anything Lol


Other's will have to make changes (me included), why not you? (humor)
Ilyk Halibut
Deep Core Mining Inc.
Caldari State
#266 - 2012-05-08 14:07:22 UTC
EMDR will continue accepting uploads without form encoding, so if you're doing that, keep on keeping on. I'll get around to adding support for the silly form-encoded POSTs sometime.

EVE Market Data Relay - A real-time feed of EVE Market data http://www.eve-emdr.com

Kaladr
Viziam
Amarr Empire
#267 - 2012-05-08 15:05:26 UTC
Desmont McCallock wrote:
Kaladr wrote:
Why not data. Its a nice four letter word, and I don't have to change anything Lol


Other's will have to make changes (me included), why not you? (humor)


Because I feel entitled. And have a pony.

I think the best course for me is to support omni-formats, namely the form encoding and raw payload. Support is relatively trivial.

(I do not actually have a pony)

Creator of EVE-Central.com, the longest running EVE Market Aggregator

Desmont McCallock
#268 - 2012-05-08 15:13:55 UTC
Quoting famous words:
Quote:
Give people the option to choose and they will whine why you haven't given them more.
-Desmont McCallock-
Ilyk Halibut
Deep Core Mining Inc.
Caldari State
#269 - 2012-05-08 15:59:44 UTC
Kaladr wrote:

I think the best course for me is to support omni-formats, namely the form encoding and raw payload. Support is relatively trivial.

That's what I'll be doing. And as you say, it's pretty easy to support both.

EVE Market Data Relay - A real-time feed of EVE Market data http://www.eve-emdr.com

Packtu'sa
Nabaal Construction and Industrials Corp
Nabaal Syndicate
#270 - 2012-05-08 16:52:08 UTC
If you have to use key/value pairs, and you're sending key/value data, (this next bit should be obvious) why not use the top level keys for the POST?

Granted, the existing format isn't conducive to that, but maybe that's food for thought. (I never was a fan of rowset/row structures in XML/JSON dumps.)

I'm not really a stakeholder at this point, so take my posts as musings, not requirements.
Kaladr
Viziam
Amarr Empire
#271 - 2012-05-08 17:08:42 UTC
If I haven't stuffed something up, EVE-Central now supports POST with the data parameter and form encoding, and raw entity POST requests without form encoding.

Creator of EVE-Central.com, the longest running EVE Market Aggregator

Dragonaire
Here there be Dragons
#272 - 2012-05-09 17:31:27 UTC
Been looking into what I need to do to make Yapeal into an uploader for the MarketOrder API and had some questions for the people involved in receiving the data. Because of how the API works it would be nice to send all the market items together in a single POST request just with multiple key-value pairs. I know there was some talk about there being no reason it can't be done from a format point of view but I was wondering if any of you have thought about allowing it and processing them that way. I'll try to make it a little clear how the POST would look:
UUDIF={JSON ...}&UUDIF={JSON ...}

Each one would be for a single TypeID so like the first one is TypeID=123 and the second one would be for TypeID=456 etc. so each is a complete dataset they would just be sent together in the same POST.

Is this something you think you'd support or will I need to look at sending a POST for each one? I can see this saving a lot of network bandwidth for everyone if it was supported.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Desmont McCallock
#273 - 2012-05-09 17:47:40 UTC  |  Edited by: Desmont McCallock
First, you need to look at UF specs again. We all agree to use 'data' as parameter name.

Second, in the specs you wrote for the UF, you have written "As shown in the purposed version multiple data groups would be allowed for different typeIDs. It would also be possible to have the same typeIDs but different regionIDs or both combined."

Third, regarding the bandwidth saving, that's why I struggle to make all market site devs support the compressed uploading. There is an up to 80% gain in that.
Kaladr
Viziam
Amarr Empire
#274 - 2012-05-09 19:54:53 UTC
I strongly encourage using Content-Encoding: gzip or Content-Encoding: deflate (same algorithm, different headers). If you know what you're doing, its easy to support (aka, I learned by integrating with EMUU ;)).

EVE-Central already supports gzip on the outbound data, which is a helpful bandwidth saver.

Creator of EVE-Central.com, the longest running EVE Market Aggregator

Packtu'sa
Nabaal Construction and Industrials Corp
Nabaal Syndicate
#275 - 2012-05-09 21:47:47 UTC
Kaladr wrote:
I strongly encourage using Content-Encoding: gzip or Content-Encoding: deflate (same algorithm, different headers). If you know what you're doing, its easy to support (aka, I learned by integrating with EMUU ;)).

EVE-Central already supports gzip on the outbound data, which is a helpful bandwidth saver.

Most web servers support optional gzipping. Does settiing the content encoding keep it optional? Is there a good argument for making it mandatory?
Dragonaire
Here there be Dragons
#276 - 2012-05-09 23:20:19 UTC  |  Edited by: Dragonaire
Guess I need to remember to hit refresh once in a while on that page so I see the changes Oops Ok looks good and that does answer my question Smile Thanks to whomever took the time for the updating on the wiki.

Quote:
Most web servers support optional gzipping. Does settiing the content encoding keep it optional? Is there a good argument for making it mandatory?
Setting the header saying you accept or would like to send your data compressed it doesn't make it required it just let's the server know that you are connecting to you can and if the server is setup to do so it usually will but it does take both ends agreeing to do so at the start of the connect to happen. If you are using something like cURL there are settings you can use to sent the correct headers and Apache etc have settings to turn it off and on as well.

Edit: The Implementations page was also a good idea Big smile

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Kaladr
Viziam
Amarr Empire
#277 - 2012-05-10 02:26:28 UTC
Packtu'sa wrote:
Kaladr wrote:
I strongly encourage using Content-Encoding: gzip or Content-Encoding: deflate (same algorithm, different headers). If you know what you're doing, its easy to support (aka, I learned by integrating with EMUU ;)).

EVE-Central already supports gzip on the outbound data, which is a helpful bandwidth saver.

Most web servers support optional gzipping. Does settiing the content encoding keep it optional? Is there a good argument for making it mandatory?


It is optional in both directions. For request, there is no notion of HTTP "pre-headers", so the client must assume the server can accept the encoding (or get the relevant error code, and try again without that encoding). For return content, the client sends the Accept-Encoding header to let the server know what it can do.

Creator of EVE-Central.com, the longest running EVE Market Aggregator

Desmont McCallock
#278 - 2012-05-10 05:34:56 UTC
Another tip for those using PHP clients and servers.

PHP Client:
In order to encode for 'Content-Encoding: gzip' you will need to use "gzencode()" function.
For the 'Content-Encoding: deflate' you will need to use "gzcompress()" function.

PHP Server:
On the server side there an issue with decoding.
In order to decode for 'Content-Encoding: gzip' you will need to use "gzdecode()" function. But this function is not implemented even in version 5.3.13 (haven't tried 5.4.3). However the code for this function can be found at: http://pastebin.com/v8MJnNjH
For the 'Content-Encoding: deflate' you will need to use "gzuncompress()" function.
Kaladr
Viziam
Amarr Empire
#279 - 2012-05-10 05:51:14 UTC
And for Spray (in Scala), to decode requests, just use a decodeRequest path filter:

https://github.com/theatrus/eve-central.com/blob/master/core/src/main/scala/com/evecentral/api/APIv3Service.scala#L116

Creator of EVE-Central.com, the longest running EVE Market Aggregator

Desmont McCallock
#280 - 2012-05-10 06:47:06 UTC  |  Edited by: Desmont McCallock
While we are at it.

Python Client:
For 'Content-Encoding: gzip' I have currently no knowledge, although looking at Python's documentation (http://docs.python.org/library/zlib.html#module-zlib), it's possible to construct the crc32 checksum and a gzip header is always '1f,8b,08,00' (in hex).
For 'Content-Encoding: deflate' use the zlib library "zlib.compress()".

Python Server:
You can support both 'Content-Encoding: gzip' and 'Content-Encoding: deflate' just by using "zlib.decompress(data, 15 + 32)", which will enable zlib to auto-check the compression header and do the appropriate decompression.

.NET Client:
For 'Content-Encoding: gzip' use a .NET zlib library (http://www.icsharpcode.net/opensource/sharpziplib/) and method "GZipOutputStream". Alternatively you could use .NET native "GZipStream" although it produces a slightly bigger compressed stream than zlib.
For 'Content-Encoding: deflate' use the zlib method "DeflaterOutputStream". The use of .NET native "DeflateStream" is not advised because it's not compatible with Scala's Spray decodeRequest(deflate) or Python's zlib.decompress() (works with PHP gzuncompress() though).

.NET Server:
Using .NET zlib library is mandatory here in order to support all type of clients.
For 'Content-Encoding: gzip' use method "GZipInputStream".
For 'Content-Encoding: deflate' use method "DeflaterInputStream".
Alternatively you could use a hack and strip the first 2 bytes (header) and last 4 bytes (checksum) and inflate the rest of the stream with .NET native "DeflateStream" method.