Giter VIP home page Giter VIP logo

mtg-api's Introduction

mtg-developers on discord

Please submit all issues for the MTG API here. Any issues about the data itself should be reported to mtgjson.

All releases will be documented in the CHANGELOG.md file. If you are interested in contributing to the API, feel free to contact me at [email protected].

The best way to contribute right now is by creating/enhancing developer SDKs.

mtg-api's People

Contributors

adback03 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

b-rich adamf9898

mtg-api's Issues

Get all types endpoint has some incorrect entries

The /types endpoint is returning various bad entries. Here's what I get if I call that endpoint:

{
  "types": [
    "Artifact",
    "Conspiracy",
    "Creature",
    "Dragon",
    "Elemental",
    "Enchantment",
    "Goblin",
    "Hero",
    "instant",
    "Instant",
    "Jaguar",
    "Knights",
    "Land",
    "Phenomenon",
    "Plane",
    "Planeswalker",
    "Scheme",
    "Sorcery",
    "Specter",
    "Summon",
    "Tribal",
    "Vanguard",
    "Wolf",
    "You’ll"
  ]
}

Gatherer has the following types in the advanced search dropdown:

  • Artifact
  • Basic
  • Conspiracy
  • Creature
  • Dungeon
  • Eaturecray
  • Enchantment
  • Ever
  • Host
  • Instant
  • Land
  • Legendary
  • Ongoing
  • Phenomenon
  • Plane
  • Planeswalker
  • Scariest
  • Scheme
  • See
  • Sorcery
  • Summon
  • Tribal
  • Vanguard
  • World
  • You'll

I realize that some from this list—like "Basic" and "Legendary"—are in the /supertypes endpoint, but there are defintely some that shouldn't be in there, like "Dragon", "instant", "Jaguar", etc.

Amonkhet

Add Amonkhet block cards. Already available in MTG JSON since v 3.8.3 (Apr 21)

Add a "newest edition only" query parameter

The problem:
When using /cards, the search returns both newer and oldest printed cards.
This is a useful tool and allows a lot of possibilities for developers to treat received information when needed.

The "workaround":
But when we don't want to display oldest printed cards, it demands more server queries in order to "advance" the search since the results are paginated, and it ends by consuming json spaces that could host different cards, minimizing server requests.
On my end, i treat the results by searching oldest editions when newers are found, and simply trash those oldest editions.
I didn't shipped my application yet, and i will not until i find a better way to treat this information, avoiding unecessary requests and throwing api money by the window.
I think this is very counterproductive to do, since requests means money.

The suggestion:
I think that computional cost of sorting the results to return only newest printings when a "boolean" parameter is added to the query could mean a most efficient way to treat this information.
As the API grows and it's users develop new ways to use it, i think this could also avoid less or none money being thrown by that window.

I really appreciate the work of everyone involved in this API, and i want to contribute as many as possible when i ship my application. Until that i must say: Thank you!

Include an abilities attribute in the card object

Currently if I want to know if a create card has lifelink, or haste for example I need to trawl through the card text attribute, but this is mostly unstructured data.

eg: https://api.magicthegathering.io/v1/cards?name=banehound

{
        "name": "Banehound",
        "manaCost": "{B}",
        "text": "Lifelink, haste"      
}

Please include a more structured card attribute for abilities, this will help working with the API.

{
        "name": "Banehound",
        "manaCost": "{B}",
        "text": "Lifelink, haste",
        "abilities": ["lifelink", "haste"]
}

Bonus points for having an abilities API itself with associated rulings and instructions.

Add card price

Hi,
I saw the fields below in Card.java :

private BigDecimal priceHigh;
private BigDecimal priceMid;
private BigDecimal priceLow;
private BigDecimal onlinePriceHigh;
private BigDecimal onlinePriceMid;
private BigDecimal onlinePriceLow;
But they are null.

it is planned to feed these fields ?

"Formats" Endpoint

Add an endpoint that returns all valid game formats (standard, commander, legacy, etc.)

Possibly like this:

https://api.magicthegathering.io/v1/formats

Possible bug adding additional foreignNames for each basic land

I'm not sure if this is intended or it really is unexpected, or if I got it wrong, but here it goes:

I requested the Zendikar expansion set (https://api.magicthegathering.io/v1/cards?set=ZEN) and looked at it with a JSON Viewer app, it seems as if for each basic land, like a plain, with different multiverseid (different artwork) in it's foreignNames it is being added both the respective language counterpart (ie: french "Plaine") and all the variants from all the other plains, like an MxN product. I think one plain with a specific art should only have one translation for each language with the same art.

Sorry my english is a little bit lacking. To be more clear, a test case:

Plain, number 230, multiverse id 201973, has 24 foreignName entries, 0 to 5 (6 count) are in French, only one of those matches the image with the translated text (the one with multiverse id 206986, the remaining 5 which are indeed a french translation for a plain, have though different artwork).

Plain, number 230a, multiverse id 195179, has 24 foreignName entries as well, 0 to 5 in french as well, only one of those matches this exact artwork, the other 5 are the other plain variations and one of them is the entry above).

And so on.

I noticed this as I'm building a database that needs a 32 char reference code that must be unique and I'm using set code, first chars of the name, 2 digits for the language and multiverse id (or 6 lasting from your hash code if mid is missing) and I got a few repeated values when I hit the land part.

Include mtgjson extras?

mtgjson provides extras (Archenemy schemes, Planechase planes/phenomenon, etc.) but they are not available from the mtg api.

Can't search by mana cost

As mentioned on the website for this API, searching for mana cost is currently unsupported, though the property can be accessed. Searching by mana cost currently yields any cards i.e. with no restrictions.

Is this feature currently under development?

Incorrect multiverse ID

At first I thought this might be a data issue with the mtgjson, but it's correct there. But wrong here. The gearhulks are in both MPS and KLD. The ones in MPS show the multiverse ID from the ones in KLD.

https://api.magicthegathering.io/v1/cards/420588 should be the one from MPS but gives a 404

https://api.magicthegathering.io/v1/cards/417582 is the one from KLD and works fine.

https://api.magicthegathering.io/v1/cards/?set=MPS shows the cards, but the Cataclysmic Gearhulk has the multiverse id from the KLD, not the MPS.

http://www.mtgjson.com/json/MPS.json has all the correct information.

Hope that helps.

Card legalities outdated

Greetings!

First of all, congratulations for the great MTG API.

I'm pretty sure card legalities aren't refreshed since this year's beggining, cause in January they've banned cards such as "Gitaxian Probe", "Golgary Grave-Troll", so the legalities for these cards are outdated, additionally some cards still have the "Standard" Legality, even when they were already banned from this game format, as we can see in "Emrakul, the Promised End" and "Reflector Mage".

Is there a kind of "legality lease time"? If yes, how much time is it?

Boosters are 14 cards, can include multiple basic lands

The 14 card limit makes sense, since Dragon's Maze (I don't know if there have been other sets) makes special use of the land slot, and that can be emulated client-side, or even added server-side after a 14-card rarity pick.

I think excluding the "Basic" supertype in the common slot query, and then adding a random basic (or gate/shock for DGM) to the pack after constructing it would solve this.

Roadmap

What is the roadmap of the project?

Incorrect Oracle text

"text" field for cards does not reflect current oracle text, nor is it consistent. Compare different printings of Winter Orb. 3 printings reflect current (and original) oracle text, 7 have previous (but not original) oracle text. Also, every card prior to Kaladesh still shows old token phrasing.

My apologies if this is not the place to report this.

Missing `multiverseid` (+ `imageUrl`) field(s) for latest expansion

Hello there !

First of all thanks for the project, I just started using it recently & it looks great !

I noticed that the multiverseid field was missing for cards of the latest expansion (currently "Ikoria: Lair of Behemoths"). Consequently, the imageUrl field is also missing.

According to the documentation, cards from this set should have this field since it exists on the Gatherer. I was wondering if this feature was still supported, or if this might be a bug.

Thanks in advance, cheers !

Special character don't seem to work

When requestion a card with a special character in it's name by name an empty reply is returned.

For instance, when I try to get "Ætherize" by name:

GET https://api.magicthegathering.io/v1/cards?name=Ætherize

The returned json is:

{"cards":[]}

Replacing "Æ" with "Ae" or "AE" doesn't work either.

It would be nice if both "Ætherize" and "Aetherize" were supported as names in requests.

No way to get cards at random?

I couldn't find any way to get cards at random, either serverside via a random sort order or clientside via a monotonically-increasing ID which I could randomise. (I couldn't even get just one result—pagesize=1 seems to be ignored.) I'd like to be able to get a random common, and this API seems to be the only way of accomplishing that.

Not output Mythic Rare Card From API /sets/<code>/booster

Hi.
When I developed application with Magic: the Gathering API, I have notice this issue.
API /set/[code]/booster don't output Mythic Rare on JSON.

Attached File is this example. It's RIX output.
You search words 'colors', then you can know here is only 13 cards. Originally, should be 15 cards.
I was tring several times, if this API output Rare, here is 14 cards.
(I think, this is also fewer, but I don't have Idea of this issue.)

Please resolve this issue.
I'm cheering you.

best Regard

example_RIX_booster.txt

iOS Client Framework

I'd be interested in developing a Swift framework so iOS clients could easily consume this API, if that was something you'd be interested in working with me on? I've been looking for another side project to work on, just recently got into MTG from some other developer friends at work, and had some ideas for an app that would need an API like this to consume. Being newish to the game, most of my questions would be related to the game itself, as I'm really only familiar with the newest expansions and wouldn't want to make assumptions about the game as a whole based on that.

What do you think?

Rename Custom Response Headers to use camelCase or snake_case

The current format of the Response Headers (hyphenated) causes issues in JavaScript (and possibly other languages) when using the dot notation for accessing properties of objects, forcing the use of bracket notation instead. Examples:

console.log(headers.rate-limit); // Error (trying to subtract limit from headers.rate)
console.log(headers.["rate-limit"]); // 5000
console.log(headers.rateLimit); // 5000
console.log(headers.rate_limit); // 5000

JavaScript prefers camelCase for variable/property names, so that would be the ideal naming convention, but if this conflicts with other SDK's this might not be the best choice, wherein snake_case would be an acceptable alternative. More info:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors

Suggested names for the existing headers:

  • pageSize
  • count
  • totalCount
  • rateLimit
  • ratelLimitRemaining

Limiting CMC When Searching at Random?

Is there a way to set a max CMC or input multiple values for a possible CMC when searching at Random?
It looks like currently colors, supertypes, and subtypes are the only fields that allow multiple values.
For instance say I want to fetch a random equipment (think MoJhoSto) and have it be 3 CMC or less, can I achieve this through cmc=3|2|1|0?

Or is there a way to accomplish that I can't seem to figure out?

App Crash?

Sometimes i get this:

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.

Duplicates returned for "Nalathni Dragon"

Came across this randomly when a co-worker searched "dragon" in our app.

to recreate hit this endpoint:

https://api.magicthegathering.io/v1/cards?name=Nalathni Dragon

The card "Nalathni Dragon" get's returned twice from the api if he matches the query. This is mostly a pain, but can be worked around. The issue could be there for other cards, but we haven't seen it.

Search in portuguese

Hi,

I'm consuming this API and I tried to search a cardname by language, and seems that the search in portuguese is not working (Tried get with spanish for example and works fine).

What could it be?

I am calling endpoint?name=&language=portuguese

Best regards,

Enforce exact matches on `colorIdentity` fields

Situation

Let me prefix this issue by saying that I'm unaware if this is possible already. I have tried to do this myself and failed, and have seen others' with the same questions/requests as well.

Example

Consider the following request: https://api.magicthegathering.io/v1/cards?random=true&pageSize=1&contains=imageUrl&colorIdentity=U

The intention behind this is to match 1 random card, with an image field, and a color identity of exactly only blue. However, the results will consist of any combination that includes blue. This occurs both with the , and | operators, as well as with the color field. Personally, I'm only interested in colorIdentity.

Is there a way to add this behavior, if not already present?

Special Characters and Exact Name Search - No Results

(Related to Issue #2 )

When using exact name search using double quotes, card names with special or non-alphanumeric characters return no results.

For example:

  • name=Ætherize works, name="Ætherize" does not.
  • name=Gideon returns result with first element with name "Gideon's Phalanx", but name="Gideon's Phalanx" returns nothing
  • Tested cards containing '-&!?: All with same result. (Characters encoded for URLs in all cases)

Problem fixed in mtgjson not propagated to API yet

Hello,

I described a data problem at the mtgjson repository - issue #288 but then found out in their changelog that this has been fixed already.

I am guessing the fact that this is still not fixed in the API is that the database of it is from before Jan 23. How often is the database behind the API rebuild?

Thanks

Multiple problems with generating boosters

Thank you for providing a great and free resource for MTG developers! Everything is working great for me, except for the /sets/(set)/booster endpoint.

  1. Some sets return an internal server error. E.g.: Journey into Nyx (JOU) or Gatecrash (GTC)
  2. Sets that do work return the same card for each rarity. E.g.: Khans of Tarkir (KTK) or Oath of the Gatewatch (OGW)

Translated data

Hi !
I was wondering if there is any way to get the data in a specific language. Not only the card name in "foreignNames", but also the texts and everything.

For now it seems that the requests made with the multiverseid from a specific language returns "404 - Not found".

Example:
If I try to get https://api.magicthegathering.io/v1/cards/386616, in the foreignNames node, I find the multiverseid 387692 for French, but if I try to get https://api.magicthegathering.io/v1/cards/387692, I have a 404.

Any chance we can have the full translated data ?

Changelogs endpoint returns an empty array

There's a substantial changelog on this project page, but the changelogs endpoint doesn't return it. In the Python SDK this was breaking a test that checked that the changelog was non-empty. I'm not sure how this affects other SDK repositories.

It's a really minor thing, but it may be blocking progress in other places as it was in the Python SDK.

Missing Identifier for Double Face Cards

Hi,

I came back to working on a project that I had set down for quite some time in python, and discovered that my code for handling double face cards was broken. I am using the Python SDK. After debugging the issue, I came to realize that the issue was that the way that double face cards are handled in the API is very different now.
As seen in this simple GET request for getting the card
Thing in The Ice
which has a back side of
Awoken Horror

https://api.magicthegathering.io/v1/cards?name=Thing+in+the+Ice

this response has the name of the back of the card is appended to the end of the name property with a delimiter of //.

Thing in the Ice // Awoken Horror

This is strange behavior, especially since the old behavior that I remember, associated double face cards with one another by using a property called names, which first the name of the front of the card, followed by the names of all other associated cards. I have noticed this behavior in all double face cards and cards which have related cards, AKA. all cards that used to have more than one name in the names property.
This is seen in the docs which have not been changed

https://docs.magicthegathering.io/

names
Only used for split, flip and dual cards. Will contain all the names on this card, front or back

This names property is no longer present. If you examine the response more closely, you can see that the card
Awoken Horror
the transformation of
Thing in the Ice
has the exact same name as
Thing in the Ice.
this makes it impossible to tell the difference between the front of a double face card and the back. Unless I am missing something, a rather fundimental aspect of the API is not working as expected.

Why did such a fundimental change to the API occur without letting users know. It broke my project, and I am sure it broke others. I did some digging on the Mtgio API Discord channel, and found a similar post

https://discord.com/channels/224178957103136779/224179359848726529/824121768822308894

This post outlines the same issue I am having. Also mentioned here is a replacement property for names

I was told that names in mtgjson was changed to otherFaceIds, but there's no mention of that in the docs for mtgio and that's > not being returned by api calls either.

I can confirm that I am not seeing a property called otherFaceIds being returned either.

Is there some new way of determining the difference between the front and back of a card? If so, this should be updated in the docs. Such a fundamental change to a publicly used API should probably be avoided so that such a change doesn't break all the client's code. A fundamental change in the response like this should probably be in a version 2 of the API.
If this is a bug that for some reason has not been addressed yet, can we see about addressing this issue as soon as possible?

Thanks,

Timothy Breitenfeldt

Exclusion queries

Hey, great project! I was wondering if there are any plans to support exclusion queries so we can query for things like "all colors, except black" or "all creatures from XLN but no dinosaurs"? Could maybe be done with a negation using a -?

Add a 'count' to the response

Most likely way to do this:

  • Include Total-Count info and next/prev urls in the "Links" header section

Example:

Link: <https://api.magicthegathering.io/v1/cards?page=1>; rel="first",
  <https://api.magicthegathering.io/v1/cards?page=173>; rel="last",
  <https://api.magicthegathering.io/v1/cards?page=6>; rel="next",
  <https://api.magicthegathering.io/v1/cards?page=4>; rel="prev"
Total: 4321
Per-Page: 10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.