I want to get all the posts of a facebook page. I am following the link https://developers.facebook.com/docs/graph-api/reference/v2.8/post
For example URL : http://graph.facebook.com/v2.8/{page_id}/feed%20HTTP/1.1
I get the response as :
{"error":
{
"message": "Unknown path components: /feed HTTP/1.1",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "Em5dm7wPr9k"
}
}
I got the page_id from my facebook page.
Is my URL correct? Is this the correct way to get all the posts?
This is the correct way: https://developers.facebook.com/tools/explorer/?method=GET&path=bladauhu%2Ffeed&version=v2.8
You don´t need the Page ID, but you need to get rid of the " HTTP/1.1" in the API call. It´s just http://graph.facebook.com/v2.8/{page_id}/feed.
Related
I've studied this page:
https://developers.google.com/gmail/api/v1/reference/users/messages/import
I have some messages I will be keeping track of in my Android program. I will be keeping a record of the messages I will be deleting and I would like to import those messages slated for deletion into a new folder (In Gmail API folders are called Labels).
I tried the test form:
POST https://www.googleapis.com/gmail/v1/users/omitted%40gmail.com/messages/import?deleted=false&internalDateSource=dateHeader&neverMarkSpam=true&processForCalendar=false&key={YOUR_API_KEY}
{
"payload": {
"body": {
"data": "hellio"
}
}
}
Response:
400 OK
- SHOW HEADERS -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "'raw' RFC822 payload message string or uploading message via /upload/* URL required"
}
],
"code": 400,
"message": "'raw' RFC822 payload message string or uploading message via /upload/* URL required"
}
}
There is a problem sending the request but I am not sure at all what it means. What I need is some Java that sends a request that will import a message where I can specify the body, received date and subject line. Is it possible?
Thank you.
P.S. I just wanted to delete the attachments not the whole message but after reading the Gmail API documents it looks like this is not possible and is only possible through IMAP. The reason I am asking this question is so that I don't have to move my whole program to IMAP.
You are pretty close with your code. What you need to do is write a mail compliant with the RFC 2822 standard, and Base64-encode said mail and make it URL-safe (replace all + with - and all / with _) before inserting it.
You are better at Java than me, but if I would make a correct message in the browser's Developer Console, it could look something like this:
var encodedMail = btoa(
"Date: Thu, 1 Jan 1970 12:00:00 -0000\n" +
"From: emtholin#gmail.com\n" +
"To: emtholin#gmail.com\n" +
"Subject: Example Subject\n\n" +
"This is the body of the mail"
).replace(/\+/g, '-').replace(/\//g, '_');
Then I just insert this mail with the same request you issued:
POST https://www.googleapis.com/gmail/v1/users/me/messages?internalDateSource=dateHeader&key={YOUR_API_KEY}
{
"raw": "RGF0ZTogVGh1LCAxIEphbiAxOTcwIDEyOjAwOjAwIC0wMDAwCkZyb206IGVtdGhvbGluQGdtYWlsLmNvbQpUbzogZW10aG9saW5AZ21haWwuY29tClN1YmplY3Q6IEV4YW1wbGUgU3ViamVjdAoKVGhpcyBpcyB0aGUgYm9keSBvZiB0aGUgbWFpbA=="
}
As you can see, this worked great!
I spent the last 5 hours trying to get large picture from Facebook page using this request:
https://graph.facebook.com/v2.1/Y.Anti.coup.D?fields=name,picture?type=large&access_token=CAAHH9uJXXOcBA
But I always get this error:
{ "error": {
"message": "Syntax error \"Expected end of string instead of \"?\".\" at character 12: name,picture?type=large",
"type": "OAuthException",
"code": 2500 } }
Sorry for my bad English, and I hope that you understand my problem.
You can do this a lot easier:
https://graph.facebook.com/page-id/picture?type=large
(no Access Token needed btw)
In your case, the problem is that you are using the question mark two times. This is how your code should work:
https://graph.facebook.com/v2.1/Y.Anti.coup.D?fields=name,picture&type=large&access_token=CAAHH9uJXXOcBA
I'm new to graph API... I'm running the FQL query in the graph API
SELECT name, FROM user WHERE uid = me()
I'm getting this error...
please help me.. thanks in advance
{
"error": {
"message": "(#601) Parser error: unexpected 'monthly_active_users' at position 0.",
"type": "OAuthException",
"code": 601
}
}
SELECT name FROM user WHERE uid = me()
remove the coma after name
if you want to add more selection add coma
like this
SELECT name,id FROM user WHERE uid = me()
this video link might help you better understandign in fql
link
I want to show the profile picture using the graph api using the following link fpor example :
https://graph.facebook.com/me/picture?redirect=0&height=200&type=normal&width=200
I get the response :
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
Where in the link they say
Because profile pictures are always public on Facebook, this call does
not require any access token.
The me in the URI is just a placeholder, you need to put an actual Facebook user-id in, like the title (/{user-id}/picture) of your linked page suggests.
For example:
https://graph.facebook.com/snoopdogg/picture?redirect=0&height=200&type=normal&width=200
...returns the following:
{
"data": {
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c11.0.433.433/s200x200/598452_10151897536239807_882122819_n.jpg",
"width": 200,
"height": 200,
"is_silhouette": false
}
}
I am integrating Instagram in my android app. I am able to get authetication and token from Instagram API. Now what I am looking for is userinfo. As soon as user is authenticated I want his userinfo like username,name etc. Any idea how to get it ? I tried several ways but didnt able to achieve it.
I tried this example https://github.com/poller/instagram-demo-for-android
Get basic information about a user. To get information about the owner of the access token, you can use self instead of the user-id.
Link for Documentation is :
https://instagram.com/developer/endpoints/users/
Use this API :
https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN
Response contains information about that particular user requested by passing ID :
{
"data": {
"id": "1574083",
"username": "snoopdogg",
"full_name": "Snoop Dogg",
"profile_picture": "url of picture",
"bio": "This is my bio",
"website": "website of that user",
"counts": {
"media": 1320,
"follows": 420,
"followed_by": 3410
}
}
Simply pass your access token to this url. And you will get the logged user information of the Instagram.
[https://api.instagram.com/v1/users/self/?access_token=YOUR-ACCESS-TOKEN]
this will return the user information like the above #Heena Arora mentioned.
And also she mentioned about retrieving the user information for the particular user by id.