API endpoints recently started failing

(Chris Labombard) #1

I have been using pricing/sku and pricing/buy/sku for many months. Every night I update my prices in batches of 100. A couple of nights ago my endpoint calls started mostly failing (some still succeed but the majority fail)

Endpoints are returning {“size”:0,“timeout”:0}

http://api.tcgplayer.com/v1.10.0/pricing/sku/20643,369924,338408,354166,322650,49809,847963,808041,828002,788080,397935,405629,403219,404424,402014,16965,365911,334395,350153,318637,3190906,3190907,3190908,3190909,3190910,871099,871874,871564,871719,871409,1665150,1665311,1665472,1665633,1665794,2445066,2445416,2445766,2446116,2446466,1810071,1810218,1810365,1810512,1810659,1798248,1798397,1798546,1798695,1798844,2270427,2270777,2271127,2271477,2271827,1604694,1604971,1605248,1605525,1605802,3491233,3491234,3491235,3491236,3491237,2284944,2285087,2285230,2285373,2285516,1763337,1763617,1763897,1764177,1764457,1650218,1650398,1650578,1650758,1650938,2321319,2321669,2322019,2322369,2322719,1510531,1510817,1511103,1511389,1511675,1867612,1867925,1868238,1868551,1868864,1957455,1957635,1957815,1957995,1958175

http://api.tcgplayer.com/v1.10.0/pricing/buy/sku/2214150,2214507,2214864,2215221,2215578,1937785,1938176,1938567,1938958,1939349,2457988,2458131,2458274,2458417,2458560,2860292,2858270,2844459,2860382,2858178,1351561,1351863,1352165,1352467,1352769,1649332,1649512,1649692,1649872,1650052,2001560,2001861,2002162,2002463,2002764,1783276,1783533,1783790,1784047,1784304,2029763,2029943,2030123,2030303,2030483,2620093,2620542,2620991,2621440,2621889

It is possible this is due to some code change I made but I do not see it and I couldn’t find any relevant changes in my svn logs. The endpoint calls don’t look incorrect to me.

Has something changed in the TCGPlayer API?? Am I doing something wrong?

Any help would be much appreciated.
-Chris

(Ben) #2

I noticed the same issue on my end, and am basically using the same method, but using the productID fetch; scraping prices 100 at a time. I tested some lines individually for where the errors occurred and noticed sometimes I get a bad request and sometimes it runs fine, so it seems like something on TCG’s end that is not working.

EX: http://api.tcgplayer.com/pricing/product/2510,2511,2512,2513,2514,2515,2516,2517,2518,2519,2520,2521,2522,2523,2524,2525,2526,2527,2528,2529,2530,2531,2532,2533,2534,2535,2536,2537,2538,2539,2540,2541,2542,2543,2544,2545,2546,2547,2548,2549,2550,2551,2552,2553,2554,2555,2556,2557,2558,2559,2560,2561,2562,2563,2564,2565,2566,2567,2568,2569,2570,2571,2572,2576,2577,2578,2579,2580,2581,2582,2583,2584,2585,2586,2587,2588,2589,2590,2591,2592,2593,2594,2595,2596,2597,2598,2599,2600,2601,2602,2603,2604,2605,2606,2607,2608,2609,2610,2611,2612

Any insight would be appreciated, thanks.

41%20AM

(Chris Labombard) #3

@BennyBoy25172 - I could be wrong but your request appears to be missing the version code …

http://api.tcgplayer.com/v1.17.0/

(Chris Labombard) #4

I’ve tried updating to the most recent api

http://api.tcgplayer.com/v1.17.0/pricing/buy/sku/1764644,1764924,1765204,…

The endpoint still intermittently returns {“size”:0,“timeout”:0}

(Chris Labombard) #5

I figured out I didn’t know how response.json and the Reponse body works. So after fixing my ignorance I got this reduced to the core problem (as Benny found).

status 400
statusText Bad Request

FetchError: invalid json response body “URL” reason: Unexpected token < in JSON at position 0

I found there is a 2000 character limit at this thread

My request is only 795 characters. I thought maybe it could be the tcg response is too large so I reduced my requests from 100 to 10 and so far it is running smoothly, without error…

I have a time estimator in my price gatherer.

Batches of 100 only took 150-180 minutes to complete … (3 hours)

Batches of 10 will take ~1100 minutes to complete all batches. (18 hours)
I tried batches of 25. It works but will take ~550-600 minutes to complete all batches. (10 hours)
I tried batches of 50 and get the same BAD REQUEST the majority of the time.

This worked perfectly fine a week or so ago… Something must have changed when the TCGPlayer devs were prepping to deprecate the old API levels.

Is there any way it can be restored to work with larger requests again?

(Ben) #6

Thanks, that fixed it for me.

I didn’t think that was the issue initially, because like you, my URL had been working fine until a week ago, but I guess that was my issue.