What API endpoints are there?


(Brunoryckaert) #1

I’m a developer, and I like to tinker around with sites I use. I heard Neonmob has an API, and searching these forums, I found one thread covering the topic, containing two endpoints like https://www.neonmob.com/api/setts/. I can’t seem to find any more information on the matter…

Which endpoints are there? Are there some docs on them?


(Naud van Dalen) #3

You can browse through the site with the developer tools open in order to find API URLs.

I did this and spent a few hundred hours developing tools for NeonMob. I have to say the API is pretty bad. :persevere:

Here are a number of bad API designs:

  1. There are multiple different URL styles (napi.neonmob.com/[page] and neonmob.com/api/[page] and rarely just neonmob.com/[page])

  2. There are two different output styles (JSON and the human readable Django REST framework) that are used by different endpoints. Although if the API is used by a website, you almost always get JSON automatically.
    a. One endpoint randomly shows either JSON or Django REST framework, which caused my tool to break sometimes before I saw it and added ?format=json to the end of the URL which is normally never required because Django REST framework normally knows whether you use the browser or a website.

  3. The output is often straightforward, but sometimes uses a very weird structure with deferreds (always empty), payload and refs where they link to a reference in an array, which you must then select instead of just putting the data directly in the array. It sometimes makes the size of the page smaller, but not always.

  4. One endpoint works with old sets, but not with new sets.

Here are a few examples where data is missing/overwritten, which means you need to use the API often to prevent missing data:

  1. Activities in the activityfeed overwrite older activities of the same day and there is no way to get them back if you haven’t stored the URL before it’s overwritten.

  2. Activities have relative timestamps.
    a. Trades have absolute timestamps in their own endpoint.
    b. There is a way to get the absolute timestamp of the LAST opened pack of a set. I found this endpoint too late, so I already made a complex system to narrow down the relative timestamps, which I should now remove.

  3. Opened packs don’t show the print numbers and you can’t see if cards are duplicate or the amount of prints you got in a pack.
    a. New sets have auto incremented print ids, so the highest ids are the newest prints.
    b. You should store all prints and compare which ones are new for old sets because their print ids are not auto incremented. Every card of an old set has a range of print ids with a corresponding print number. Although a print with a print number that’s 100 higher does not have a print id that’s 100 higher somehow, so it’s a little vague.

I will post the actual endpoints tomorrow when I have time.


(Nick Barrett) #4

Are you able to post those endpoints?


(Naud van Dalen) #5

User data
https://www.neonmob.com/api/users/[USER_ID]
https://napi.neonmob.com/user/[USER_ID]/owned-setts-metrics
(All sets with simple data and core/chase/variant piece counts and how many of those you own)
https://napi.neonmob.com/user/[USER_ID]/print-counts
(Multi dimensional array of card ids and the amount of each card you own)
https://napi.neonmob.com/user/[USER_ID]/display-case
https://www.neonmob.com/seconds-until-freebies-ready
(POST request for some reason)
https://www.neonmob.com/ num-freebies-left (space to fix auto link expansion)
(Gives number of freebies left, but also the seconds until freebies ready, so use this one)
https://www.neonmob.com/api/friend (list of friends)
https://www.neonmob.com/api/friend/[USER_ID] (check if user is friend)
https://www.neonmob.com/api/block_user (list of blocked users)
https://www.neonmob.com/api/block_user/[USER_ID] (check if user is blocked)

Activities
https://napi.neonmob.com/activityfeed/user/[USER_ID]/?amount=[BETWEEN 10 AND 100]&page=[BETWEEN 1 AND 100] (activity feed of user)
https://napi.neonmob.com/activityfeed/sett/[SET_ID]/?amount=[BETWEEN 10 AND 100]&page=[BETWEEN 1 AND 100] (activity feed of set)
https://napi.neonmob.com/activityfeed/story/pack-opened/[ACTIVITY_ID]
(More details for pack opened activity)
https://napi.neonmob.com/activityfeed/story/trade/[TRADE_ID]
(More details for trade activity. api/trades contains more data, but only if you are either the creator or recipient of that trade)

Categories
https://www.neonmob.com/api/categories/?page=[PAGE] (3 categories per page)
https://www.neonmob.com/api/setts/legacy_list/?category=[CATEGORY]&metrics_id=[USER_ID]&user_id=[USER_ID]&page_size=[BETWEEN 1 AND 50] (Sets in a category)

Sets
https://www.neonmob.com/api/setts/[SET_ID]
(Detailed information about a set including cards per rarity and owned cards per rarity)
https://www.neonmob.com/api/users/[USER_ID]/collections/[SET_ID]
(This is used on collection page)

Cards
https://napi.neonmob.com/user/[USER_ID]/sett/[SET_ID]
(All cards in set with amount prints you own. This is used on collection page)
https://www.neonmob.com/api/sets/[SET_ID]/pieces/?offset=0&limit=[BETWEEN 1 AND 100]
(Cards for set in chunks of at most 100. Shows detailed information including total prints. This is used on series homepage, but only works for old sets)
https://www.neonmob.com/api/sets/[SET_ID]/piece-names
(All cards in set with basic information. This is used on series homepage)
https://www.neonmob.com/api/search/prints/?user_id=[USER_ID]&partner_id=[PARTNER_ID]&not_owned_by=[PARTNER_ID IF UNOWNED CHECKED]&duplicates_only=[TRUE IF 2+ CHECKED]&sett=[SET_ID]&common=[true or false]&uncommon=[true or false]&rare=[true or false]&veryRare=[true or false]&extremelyRare=[true or false]&chase=[true or false]&variant=[true or false]
(Search prints of anyone, of any set, with any rarity, duplicates or not, unowned by partner or not. If any rarity is true, any rarity that’s not true won’t be displayed. If no rarity is true, all rarities will be displayed. This is used when selecting cards for a trade)
https://www.neonmob.com/api/users/[USER_ID]/piece/[CARD_ID]/detail
(Detailed information about card with all prints with print numbers and basic information of set and creator)

Packs
https://www.neonmob.com/api/pack-tiers/?sett_id=[SET_ID]
(Information about different pack tiers like free and paid packs)
Open packs links below are used with POST:
https://www.neonmob.com/api/tiered-pack/1/[SET_ID] (Open Base pack of new set)
https://www.neonmob.com/api/tiered-pack/6/[SET_ID] (Open Ruby pack of new set)
https://www.neonmob.com/api/tiered-pack/2/[SET_ID] (Open Diamond pack of new set)
https://www.neonmob.com/api/free-pack/[SET_ID] (Open Free pack of old set)
https://www.neonmob.com/api/purchase-pack/[SET_ID] (Open Paid pack of old set)

Trades (only usable if you are either the creator or recipient of this trade)
https://www.neonmob.com/api/trades/[TRADE_ID]
https://www.neonmob.com/api/trades/[TRADE_ID]/accept (accept a trade)
https://www.neonmob.com/api/trades/[TRADE_ID]/decline (decline a trade)