Abstraction of pricing data

(Arjen) #1

Maybe this is just for my peace of mind to know for sure, but the ‘old’ API used to only be able to give one piece of price information (low, average, high). Can anyone tell me whether this was, as I suspect, an average from all cards currently in stock of condition Lightly Played and better?

I love that we can now get marketprices of all conditions, but would it be handy to also have this kind of abstraction again (based on marketprice though, not average).

1 Like
(Tiago Pereira) #2

I agree with this,

I also do think that having ‘just’ by condition is a gruesome task for us devs and TCGPlayer servers, since, to present the price info on our apps, we need to calculate the average of the marketprice to have a overall price evaluation of the card and for this we need to make 110 calls to the server (for each condition available).

Currently (with the old API) we need to make - for MTG - 30.000 calls (+/-) to get the price of all the cards, while with the new API this will be escalated to 3.300.000, I don’t think that neither the devs or the TCGPlayer servers want that.

I am with OP and suggest that there should be an API endpoint for:
Average of each - low, hi, markeprice - for LP or better.

Also I am guessing that not just me that want to fetch a game’s price data for all cards daily. To end the madness of overloading the servers with price fetch calls, there should be a endpoint with all the new prices (the ones that we are suggestions), either by game or group.

This will benefit both us devs and reduce the cost of your servers.

Edit: Better explanation

1 Like
(Tony) #3

We hear you loud and clear and just recently launched a series of API endpoints to provide this information to you … per Product!

In the Pricing endpoints; you will now notice 4 new endpoints to call. The one you are looking for is the new /pricing/product/{productId} endpoint, which will return the following:

  "LowPrice": 0,
  "MidPrice": 0,
  "HighPrice": 0,
  "MarketPrice": 0,
1 Like
(Tiago Pereira) #4

Lovely <3

And what about a way to get price info other that just 1 by 1 item?
Maybe by Group, eg:
http://api.tcgplayer.com/current/pricing/group/{groupID}

{
"Group": 87,
  "prices": [
    {
      "ProductID": 86,
      "price": {
        "LowPrice": 0,
        "MidPrice": 0,
        "HighPrice": 0,
        "MarketPrice": 0
      }
    },
    ...
  ]
}

With this implemented - for all MTG cards - we would reduce the calls from 30.000 to 200 (+/-)

Thoughts? :slight_smile:

(Arjen) #5

So what would the LowPrice, MidPrice and HighPrice be based on? Is that basically the same as the ‘old’ API is providing?
Would the Marketprice be the marketprice of all cards LP and better?

MagicCardMarket exposes an API where, for prices, there’s basically 1 endpoint where you download a gzipped JSON file with all available pricing data in it. This means that you only need 1 call for all data. I can imagine this greatly reduces the load on your servers, since you generate this file once every X time?

(Tony) #6

@jenjia We have a new endpoint that will be available soon that will return prices based on group … but I believe it’s on a per price type basis. Don’t quote me on this; but I believe the endpoint is something like /current/pricing/market/{groupId} (I’ll confirm).

@arjen Yes; the /pricing/ endpoint I mentioned previously is the same HML data as the Legacy API.

As for the single endpoint for everything; we’ll have to look at the use case in which and endpoint like that will be used for. If it makes sense (from a usability and performance standpoint) and doesn’t encourage negative behavior, I would say we’d be all for it. :slight_smile:

(Tiago Pereira) #7

Let me add that I also use the same MKM api for all data that @arjen mention and it is just a wonderful, 1 api call and thats it. I then have all the cards data, which is something I need, since I want to calculate the value of my users inventory I need to have this data daily. Using the old API I need to make 30.000 calls everyday. Which overloads your server, something none of us wants. And I am just doing it for MTG for now, I do want to make apps for all the games :sweat:

Anyway @tony, if that doesn’t gonna happen and if you gonna do the per group price data for each price type, please do it also for the new price data that we asked for.

Also, I am getting “401 Unauthorized” for the new price api end point
eg. (/current/pricing/product/86)

Therefor I cannot validate the output of it.
That said, let me suggest that it would be nice to have the Foil value of it also in this new data. The goal is to have 1 api call for the prices for 1 card either foil or non foil, as the old api did.

(Tony) #8

Are you adding the ‘authorization’ header per the instructions? All developers have the same permission; so you should be able to get at the catalog data (even without the ACCESS_TOKEN). Let me know if you continue to have issues.

(Tiago Pereira) #9

(By we way if I post links in my post they keep getting flagged as SPAM)

I just generated a new bearer token,

Api endpoint:

/current/catalog/products/86

works fine, 200 OK

on the other and, the new api endpoint:

/current/pricing/product/86

I get, 403 Forbidden

(Tony) #10

Ah; I see it now. It’s a new endpoint, so permissions haven’t been added yet. What’s your app name? I’ll get it added.

(Tiago Pereira) #11

I guess you just have me in your database as the app named:

  • MTG Manager

for iOS but I also have it for Android and I also have:

  • Card Scanner for Yu-Gi-Oh!,
  • Card Scanner for PokeTCG
  • Card Scanner for Vanguard

all for iOS and Android. :stuck_out_tongue:

(Tony) #12

Ok; I’ve enabled permissions for you for that endpoint. I’m going to enable it for all the other developers as well. Thanks for bringing that to our attention!

1 Like
(Tiago Pereira) #13

I confirm its working;

/current/pricing/product/86

Will output:

{
    "Success": true,
    "Errors": [],
    "Results": [
        {
            "LowPrice": 0.14,
            "MidPrice": 0.26,
            "HighPrice": 1.51,
            "MarketPrice": 0.19,
            "SubTypeName": "Normal"
        },
        {
            "LowPrice": 0.14,
            "MidPrice": 0.26,
            "HighPrice": null,
            "MarketPrice": 0.19,
            "SubTypeName": "Foil"
        }
    ]
}
1 Like