atalexsutter.9360:

Hey!

I’m trying to access /commerce/transactions/history/buys with my C# (+RestSharp) Code.
Whenever I try to call it I get a object back that is null. However it works fine with /current/.

Pastebin of the code in question
EDIT: I just saw that I pasted the wrong code, of course it should be: “commerce/transactions/history/buys” instead of “commerce/transactions/current/buys” in line 3.

Like I said with /current/buys (just changing the RestRequest-URL) it works completely fine and I get all my current listing back. Now I’m kinda confused why this souldn’t work, can anyone help me?
They look (and are according to the wiki) identical except the ‘purchased_date’, therefore RestSharp should be able to parse them into the same class, right?

Lawton Campbell.8517:

Just to verify, if you fetch the URL that doesn’t work (with access token, etc) with a browser does JSON come back?

I’ve never used RestSharp, so I can’t really help if the issue isn’t with a broken endpoint. I’d imagine the purchased_date field needs to be marked optional or something for the deserializer to work (but that it gives you no exception or error code about a deserialization failure is really weird).

atalexsutter.9360:

I tried to fix the problem with writing my own deserializer and stuff… Didn’t work…

Was thinking way to complicated
The only problem was that the ‘id’ the /history/buys returns doesn’t fit into a normal (32bit) int. Sadly RestSharp doesn’t throw an exception, but rather just doesn’t fill the object. Therefore a NullPointer Exception was thrown in my code.

Do you know how high can these numbers get?

Thanks a lot for your help!

Lawton Campbell.8517:

Do you know how high can these numbers get?

In the database they’re stored as a bigint (maximum 2^63), but since we’re serializing to JSON the API will break after they exceed 2^52 (because JSON encodes numbers as IEEE 754 doubles, that’s the maximum integer that can be exactly represented). So storing them as a 64-bit integer on your side should be safe.

atalexsutter.9360:

Ah, okay, great! Thanks alot