Posting to a wall of a facebook user using the graph api - java

i am new to facebook app development and i am trying to post a simple text on the wall of the user using the https://graph.facebook.com/me/feed?access_token=ACCESS_TOKEN&message=hello but this does not seem to be working..Any thoughts as to where i might be going wrong?

Check if you have permissions to post from the app.
Add app_id to your call.

If you’re just calling the URL you mentioned, that would be a GET request. To post a message to the user’s wall you have to use method POST. You can test it in the Graph API Explorer – change the method to POST via the dropdown, click „add a field” and use name=message and value=your_message …

Related

Getting URL from site after submitting form

So the site that Im targeting works like this:
The sites name is https://masterbattlerite.com/. https://masterbattlerite.com/ works like this:
Enter username in search bar of the site
Press the search button (or hit enter)
The site directs you to the userpage with the username you entered.
the URL is now something like https://masterbattlerite.com/238338348
that number (238338348) is the id of the user
I want to know how to get that id as a string in my app
I found out of Selendroid but you need some sort of server to be able to emulate a browser? My app will be released on the play store so I don't want my users needing to start their own selendroid server everytime to do this (maybe Im wrong)
In your code, can you use an HTTP library/framework and POST to the same location the site posts to and retrieve the id from the redirect the server sends? You may have to set some extra (possibly hidden on the webpage) parameters to get it to work.
EDIT: ok, it's even easier with the site you mentioned... if you search for a username of bob, you just GET this URL: http://masterbattlerite.com/profile/bob/lookup
and it returns some nice JSON with the id in it like so: {"status":"success","player":{"id":1268,"user_id":"5688","name":"bob","title":504,"avatar":30016}}
BTW - I figured all of this out using the Chrome developer's tools. Learn to use it - it is your friend.

PayPal API integrating into server

I am trying to integrate my server with the api,
I test it on
https://devtools-paypal.com/guide/openid/java?interactive=OFF&env=sandbox
in the third step, when I copy the code from the redirectUri, paste it instead AUTH-CODE and press the "try it" button, I get the message "invalid Json response recieved"..
I don't understand why, what Is wrong?
paypal api is very restricted. You need to have all products with prices, tax, shipping method and much more.
best will be if you can add json request so we can check it.
PS. you have your auth codes? That ones are only examples.

how do i know whether my html link is clicked or not from Servlet?

My Servlet response type is html and my response contains a hyperlink to another web site.So, now i want to capture the information about whether the user clicked the link or not? and also calculate the total clicks? i am using Tomcat 7 as a server.
Is this possible in setting response header (302 or 404)?...
Please Guide me to get out of this issue?
Yes, you can use a 302: instead of providing the link to the other website, you provide a link to your own servlet, do your accounting and then send back a redirection (301/302) http status with the other web-site URL in the response Location header.
This maybe a bit simplistic though, since the user will leave your original page (is this what you want ?) and search engines may not like this if your web app is public.
I think right now you are redirecting the request(link for another website) at client side.In this approach your server cannot get the information about the click.
What you can do create a servlet and call this servlet on click now this servlet is responsible to redirect the request to another website. Add an static integer counter and increment this when servlet call each time.
Use the method setStatus():-
setStatus(HttpServletResponse.SC_FOUND);
or
setStatus(HttpServletResponse.SC_NOT_FOUND);

How to retrieve home timeline from twitter in the form of .xml or JSON using java?

I want to get a home timeline from twitter and I was able to get the home timeline using twitter4j and oauth authentication method
ConfigurationBuilder confBuilder = new ConfigurationBuilder();
confBuilder.setOAuthAccessToken(accessToken.getToken())
.setOAuthAccessTokenSecret(accessToken.getTokenSecret())
.setOAuthConsumerKey(key)
.setOAuthConsumerSecret(secret);
Twitter twit = new TwitterFactory(confBuilder.build()).getInstance();
User user = twitter.verifyCredentials();
List<Status> statuses = twitter.getHomeTimeline();
but the result is not in the form of .xml or JSON. i also tried
WebResource resource = client.resource("https://api.twitter.com/1/statuses/user_timeline.json");
but all I get is GET https://api.twitter.com/1/statuses/user_timeline.json returned a response status of 401 Unauthorized
I googled many times but I just cant get it right. Please I need a sample java code of how to do it. Complete code that can run right away would be really helpful as I got a lot of partially coded program and just couldnt get it to work. thank you in advance
OK, so after looking at the release notes for the 2.2.x versions, it appears there is a way to get the JSON representation from Twitter4J, but it's disabled by default since it uses some extra memory.
So, you need to:
Enable the JSONStore using the jsonStoreEnabled config option
Get the JSON representation of a request using the getRawJson method
Sorry there's no code example, I haven't tried it myself.
401 Unauthorized:
Authentication credentials were missing or incorrect.
You need to authenticate before you perform the query.

Is there any way of changing gmail password programmatically using java?

Is there any way of changing gmail password programmatically using java?
The google provisioning API guide has updateUser method which takes a UserEntry object. You can use it to update the password I suppose, you will have to try it out. Check the javadocs for definition of UserEntry
I would have been very surprised if you could, and it doesn't look like it.
This page shows you the list of settings you can change in the Google Apps "Email Settings API", and change-password isn't there.
http://code.google.com/googleapps/domain/email_settings/developers_guide_protocol.html#GA_email_settings_api_ops
HTH
I think yes. You can record all operation with web pages by Selenium, test if all ok, and after export to java code - only problem can arise if Google will use CAPCHA
Uh, just use an http client to post this web page: https://www.google.com/accounts/b/0/EditPasswd. Use http://hc.apache.org/httpclient-3.x/ or something similar. You'll need to keep track of cookies properly, so google thinks you are logged in when you load the page. But yeah, obviously it is possible. If your browser can do it, you can do it programmatically through sending http requests. If you want to be double careful, you can use something like tamperdata in firefox to sniff exactly what your browser sends when you request a password change, so you don't miss any silent fields or whatnot.
Using Google Provisioning API, to change the password, you have to set it to login attribute of UserEntry object:
import sample.appsforyourdomain.AppsForYourDomainClient;
...
AppsForYourDomainClient client = new AppsForYourDomainClient(email, password, domain);
UserEntry user = client.retrieveUser("username");
user.getLogin().setPassword("newpassword");
client.updateUser("username", user);

Categories