Skip to content
TORNLIFE More

Stepbystep guide in creating a program using API?

Started by Stylin [1474127] on in API Development.

21 replies · 549 views · thread synced · 5 days ago · View on torn.com
About this thread

Posts archived: 22 / 22 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
22
Discussion span
→
Authority score
69 / 100
Historical score
28 / 100
Story score
42 / 100
Engagement score
68 / 100

People posting, likes and official posts are not counted for this thread yet: on threads longer than one page they come from a periodic pass over the archive, which has not covered it.

Most-liked replies

Stylin [1474127]

I think its awesome what programs people can create using this new API tool, made me want to know how to do it myself..

would be good if someone who has knowledge in the subject create a step by step guide to create some basic program so noobs like me get a idea on how its done and can create some programs myself.


just thought i would throw this out there and see if anyone would do it. [:love_chemistry:]



Swatsicle [1593313]

The API really just provides info; string displaying and information manipulation is for most purposes as hard as it will get. These are part of regular programming; I would suggest you give that a shot. I personally like the language Python a lot, and have made some useful API tools with it.

http://learnpythonthehardway.org/book/intro.html and
https://en.m.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3 are useful. The former link is where I learned most of what I know.

Edit: I would also be willing to explain how to get data from the API in Python, with examples.
HandsomePants [1897243]

Subscribed =)

Also I fell in love with your link Swat after this paragraph:

A programmer will eventually tell you to use Mac OS X or Linux. If the programmer likes fonts and typography, they'll tell you to get a Mac OS X computer. If he likes control and has a huge beard, he will (or ze will if you prefer non-gendered pronouns of humans with beards) tell you to install Linux. Again, use whatever computer you have right now that works. All you need is an editor, a Terminal, and Python.
HandsomePants [1897243]

I did a bunch more searching and found that codecademy.com has some easy and free tutorials for working directly with other APIs, in Python and other languages. You definitely need to be comfortable with the structure of the language before diving into these, but they teach the specifics of exactly what you need to work with the Torn API as well.

I started by completing (most of) the learnpythonthehardway.org book in order to (re)introduce myself to actual coding and learn the Python structure, then went to this page at Codecademy: How to Use APIs with Python. After completing that, there are a number of next-step courses for working directly with some bigger APIs in Python here: https://www.codecademy.com/apis. I did the NPR tutorial and by Step 12 or so had enough info to write a script that queries the Torn API and returns the data I want to the console or into a logfile. I'm very proud of me!
chillemall122 [1987723]

codeacademy.com sucks though as they just let you copy and paste code into the editor in the "training" if they limited that it'd be a lot better to use, but as it stands, people can just copy the code from the help section n paste it in and complete the "tutorial/training".. still good suggestions though on what to use to learn this stuff, i'll give it that :P
Mauk [1494436]

People who do that are cheating their own learning. What's the point? If you're doing that for learning, just don't copy and paste things and actually try to understand it.
shak [1592807]

There is a need for this but most of us morons have to get out heads around it before we ask more questions.
Swatsicle [1593313]

It's been two weeks though :p

Anyway, always available for questions, but programming basics are best learned experimenting on your own and following the tutorials posted earlier.
0day [1993635]

Good idea. I think python is a good place to start, although I'm a little addicted to Java at the moment. I think most of it is on the net already; it just has to be translated for easy API use.

Once this crazy busy semester is over and I have some spare time, I'll draft something.
Satangel [60043]

I want to check item market prices for a set of items, and when they are below a price I set, it should notify me or change color or so. Perhaps even auto-buying but let's start at teh beginnging ;)

Can I do that with API and Python?
Swatsicle [1593313]

Yes, easily. I have a similar system implemented on my IRC bot for calculating the profit per flight.

Auto-buy is a lot harder and will result in a 999 fed if you get detected; considering your first question it would be a bad choice to go down that route.

Notification is plenty anyway. Be aware though, bazaars/item markets in the API have a 15-minute delay for price changes and added items to appear, so making auto-snipers for dollar sales or for exploiting typoes is not possible. I've already tried. :P
Satangel [60043]

That's exactly what I thought, the autobuying part is probably too much of an advantage.



I can live with teh 15-minute delay, was to be expected they put that in place. I'll have to search how to extract the data from the API first, got some research to do :) Hopefully there's a Wiki or some kidn of topic for that on here.



Thanks
Swatsicle [1593313]

I'm willing to share my code, if you like. Although it's specific to flowers and plushies currently it is very easy to change to your liking.