Did anyone used google scripts to post a message to a facebook profile?
I found this code but can't find a way to get the graph id...
function updateStatus(){
var myId="";
var myAppAccess_token="APP-ID|APP-SECRET";
var graphUrl="https://graph.facebook.com/"+myId+"/feed";
var theDate=new Date().toString();
UrlFetchApp.fetch(graphUrl,{method:"post",payload:{
message:"foo\n" + theDate,
access_token:myAppAccess_token
}
});
}
I have tried using the limit parameter for selecting photos from albums on my facebook page. The javascript api just ignores the parameter and according to
https://developers.facebook.com/docs/graph-api/reference/photo/
This endpoint does not have any parameters. So I am trying to figure out how to return more than 25 photos for albums that contain more. Here is the part of my code that returns the photos
FB.api(
'/'+id+'/photos?limit=100',
'GET',
{"fields":"link,source"},
function(response) {
$(location).children().remove();
for ( var i = 0; i < response.data.length; i++) {
$(location).append('<li><img src="'+response.data[i].source+'"/></li>');
}
}
);
If anyone can help me figure out why and or how to get more than 25 results using the photos graph api that would be great!
I am trying to collect all information related to Moodle course (course + lessons) Using Moodle Api I got the course information, but gets only some basic information, I want course details and its lessons (created under course)
Eg : var domainname = 'http://<server URL>/moodle';
var token = 'df337369637c692303d903f8cacf1eb0';
var functionname = 'core_course_get_courses';
var serverurl = domainname + '/webservice/rest/server.php' ;
var data = {
wstoken: token,
wsfunction: functionname,
moodlewsrestformat: 'json'
} var response = $.ajax(
{ type: 'GET',
data: data,
url: serverurl
}
);
And the output looks like
{"id":2,"shortname":"IV Support Queries","categoryid":1,"categorysortorder":10001,"fullname":"IV Support Queries","displayname":"IV Support Queries","idnumber":"","summary":"<p>IV Support Queries Desc<br \/><\/p>","summaryformat":1,"format":"topics","showgrades":1,"newsitems":5,"startdate":1479168000,"numsections":5,"maxbytes":0,"showreports":0,"visible":1,"hiddensections":1,"groupmode":0,"groupmodeforce":0,"defaultgroupingid":0,"timecreated":1479127227,"timemodified":1479198758,"enablecompletion":0,"completionnotify":0,"lang":"","forcetheme":"","courseformatoptions":[{"name":"numsections","value":5},{"name":"hiddensections","value":1},{"name":"coursedisplay","value":1}]}
I want the lesson details created under course .How can i get the information through Api . Thanks
Using function
"core_course_get_contents"
getting all the informations related with course.
var domainname = 'http://<server URL>/moodle';
var token = 'df337369637c692303d903f8cacf1eb0';
var functionname = 'core_course_get_contents';
var serverurl = domainname + '/webservice/rest/server.php' ;
var data = {
wstoken: token,
wsfunction: functionname,
moodlewsrestformat: 'json' ,
courseid: 2 //Retrieve results based on course Id 2
}
var response = $.ajax(
{ type: 'GET',
data: data,
url: serverurl
}
);
Thanks
I'm trying to run the sample from Google's API sample here in Script.google.com.
Sample Code:
function getClicks(shortUrl) {
var url = UrlShortener.Url.get(shortUrl, {
projection: 'ANALYTICS_CLICKS'
});
Logger.log('The URL received %s clicks this week.', url.analytics.week.shortUrlClicks);
}
Error:
Required parameter: shortUrl (line 2, file "Code")
What am I missing?
I want to delete the post as page.
I already have access token of the admin user and access token from the page.
My Code:
var fbClient = new FacebookClient { AccessToken = getPageAccessToken() };
dynamic parameters = new ExpandoObject();
parameters.id = postId;
fbClient.Delete(m_GroupId + "/feed",parameters);
I get the following error:
{"error":
{
"type":"OAuthException",
"message":"Invalid token: \"PAGE_ID\". An ID has already been specified."
}
}
I replaced the page id above with PAGE_ID
use the page access token and pass the post id as the path for Delete method.
var fb = new FacebookClient("pageAccessToken");
fb.Delete(postId);
I don't know the C# SDK, but from the look of it you're setting the ID twice, once with parameters.id and again with m_GroupID