Using Moodle-Webservice core_course_get_enrolled_courses_by_timeline_classification - moodle

I use the webservice
core_course_get_enrolled_courses_by_timeline_classification
my curl looks
https://MyMoodle/webservice/rest/server.php?wstoken=MyToken&wsfunction=core_course_get_enrolled_courses_by_timeline_classification&moodlewsrestformat=json&classification=inprogress&customfieldname=id&customfieldvalue=7159
The User with the id 7159 is enrolled in diffrent courses, but the Webservice gibes as result:
{"courses":[],"nextoffset":0}
Whats wrong? I hoped that i get as result a list of courses which the user is enrolled in.
Thanks for help

For further readers - it might be in reason that user might selected to show some category of courses, for example - archived courses :)
So, when I had switched to "All courses" all begin to work fine.

Related

Get user that made the comment in facebooks instagram graph api

Im building an application that manages comments for instagram business profiles, and i'm a little surprised that there doesn't seem to be a way to get info of the user who made the comment.
The docs seem to point this way too:
Reading a Comment
To read an individual comment's metadata, send a GET request to the /{instagram_comment_id} node and include any of the following fields:
...
user (only returned if the user making the query also made the comment)
So, am i to understand that there is no way to get the info of a user which made a comment on a media of the profile i manage or is there something i am missing? any help would be appreciated.
Thanks in advance
This url worked for me:
v3.0/{comment_id}?fields=id,timestamp,username,text
somehow I was able to get the username from graph API, but I'm not getting the fields name, profile_picture_url, etc. this is my URL for getting the username.
GET https://graph.facebook.com/v2.11
/123?fields=mentioned_comment.comment_id(456){user{id, username}, text}
123 - instagram_business_account id
456 - comment id
You can get full user details from username by Calling Instagram API(Maybe it's against there privacy policy). suppose stackoverflow is the username, by calling this API you will get full data.
https://www.instagram.com/stackoverflow/?__a=1

Meteor: The Correct way to access user information

I'm new to meteor and I am in the process of building my application, but I am running into some "best practice" questions.
I have three databases. One for the users, one for questions, and one for answers. Think of my site as a quora of sorts.
I am iterating through the questions, and I am having a hard time accessing the user information. At the moment when a question gets recorded, I record the question, and I only record the user's id. Coming from a rails background, this is usually all I need to access all the other information when I need it. I don't record the name and all the other info.
The question I have is what is the right way to access the user information? I am doing an each loop and it seems that Meteor.user is only for logged in users (only for my information basically). I can't seem to do something like Meteor.users.find({_id: this.user_id}) on the questions helper so that I could get each users info. It retrieves nothing like this.
In the examples I have seen, they usually record the information on the questions database. So they would record first,last name, and anything else that would be necessary. But this seems like I am recording information twice.
What is the right way to access this info? Should I record it when a question is posted or should I call it from the users database everytime?
I have tried accessing the info through a server method, but can't seem to get it to work. Been at this for a while so I though I should ask instead.
Thanks in advance!!
My solution would be just save the user_id field in db as you're doing right now,
If you save firstname or lastname with the questions they may change in future (considering the fact that in most sites we have option to change names)
I can't seem to do something like Meteor.users.find({_id:
this.user_id})
this is because user data is not availbale in the client, that is the reason why you can't see the data
solution is while publishing the question to client you should publish the information of the user too
Example
Meteor.publish('question,function(question_id){
var question = Question.findOne(question_id);
//get info of the question user
var user = Meteor.users.find({_id: question.user_id });
//you cannot publish findone result, so do another query
var ques_rec= Question.find({_id: question_id});
return [ques_rec, user];
});
Now, in the client side when you do I can't seem to do something like Meteor.users.find({_id: this.user_id}) you'll get the user data.
I think I found a solution. I haven't turned the autopublish off, so this seems to be working for now.
Template.questionItem.helpers({
user: function(){
user = Meteor.users.find({_id: this.user_id}).fetch();
return user[0]
}
I think basically you can search users, but for some reason if I do
Meteor.users.find({_id: this.user_id})
it returns an object and I can't seem to find the actual data.
But if I add the .fetch() at the end it will return an array for the user. So if declare it as a variable, I can access all the info by saying user[0].
I'm not sure if if this is the best way to do it in meteor, but it does seem to work.
So when I call the object in the handlebars I go something like:
{{user.profile.name}}
I think once I turn autopublish off I will have to do the same thing but from the server side.

Yammer REST API - Documented Parameter not working

The API documented here - http://developer.yammer.com/restapi/#rest-users clearly states:
"4) Alias to /api/v1/users/current user’s id.format. Supports include_followed_users, include_followed_tags, and include_group_memberships parameters.
GET https://www.yammer.com/api/v1/users/by_email.json?email=user#domain.com`
Yet, when we try this, it does not return any followed user information at all! The request we're using is like so:
https://www.yammer.com/api/v1/users/by_email.json?email=me#company.com&include_followed_users=true
However, this request DOES return followed users, but only for the current user:
https://www.yammer.com/api/v1/users/current.json?include_followed_users=true
Am I missing something completely obvious and being stupid or is there a real issue here? If this was taken out for whatever reason, then you'd have thought that the API documentation would have been updated.
The Yammer Team did eventually get back to me on this. Their response below:
(I've removed https://www.yammer.com from URLs because I don't have enough rep' to post more links)
Hey Jason Dunbar looks like the documentation here is wrong.
I looked in to this and had some conversations with a few engineers this week and have the following (albeit more arduous workaround):
1) Call get user by email endpoint and retrieve the id attribute from here: /api/v1/users/by_email.json?email=user…
2) To grab following users, take that id and:
GET /api/v1/users/following/[:id].json
3) To grab group memberships for that user you'll need to impersonate him/her (verified admin only) and
GET /api/v1/users/current.json
We'll get the documentation updated ASAP with this. Also happy to keep the conversation going to help if needed.
Make sure you are setting the email parameter to the user's email that they are registered with.
E.G. if your company has multiple domains but the Yammer network is under bigco.com and the user is registered with an email under bigcosubsidiary.com you'll need to make a request to the API with user#bigcosubsidiary.com.
-as mentioned - it looks like its only for current.json - you can check it here http://yammer-dev.herokuapp.com/endpoints/4 - hope it helps.
Rich

Real Time Update not working for some fields?

I'm checking wich fields from the User object are susceptible to RTU (real time updates); in the documentation it says:
The User object supports Real-Time Updates for all fields except the
verified property.
But, so far, for this fields:
video upload limits television significant other favorite_teams
favorite_athletes political interested_in bio updated_time
third_party_id gender user_likes languages
I've got this message:
{"error":{"message":"(#100) \"SOME_FIELD\" is an invalid field name","type":"OAuthException"}}
My application has the necessary permissions, checked by using this method (taken from this url):
https://api.facebook.com/method/users.hasAppPermission?ext_perm=SOME_PERMISSION&uid=UID&access_token=ACCESS_TOKEN_FOR_MY_APP
Am I missing something? Those fields are working for someone else or is just me?
Thanks.
I've tried the same. Facebook seems to be a little slow here. They did not implement all fields in the RTU. You can find a list of available fields here (under objects): https://developers.facebook.com/docs/reference/api/realtime/
However, even this list does not seem correct, as I did not get for example television to work either.
It is kind of odd to ask for the object "user" to get notifications about you page.. This all does not seem to be finished yet..

Missing Cities from Facebook all_cities_final.csv

I'm making Facebook App and I need to match the city from the user on Facebook with the city in my local database.
I've found the list of Cities from this link:
http://developers.facebook.com/attachme … _final.csv
But it seems that this is not the whole list, because there is no city from Macedonia in the list, but they do came up from auto complete when you try to write the city in your Hometown.
Am I missing something here, or is there some other list of Cities that I can find?
Also I've downloaded autocomplete_data.php from
http://developers.facebook.com/docs/reference/rest/ads.getAutoCompleteData/
and it doesn't have all cities.
Thank you.
So I just have the same issue and figured the cities are now places in the graph
https://graph.facebook.com/114897945188014
SELECT name,description,geometry,latitude,longitude,checkin_count,display_subtext FROM place WHERE page_id=114897945188014