Getting html of tumblr post using jumblr - android

I am developing my first Android application using the "jumblr" library to get the last post of a blog and then do some stuff.
The library is really easy to use. I create a jumblr client and insert keys, tokens and all the commands I tried to run worked.
Using
client.blogPosts("blogname.tumblr.com")
I get a list of posts but the problem comes when I try to get the text of one post, there are no methods allowing me to do this.
Am I missing something? Is this the wrong way to approach the problem?

I solved the problem casting the post to a TextPost.
List<Post> posts = client.blogPosts("blogname.tumblr.com");
String post = (TextPost)posts.get(0).getBody();

Related

What I need for a successful GET request using retrofit android?

I'm trying to create my own application like an e-mail client. I use Retrofit library and I have already managed to create POST request for authorization via username and password. Maybe somebody can help me with structurising my general task(which classes I have to create or smth like that) because I can't create the strategy of its development. I'm a beginner in android development and also in retrofit library. When I first had made a POST request it was like a surprise because I didn't understand how it worked. So maybe somebody can advise me some tutorials or can explain from what I have to start for having s really successful GET request. I have some previous questions right here: Adding authorization header interface android retrofit. After some conversations with more professional developers, I have realized that I don't know where I have to begin. Thank you for your help.
I think This Tutorial is Good for you -> link

How to get CSRF when Android calls API of Django

I'm going to use Django API for Android development use,But I met some of the following questions.
1.Android is just giving me post form data through a URL, how can Android get csrftoken?
2.If post data is modified, for example, we originally need to delete the a information, but a is changed to B, which will cause the background to delete B information, and how to prevent this happening?
3.Where is the csrftoken of Django being stored, I looked at my database, but I didn't find it?
I'm just beginning to learn Django, so my question may look ridiculous, but I really want someone to help me.
you can get csrf token from
from django.core.context_processors import csrf
csrf_tok = csrf(request)
csrf_token = str(csrf_tok.get('csrf_token'))

How to send an imgur API request from an async task

Please as I'm a networking newbie I would love if you could dumb everything down to me.
So I am developing an android app. I have worked with APIs before, but the imgur's one is really difficult to understand. For example I am used to the kind of APIs where I paste an address into the browser and I can see the json.
Then I can save that json as a string in Java and parse it with JSONObject.
Imgur instead uses this thing called OAuth that is unlike API keys. For example if I paste this into the browser bar
https://api.imgur.com/3/gallery/album/bRpHL
I get an error. The docs say that I have to
send an authorization header with your client_id in your requests
but there is no ?api_key= like parameter. there are examples with cURL which I don't know what it is or I could implement it in an AsyncTask.
So in conclusion: I just want to get data about images in an imgur album. I have a client_id but no idea how to get the result json. Many thanks.
API docs: http://api.imgur.com/

Android development: Getting data from WordPress

I'm making an android app for displaying some school events(Title of the event and a posted picture of the event).
The only thing I need for the app is getting data(String for title, ImageView for the picture)from a server.
The answer of this post, Android Development : Getting data from the web, seems to be the easiest and the most straight forward way I could find.
"The easiest way to display posts into an Android application will be
to use JSON data on the web, and read it into a Master Detail Android
application.
On the website side, getting the data to display in JSON seems to be
the most difficult part of your problem. It would be easy if it was a
Wordpress site, as there are plugins that will do this for you.
On the application side, getting the data and parsing it into a master
detail flow is a fairly trivial task."
I know almost nothing about database, networking, wordpress, and JSON. :(
I have made an wordpress account and install the JSON plugin and wordpress web server plugin. But that's how far I could get :(
My idea is
in the wordpress blog site: make a post for each new event. The title of the post is the event title and the content of the post just a picture, which is a post about the event.
in the app side: add a synchronize task within the onCreate function, so when the app is opened, it will check if there's any new post in the blog. If there's any, it will get the blog title and add to the listView, and get the picture inside of the blog and create a new layout in which has a ImageView for holding the picture.
As I said, I know nothing about web service and networking.
I have no clue about how to check if there's any new post in the blog comparing with those events already in the app.....
These two examples are the closet I could get.
http://android.programmerguru.com/android-webservice-example/
http://wordpress.org/support/topic/phonegap-android-app-built-around-json-api (I don't understand this one! :/)
Please help! This thing is giving me a big headache! And it's the last step I need for the app!
Any help or sample code will be greatly appreciated!!
And most importantly, Merry Christmas, everyone! XD
There is Wordpress plug-in called JSON-API it gives you ability to access every object of Wordpress( post ,page ,category.. etc ) in the form of JSON. you can use any rest client like volley from google, retrofit from Square or build your won to access wordpress data.
install Wordpress plug-in
http://wordpress.org/plugins/json-api/
for sample code you can look Wordpress for android source code on github
https://github.com/wordpress-mobile/WordPress-Android
I ended up with writing my own JSON.

Sending an OPTIONS request in Android is not working

I am trying to send an OPTIONS request from my android application to my Windows 2008 Server webservice (which is a .net webservice). I am using SSL, and am having difficulty getting this to work. I really need to know exactly what my headers should look like. I know I don't send the body, I just need to know what to send. I really need an example not a link to someone just talking about some things.
I found the answer. It was working. I just wasnt looking in the right place for my response. I was looking at the final response that I get from my Soapbuilder class, and I am stripping out the headers before returning. I is actually giving the right options headers back.

Categories

Resources