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

Qasim Albaqali
Courses Plus Student 259 PointsFetching data from website
Osclass is a Open Sour Classified Ads. I want to know how is possible to fetch information from my website to an Android App. For example I want to make the user of my app to register on my website while using the app and not having the need to go on my website and register from there. So let's say for example someone registered on my website through a web browser and then he downloaded my App, he will be able to sign in through the app because my website is connected to the app. And I would like to fetch for example the categories and the listing of the categories on my website. I tried to search on google since Osclass is written in PHP, HTML and CSS so I thought it would be the same fetching information from a Wordpress website to Android app but I was really confused. Should be there an API or JSON from Osclass themselves so I am able to create an App like I described or I can do it by myself creating JSON or whatever that I need to do. An example would be Gumtree.com (Classified ads website) and their app https://play.google.com/store/apps/details?id=com.gumtree.android Is there a tutorial showing how to fetch information from websites such as the login details and the ability to register? Thank you in advance.
1 Answer

Ben Junya
12,365 PointsYou're going to need to look into what sort of information Osclass spits out. Personally, I have no experience with it, so you'll need to read the documentation for that platform yourself. I can't give you a straight answer on if it will work or not.
As far as the kind of data that's going to be thrown at your application, Android works excellent with JSON, although you may want to look at using an open source library like GSON in order to easily parse the data, as sometimes the data that's returned will have lots of layers and elements.
If you're looking into parsing JSON data, the "Blog Reader" tutorial on Treehouse is a great place to start, especially since it sounds like you've got some previous programming experience.
Potentially what you could do is just make a WebView app that has the mobile version of your website on it. That would do it, but it would be an extremely lazy way out, and your app would do nothing except utilize a webview. I strongly advise against going this route, because people are looking for a mobile app experience, not an app wrapper around a mobile website.
Qasim Albaqali
Courses Plus Student 259 PointsQasim Albaqali
Courses Plus Student 259 PointsThat's what I have currently which is a Webview. It looks OK but I want to create an app that is same as Ribbit. Sign in page then Ads pages etc. that's why I want to implement JSON.
Ben Junya
12,365 PointsBen Junya
12,365 PointsThen you need to see if Osclass supports JSON and if it will send you user data with JSON. That's your next step.
Qasim Albaqali
Courses Plus Student 259 PointsQasim Albaqali
Courses Plus Student 259 PointsIt does support JSON but how will I know if it will send user data? Any idea or should it be in the doc?
https://github.com/osclass/Osclass/blob/master/oc-includes/json/JSON.php
https://github.com/jun283/aRestAPI4Osclass
Ben Junya
12,365 PointsBen Junya
12,365 PointsPutting it nicely, that's your job as a programmer to figure it out.
Qasim Albaqali
Courses Plus Student 259 PointsQasim Albaqali
Courses Plus Student 259 PointsOkay thanks!