Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Parse.com Help!

What exactly is an API request? What exactly counts as "data transfer"? If lets say, a user sends a message on an app and that message is sent and stored in the cloud. But no messages are ever actually downloaded and displayed to the user later via a query. Meaning, it gets stored in the cloud and that's it. Does sending the message to the cloud for the first time count as an API request? Does it count as data transfer?? Essentially, What is the difference between file storage and data transfer? You can use Snapchat or Twitter as an example if that helps. Thank You.

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

These are excellent questions. I hope to answer them over the course of my courses, but here's a shot at a briefer explanation. :)

API

API stands for Application Programming Interface. The word is thrown around a lot because it's used a lot, though you might not realize it at first. Any system of existing code that you interact with has an API. The standard libraries of every language have an API. It's the interface to all the code that runs behind the scenes. Let's look at an example from Java:

String

Here's the String API documentation from Oracle. This details all the methods we can call on a String object. So to get the length of a String we use the length() method.

The API is this whole interface that we can interact with. We can call any of these methods from the API.

Web APIs

Now a lot of the time when people are talking about APIs, they are specifically talking about web APIs. These are APIs that are available to call over the web. They have a clearly defined interface that we can interact with in code, and they return some sort of data to us.

Here's an example you can view in the browser. We request data from a specific URL, and that data is returned in JSON format: http://reqr.es/api/users?page=2

This is the "data transfer" that you are asking about. You can send data to APIs on the web just as well as receiving data. You asked if sending data to an API like this counts as data transfer. Absolutely! We see this example in the Build a Self-Destructing Message App, where we use Parse.com as our back-end in the cloud. We send data to the back-end, which is an API request. Retrieving it is another API request. For sites that track API calls, this would count as two calls.

Your last question is about the difference between file storage and data transfer. They may be the same thing, depending on the context. You can store files locally on a device, which doesn't involve transferring any data. But as soon as you want to store it in the cloud, you need to transfer the file data over the network. Think of storing images in the cloud as a good example of transferring image file data to a server somewhere.

On the other hand, data transfer includes all other types of data that isn't file-based. So a tweet involves just sending the text data over the network to Twitter's back-end (using their API).

One last thing...Let's look at the example of sending a tweet that includes a picture. We are transferring data in two parts. First is the text data itself of the tweet, and second is the file data. Both the text and the file are stored on the back-end and can be retrieved via an API call.

Hopefully this helps, but please let me know if you have any follow-up questions or want to discuss further.