Link URL data missing for some creatives in Facebook api - java

We opened issue about link url data that missing for some creative in facebook api , and we received answer that there are two ways to create an ad creative and the second one seems to have been created using an existing post ID, to get the link to the second ad we should call to {post_id}?fields=call_to_action .
Is there a way to get call_to_action data for multiple post IDS?
I have searched in the docs and didn't find way to do so ..

Is there a way to get call_to_action data for multiple post IDS?
?ids=post_id_1,post_id_2,...&fields=call_to_action
You can request data for up to 50 objects in one go this way.

Related

android jsoup post data to URL

I need to pass data to my URL to get the data.
I have done like this...
document= Jsoup.connect("MYURL").data("PASSCODE", "001100").post();
System.out.println(document);
but I am not getting proper output
Need help. I have check this Links also
This and this also.
Usually login into a web site requires two steps:
You send a get request to get the page, and you extract from there some values like session ID etc, and the cookies.
You send a post request with the values from step 1, and your user name and password.
To know which values you need to send, use your browser in the developer mode (by pressing F12) and examine the traffic.
If you want to write an android app, change the user agent string to match your browser, since some sites send different pages to different clients.
You can see an example HERE.

Facebook API - call returns less fields when using access token

I have public page post id, about which I would like to get more data. When I make API call like this,
https://graph.facebook.com/{POST-ID}
I get back full data about the page post including comments, link, attached photo etc. However, when I try to make the call with callGetAPI in facebook4j library, it always adds my access token to the end of the url, so it becomes
https://graph.facebook.com/{POST-ID}?access_token={TOKEN}
And with this call I get back only three fields: created_time, message and id (which is {POST-ID} again). Why it is like that? I get less data with valid access token than without it.
It is a feature that came with v2.4 of the Graph API: "Declarative Fields". Try with the Access Token of an older App and you may get the same result. Although, it looks like a bug when not using an Access Token.
More information: https://developers.facebook.com/docs/apps/changelog#v2_4

How to obtain Pinterest V3 API-KEY or access_token

I am trying to fetch Pinterest data, which would be the public info of the user(follower count etc), and all pins for a user.
I know the v3 API are up now and v2 apis have been taken down.
I found this link which gives me end points for exactly what I want:
http://techslides.com/most-repinned-pinterest-pins-by-website/
But I am unable to get an access_token. I have asked pinterest for api access but they have not replied. And I am unable to sniff app data too.
I also tried Pinterest's signature tester tool which is on their website but no luck. The link it generates doesn't work either. It returns a authorization failure.
https://developers.pinterest.com/tools/signature/
I have access to APP-ID and Client-Secret. I need to know how can I get an access token/ API-KEY to get the following work fine for me:
https://api.pinterest.com/v3/users/jessicamalba/?access_token=APIKEY
EDIT
Before I am told that is an duplicate of
How to get access token for access Pinterest Api
I would just say that it is not. This question was asked one year ago and was asked in respect to V2 api. Which now return a 404 status. So now here I am asking about the V3 api.
To preface, I saw some discussion that even though you can get the token, it may not work unless you are an approved developer. So you might consider applying to be an API developer while you wait to try to work all this out. Also V3 is beta, so.. This answer might work for now however, it may not work later if it ends up not being the official way to get the token when it comes out of beta.
Step one: Log into pinterest then you need to create an application on the https://developers.pinterest.com/manage/ link which you can also get from the main developers page on pinterest. I chose to create IOS application, even though I don't plan to use this with IOS, just so I could get an application created to try to make the API work.
Part of the creation of the app, asks you to specify a callback url, this is the url on your website that is going to receive the token & token related data in a hash tag {I presume they did this so that only javascript can get at it rather than php directly} however you could modify the hashtag in javascript to drop the hash and redirect it to another url which can collect it as get or post params.
Once created replace the application id "1412345" (i.e. consumer_id, also sometimes called client_id) into the url below.
What I have seen is this number starts with 14...... at present
https://www.pinterest.com/oauth/?consumer_id=1412345&response_type=token
Step two: The executed url above will bring you to a page asking you to authorize the application to access your user account. Once you authorize it it will send the token back to your website. in the hash tag and you can use javascript to read the hashtag
window.location.hash.substr(1, window.location.hash.length) will get you the get params string from the hash tag containing access_token, expires_at (duration in seconds which equals 30 days) and token_type which will equal "bearer"
Note the token will be base_64 encoded, I don't know if it's supposed to stay that way to be used but I presume so.
Okay, so as of today, following are the parts of the api that are public and used by widgets.
Public parts of API (used by widgets)
Retrieving the pins on a particular board:
GET http://widgets.pinterest.com/v3/pidgets/boards/eecolor/test/pins/
GET http://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/
Retrieving the pins of a particular user:
GET http://widgets.pinterest.com/v3/pidgets/users/eecolor/pins/
Retrieving the information of (a) particular pin(s):
GET http://widgets.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972
GET http://widgets.pinterest.com/v3/pidgets/pins/info/?pin_ids=521150988102375972,10133167885969245
Count the number of pins:
http://widgets.pinterest.com/v1/urls/count.json?url={urlEncodedLink}
http://widgets.pinterest.com/v1/urls/count.json?url=http%3A%2F%2Fwww.flickr.com%2Fphotos%2Fssass%2F3436030086%2F
Note that the link is returned in the other API responses
You can use ?callback=myJsFunction to use JSONP
GET http://widgets.pinterest.com/v3/pidgets/boards/eecolor/test/pins/?callback=myJsFunction
You can use api instead of widgets and also https
GET http://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/
GET https://api.pinterest.com/v3/pidgets/boards/eecolor/test/pins/
this is a official Pinterest Documentation every thing you find it here, I did same for my requirement.
Access token
how to use it
But it for V1 api
examples:
https://api.pinterest.com/v1/pins/431430839282408407/?access_token=aaa
https://api.pinterest.com/v1/boards/lorihiney/quotes/pins/?access_token=aa&limit=20&fields=id,link,counts
https://api.pinterest.com/v1/boards/mother1086/test-title/pins/?access_token=aaa&limit=2&fields=id,link,counts

Getting a post using Facebook4J

I'm trying to get a post from Facebook using the Facebook4J API. It's been working excellently, so far, but I've run into a little problem.
When I use
PostMethods pp = null;
Post post = pp.getPost(postId);
I see problems. If the post ID is something like "592496714151070", this call works absolutely fine, but if I give a post Id like "164204816980264_592496714151070", I get a runtime exception:
RuntimeException in run(): [Ljava.lang.StackTraceElement;#1d944379
The second type of post Id is for a post that is on the wall of a page, so it's the pageId followed by a post Id.
Is there way to fix this, or saving that, a way to get posts from 'others' on a facebook page's wall?
Sam
I'm not sure if I understood your question completely. However, you don't have to access all posts explicitly. You can crawl them altogether using a simple generic facebook4j client as described here:
Getting posts from a page using Facebook4j api

How to select data on website database in android

I have 2 Database which are same, on website and in external storage.
I put my database on http://website/folder/database.db or database.sql
I want to take data from my database on website. how to do that?
It is not possible te perform this operation directly. Your website should be able to receive some kind of requests and send responces. Android app should be able to create requests and parse responces. This is the only way.
The better solution I think that is offers a set of REST API to call that execute the query and retrive the results you need and respond with a format like xml, json...
You can offer a set of URL like:
http://website/api/getlist -> this respond with an xml that is the list of things you need
http://website/api/insert -> sending a json representing your object it will be saved in the db and response with a succesful meessage
and so on...
to make this you can use a lot of framework that can help you. I think that the best is spring ( http://www.springsource.org/ ).
Look the MVC part and the REST Template is all you need.

Resources