Steam Trading Cards: What endpoint to use for own inventory - json

As the title says and in short: I want to get the count of cards I have for a given game.
I've seen this discussion but I don't want to see all the inventory (no pagination needed), instead I want to get data of a specific AppID.
https://steamcommunity.com/profiles/<xxxx>/inventory/json/491080/2 seems not to be working as it returns {"success":false}

AFAIK, there is no such endpoint - you'll need to fetch 753/2 and count them one by one.
Trading cards are part of your Steam inventory (AppID code 753) and not game inventory. For example, TF2 cards are placed inside your Steam inventory (753) while the actual in-game items are inside TF2 inventory (440).
Another possibility would be to crawl http://steamcommunity.com/my/badges and get the numbers from there. This is what many automated scripts do.

Related

Repeatable Multi-Colum Data Rows in Wordpress Custom Post Type

I'm moving a sports website from .asp to wordpress.
I have two custom post types:
Players
Tournaments
I need to be able to enter scores into the tournaments for players from the player post type.
The scoring tablulation is as follows:
Player ID First Name Last Name City State Points Place Scores
And I need to be able to add more rows, selecting the players to add the above info for.
The current ASP tables look like this, for each tournament:
And I need to be able to add unlimited rows (repeater).
It would be easy if it was just one column, I could use something like Advanced Custom Fields repeater field, but I do not know how to add rows of related multi-column data, which I can then query and display on the front-end.
Also, I would make each scoring row it's own post, but it would be waaay too many posts.
What I want, is for each tournament (stored in the tournaments CPT), to be able to add the scoring rows there, selecting the player from the player post type, and filling out the columns, as seen, with the ability to add as many rows as there are players for each tournament.
Thank you for your help follow programmers! I've been doing this a fairly long time, but this is a new use-case for me.
You can use Meta Box Group plugin. It allows you to create repeatable group of fields.
So, in your situation, you need to create a group of player (post field), first name, last name, city, state, points, place, score. Then make the whole group repeatable. (In Meta Box, it uses another term clone).

Printing Store Database Design

I'm going to build an online printing store system which can be accessed by both the public (to order) and admin (process order).
This store I'm developing for has a lot of typical advertising products such as banners, name cards, rubber-stamp etc. And under these categories, there are several types of different items (based on different materials, finishing, size, quantity).
Admin can add new category, materials, types, and everything else that is required to create a new product.
To input a particular product price, will require all the details (ex: Banner, using material synthetic paper, size 2'x2', 100pcs, finishing extra 4 rings).
However, I'm stuck at trying to connect the other attributes since not every item will have the same attributes. And how to tabulate the drop-down menu for customer's order form and admin's management form (for the purpose of add, delete, edit)?
Update:
My current design of the database. Please correct me if there's a better solution.
Thanks!
ERD

Can i store multiple add-on for a product in column of table as JSON?

Prob: I have a table which contains list of toys(dolls).while purchasing user can choose options(black dress or white dress) and accessories(earring and anklet).
options 1: First i thought of adding 2 different table for options and accessories.
http://imgur.com/a/FnE6O
But as i am never going to filter/search on these table so i thought of putting these options as JSON in seperate column.So that frontend can easily render JSON as options to user
QUES: As i have to add total price from options and accessories
Is this ok to store these type of details as JSON format?
I am also open for other suggestions which is easily maintainable
If you are using an sql-database (and it looks like you are) I really advise you against keeping the data as JSON inside.
Even though MySQL 5.7.8 gives you a good way to access data inside json types, you never know when you are going to need to filter/search/group based in that data.
A quick example that jumps here is that you want to give a user that buys a new doll (productid == 1) a list of all the add-on that people that also bought that doll (productid == 1) purchased in the last week (or month). If you are going to save that data as JSON it will be very hard to query.
I know that your example shows only the meta-data of the add-ons and options, but it's "easy" to go and also save the actual purchases that way (just as add-on to the purchase-row itself).
I advise against it.

How to avoid paying for the same item multiple times

I'm trying to draw a database design of an ecommerce, and fulfilment of order platform. The company currently has a distribution centre for fulfilling the orders. But they want to extend this to use its stores for a part of the fulfilment process. I have designed a database of "internet sales" and "store sales", but I am stuck on the fulfilment of the internet order, and I wonder if any of you can help me with this.
Scenario : When the customer places in an order, and the distribution centre doesn't have a stock of an item to ship to the customers, the item needs to be taken from one of the stores. This item is then sent to the customer.
But the problem is that I can't just take an item from a store, and then send it to the customers, because the item hasn't been sold in the store, its (store) stock database isn't going to be updated. If I put the item through the cash machine, the item is removed from the stock table, but there are two transactions for the same item - one transaction from the internet, and the other from the store.
I guess my question is, how do I go about processing internet orders, and avoid having two transactions on the same item?
Any helpful pointers on this issue is greatly appreciated.
Update : Here's what I have done so far after advice from Jo Douglass,
Database Design Here
Sorry, I can't post images, because I don't have enough points. And please note that the above database design isn't complete
It sounds like you have a Transaction entity, and you have or are planning on having some logic which ensures that when one of these is created for an Item, your system knows to deplete the stock level for the relevant location (either a store of the distribution centre).
You could use an entity which shows an Item being transferred from one location (a store) to another (a distribution centre), and then create some logic which works very similarly to your existing logic - depleting the stock level in the starting location, and increasing the stock level in your destination location. Then when you carry out the last part of the process (sending the item to the customer), you'll have a Transaction showing that and depleting the distribution centre's stock level. Depending on the rest of your model, you might carry this out via a change to the Transaction entity, or by creating a new entity altogether.
Alternatively, if that doesn't really model what's happening in the business very well, then maybe you just need to modify your logic (and possibly your model - hard to tell without seeing your existing model). Rather than only being able to create store transactions via use of the cash register, perhaps you simply need to be able to create a store transaction that's been kicked off via the Internet.
One idea is to go ahead and treat the item as sold from the store (through an online transaction) and credit the store's account with the sale price. The distributor has probably already received the wholesale price from the store so it's happy, the store gets credit for the sale (with at least some part of the shipping charges) so it's happy, and you don't have to create new transaction codes or any other modification to the existing database.

How do we know a survey_id to be able to call the API?

The API calls require a survey_id.
There is a surveyID in the web link but that is an alphanumeric code that is not the same as the survey_id. eg https://www.surveymonkey.com/s/STB97HW is surveyID 47481373
The "Edit survey" pages do not show the surveyID. (by the way, I've just found that the category eg "Just for fun" is another one of those survey attributes not returned by get_survey_details)
So a user can not make a note of the surveyID for later querying.
A user can download a CSV file of data, as a pair of "Sheet_1.csv" and "Collectors.csv" but neither of those files contain a surveyID. It would be a useful enhancement if, given a data CSV download, one could query the surveys list to find the one that has a given CollectorID.
The user could copy the survey title into a query and search the survey list for ones that match, assuming they copy it correctly or spell it correctly if entering it. Or the query could be by a date range, to get a list of surveys, present them to the user, and ask them to pick the one they want.
Is there no way that a user can discover a surveyID, either when designing the survey or when it is closed, in order to uniquely specify it for retrieval without having to go through this search process?
You need to use the "get_survey_list" API to get a list of survey ids, you can then feed these into the other API methods.
Note that a survey link is actually an individual collector for that survey, and not directly associated with a survey - i.e. it is associated with a collector, which is then associated with a survey. You can have multiple links (or collection methods) for one survey that way. You can get a list of collectors for a given survey using get_collector_list. get_collector_list can also return the list of URL links for these collectors, if they exist.
There is currently no way to get a survey_id without going through this method - these survey ids are not meant to be visible to the end user, usually for API integrations a list of the user's surveys is presented to them (via the get_survey_list method) and then they select one. If you're interested, have a look at Mailchimp, Zendesk or Hootsuite's integrations.