Getting json data about posts - android

I learned in a blog reader tutorial to grap the json file and put on the code. How can I take it from a wordpress blog?
for example: http://blog.teamtreehouse.com/api/get_recent_summary/?count=20
Thanks!

Well, i am guessing your final goal is to parse the json data after you get it from the website. Right? If that's the case, you can go about it in two ways -
You can directly access the URL in android application using HTTP post method giving count parameter and value 20 and get the response and decode it using JSON parser
If you want to do it offline i.e not connect your android device to internet, then you can simply save the data into a file and place the file in your assets folder of your application and then open the file and read it and parse it. On Chrome web-browser, you can use REST client that makes it a bit convenient to store the json data into a file.
Now, depending on which way you want to go, you will have to investigate that route to get more implementation details on the same.
HTH.
posts: [20]
0: {
id: 22313
url: "http://blog.teamtreehouse.com/best-free-jquery-form-plugins-to-improve-user-experience"
title: "Best Free jQuery Form Plugins to Improve User Experience"
date: "2013-09-26 10:07:23"
author: "Jake Rocheleau"
thumbnail: "http://blog.teamtreehouse.com/wp-content/uploads/2013/09/autotab-jquery-plugin-preview-150x150.jpg"
}

Related

Sample WebService url to get and post values like email and password from android

I want a sample WebService URL, which can be used to practice android networking with volley.
I know there are many sample URLs which send Json data but I want a WebService URL which accepts and store data (may be in MySql Database) like(email,password) sent by android app.
I want to practice these things but I have not found required setup for this,
if such type of free WebService is not available then please suggest me how can I practice android networking, specially Posting data to server (usually used in user signup and sign-in)
Thanks :)
Here is what you want to practice Networking
Webservice Type : REST
Returns a list of cities and placenames in the bounding box, ordered by relevancy (capital/population). Placenames close together are filterered out and only the larger name is included in the resulting list.
JSON URL :
Click here
Same output in XML format :-
XML URL : Click here

Bamboo.io integration with XLSform hosted on ona.io like formhub was providing, or REST service

In Formhub, in the form management page, there was a button on the right to connect to bamboo.io . Doing that gave me a handy URL having all the collected data in a JSON, through which I could dynamically load latest collected survey data in my application. See screenshot.
As an example, all entries submitted on this form (and its ODK Collect counterpart), were collecting at this URL in JSON format which I could then import into my javascript and do mapping, data visualization, etc.
I'm using formhub's successor, ona.io now because formhub.org isn't loading half the time, and I read in some article that they don't intend to keep it up and one should go to ona.io now to do the same thing. It's the same thing (at much better speed, I can see that formhub.org was having server problems), But it's missing the easy bamboo.io integration. There is a "REST Services" tab mentioned below in the form's dashboard..
..that I can't make sense out of. What am I supposed to enter as "service URL" ?
I tried looking up ona.io's documentation but it's all for API and involved CURL commands etc. I'm checking out bamboo.io and even there I'm not getting any help. Everywhere they're going into advanced usage of custom servers, API's CURL GET etc. But I just want the simple live JSON data through a simple link that I was getting in formhub.
I'm open to any other methods if available.. the end goal is to have a URL that carries all the accumulated data submitted by the form in JSON or CSV format. I want to import JSON (or CSV) from this set URL in my javascript on a web page hosted on my own server.
Note that it's not possible for me to self-host an ODK Aggregate instance. Ona.io is doing that for me.
In the traditional way of exporting data at ona.io (and formhub before it), the system creates a new file each time you export, with a timestamped file name. It doesn't auto-generate any single URL having latest data.. one has to go there and generate manually. That won't do... need a fixed URL which will have all latest data JSON or CSV.
Found a way. ona.io provides the same thing natively; I don't need bamboo.io (besides, even that is being retired same as formhub!)
All you need to do to get started, is to go here:
https://ona.io/api/v1/data?owner=[your usename]
From there you'll find URL's to the data collected by your forms, and you'll get the direct URLs for getting the data in JSON / CSV / many other formats.

Android :How to parse data from server into JSON? Do I need to write a file and where do I store this file?

I have read questions available on forum but I am still confused. Is it possible to read app's data from server using JSON? App data is available from server in HTML form. How to parse this html webpage into JSON? Where to store JSON parsing file(I mean in which folder). I'm not using wordpress/cms for blog/data. Thanks for your help!
You usually do not read data from a server in HTML format. HTML is used to display something in a browser or in a WebView. For data, you use either JSON or XML, where JSON is the standard these days. So you server has to provide a service that returns JSON. There might be some cases where you want to read HTML, but you would not parse it into JSON. There is no point in doing so. You had to read it as XML and find the data you are interested in. The problem with that approach is that HTML is often not well formed - not every opening tag has a corresponding closing tag. While browsers are fine with that, XML parser are usually not and your app will crash.

how do i get the website in json format?

i need to get a website (any website ) in json format to use it with android and json parser to get data and if possible that the website include images to be able to download data and images using json parser.
i have been searching about 2 days without any success, its my first time that i use json so i do know where to search and how to search.
what i need is a website to make a test on it that will be available in json format
anyone can help me ???
i will appreciate that.
Use http://www.jsontest.com/ to get JSON from that website.
Read there and for example if you call http://ip.jsontest.com/ you will get a JSON response as {"ip": "203.92.62.242"} then you can parse them in your android application.
For future readers :
Facebook programmers provide the json format for each request.
All you have to do is :
If the facebook page url is : http://www.facebook.com/youtube
To get json format of page, request this : http://graph.facebook.com/youtube
I suggest to read that :
Usually standard web service today provide data in at least two format: json and xml for each endpoint (url), you just add .xml or .json extension to the requested url.
But most of the time you don't have to do that, common web services today always provide json data because it's defined in RESTFul rules. If they dont, you can't get the json. The case is same for you, just ask the developer for API docs.

Need help for communication between server database and android app

I am developing an Android based app that does both the things:
Add data to the server.
Fetch data from the server.
Data consists of a multimedia file which can be either:
Picture + Some info about Picture
Video + Some info about Video
Simple Text + Some info about the text
In the above, info consists of things like Latitude, longitude, user name etc.
I want to know as to how to achieve the desired ?
I have been suggested to use JSON based object and pass it to the android app.
I know how to parse the JSON object but have no idea about things like:
How does the android app running on mobile device requests for JSON object ? (meaning which URL to ask)
How to pass the multimedia object (Picture/Video) from server to App in form of JSON object?
How to send data from android app running of android based phone to the server ?
Thanks in advance !
Let me try to answer your questions;
You need to have a service running on the server. Android parses the json and sends it to this service. So you will need to use the URL of your service.
You can pass multimedia objects to the service by converting it to a Byte or Base64String.'
With regards to how to parse the json and send it to the server, I'd recommend you look at google-gson. This is one of the most commonly used libraries when working with JSON
Look into this link for a more indepth tutorial on Json parsing
Note: While JSON is the recommended way to pass objects to and from the server, wsdl is another option you can use.
You can do that by converting to Base64String. Check this link

Categories

Resources