deckstats.net
You need to be logged in to do this.
The buttons above will open in a new window. Please return to this window after you have logged in. When you have logged in, click the Refresh Session button and then try again.

Author Topic: Deckstats API?  (Read 3954 times)

ascii_

  • New Member
  • *
  • Posts: 3
  • Karma: 10
  • Decks
Deckstats API?
« on: November 05, 2018, 10:34:18 pm »
Hello, sorry if this is the wrong place to ask, but it seemed like the closet. But does Deckstats have any sorta api? My friends are working on a program to import decks into tabletop sim, he mostly has tapped out done but eventually wants to try and get deckstats and mtggoldfish too.
So I figured I could do some leg work and see what we have to work with. Thanks

Morganator 2.0

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2633
  • Karma: 2502
  • Decks
Re: Deckstats API?
« Reply #1 on: November 06, 2018, 08:42:30 pm »
I can't answer if Deckstats has an API (I don't even know what it is). Nils is the one who can answer that.

In the meantime, tell me more about what you're making. It sounds interesting.

ascii_

  • New Member
  • *
  • Posts: 3
  • Karma: 10
  • Decks
Re: Deckstats API?
« Reply #2 on: November 08, 2018, 10:43:46 pm »
Well, when I first started playing (around a year or two ago) we used TableTop Sim on steam as it was an easy way to play the game cheap. So my friends have forked another projects that downloaded the card images and make an object for tabletop. With the popularity of scryfall they changed the image importer to download from them because they have great image quality.

Right now the importer only works for TappedOut and because I mainly use deckstats, he wanted to add support for you all too.

Here is the current dev version: https://github.com/erieflin/TTSDeckImporterTappedOut/tree/overhaul

kiochy

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 44
  • Decks
Re: Deckstats API?
« Reply #3 on: November 08, 2018, 10:53:06 pm »
if everything else fails, try contacting him directly?

https://deckstats.net/?lng=en&about=1 // https://koelling.co.uk/contact.php?lng=en

Nils

  • Hero Member
  • *****
  • Posts: 1792
  • Karma: 854
  • Decks
Re: Deckstats API?
« Reply #4 on: November 09, 2018, 01:33:04 am »
Thank you for your interest in adding support for deckstats to this! In general I am happy to support this but it will depend a bit on exactly what kind of API you need.

A full public API (with user authentication etc) is something that has been on my to-do list for ages. Unfortunately that is still not close to being done.

However, if all you need is the deck list then I think you might be able to do something much simpler:

  • Ask the user for a link to the deck they want to import. It has to be saved to their account and public. Eg.: https://deckstats.net/decks/24472/1126678-guttersniplicate
  • Extract the owner ID and the deck ID (eg. 24472 and 1126678, respectively) from the URL
  • Make a request to our internal API using these IDs:
    https://deckstats.net/api.php?action=get_deck&id_type=saved&owner_id=OWNERID&id=DECKID&response_type=list

The result will look like this: https://deckstats.net/api.php?action=get_deck&id_type=saved&owner_id=24472&id=1126678&response_type=list

In principle this is an internal API that might change in the future. However, I don't anticipate any major changes to this anytime soon so you should be pretty safe using this.

Is this the kind of thing you were looking for?

ascii_

  • New Member
  • *
  • Posts: 3
  • Karma: 10
  • Decks
Re: Deckstats API?
« Reply #5 on: November 09, 2018, 01:40:10 pm »
Thanks for letting me know that there is something and we don't need to scrape pages! I think eventually my friend would like to add support for making decks from private decks, I understand that it may not be supported yet.

And a question I can see my friend asking but is there any documentation on the different arguments?
action=get_deck
id_type=saved
response_type=list

onlyragrets

  • New Member
  • *
  • Posts: 1
  • Karma: 0
  • I'm not actually good right now but having fun
  • Decks
Re: Deckstats API?
« Reply #6 on: October 15, 2019, 01:13:23 am »
Hello, I'm looking for a documentation or an api to use Deckstats for an app.

Is there any news on this subject ?

Thanks again.
SebeR :)

Shik@93

  • New Member
  • *
  • Posts: 1
  • Karma: 9
  • Decks
Re: Deckstats API?
« Reply #7 on: September 10, 2021, 12:34:24 pm »
Hi!
I'm working on a Magic project and I would like to use deckstats as the back end to store users' decks.
For this reason, I'll try to revive this thread.

So far, given a user, I have been able to programmatically get the list of folders and decks.
What I am missing right now is the ability to programmatically create new decks from scratch (cloning existing ones is not sufficient for me).
So, I am here to ask you if there is a way for me to create decks given a list of cards. I don't need an official or stable API: the way could also be slightly convoluted.

Thanks a lot!