Vote for API functions and the params/returned values you would like

Vote for API functions and the params/returned values you would like

by Jérôme Mouneyrac -
Number of replies: 11

Hi,
we now have an issue listing all "Must be implemented" web service functions: MDL-29934

You can vote and mention what parameters/returned values you want them to have. 

Thank you

Average of ratings: -
In reply to Jérôme Mouneyrac

Re: Vote for API functions and the params/returned values you would like

by Hubert Chathi -

Jerome, can someone update the descriptions in the tracker issues to give a brief overview of what the functions are supposed to do?  They are mostly self-explanatory, but some may have some ambiguity.  For example, I'm assuming that the core_grade_* functions act on student grades, rather than on the grade items.

In reply to Hubert Chathi

Re: Vote for API functions and the params/returned values you would like

by Jérôme Mouneyrac -

Hi Hubert,

good question, for grade, I don't know. I'll ask when I'm at work. All these functions are still brainstorming, don't hesitate to add comment in the tracker on what you would like them to do.

In reply to Jérôme Mouneyrac

Re: Vote for API functions and the params/returned values you would like

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Jerome,

can I suggest to add a new function?

core_files_download_files()

I saw in this link that the upload_file exists

Should I create a new feature issue in the tracker?

Regards

In reply to Juan Leyva

Re: Vote for API functions and the params/returned values you would like

by Jérôme Mouneyrac -

Hi Juan,

yes you can create an issue for it. Can you also add it to roadmap table as a suggested function and with the issue number at the end of the row. There is other files functions, just add the row at the end of the files functions.

Thank you,

Jerome

In reply to Jérôme Mouneyrac

Re: Vote for API functions and the params/returned values you would like

by Jérôme Mouneyrac -

However for the file download feature, it's going to be available in Moodle 2.2 with core_course_get_contents() MDL-28646. This function will return a link to download the file. We are already using it in the development version of My Moodle app. 

In reply to Jérôme Mouneyrac

Re: Vote for API functions and the params/returned values you would like

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Jerome,

what I can see is that the core_course_get_contents returns and array of contents (resources, etc..) in a course.

What about with the user private files and files in other contexts than the course?

Can I use the webservice for browsing files instead and call the webservice/pluginfile.php with the proper arguments for get this kind of files?

What I can't see is how you create the tokens for calling this file (it seems to be a required argument)

I'm reviewing this patch:

https://github.com/dongsheng/moodle/compare/master...dev_MDL-28646_course_contents_master

Regards

In reply to Juan Leyva

Re: Vote for API functions and the params/returned values you would like

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Reviewing the webservice/pluginfile.php it seems that for download files using this script the ws client must implements the authentication via tokens.

Is there any reason for not allowing authentication via wsusername and wspassword in this script?

Regards

In reply to Juan Leyva

Re: Vote for API functions and the params/returned values you would like

by Dongsheng Cai -

core_course_get_contents, as the name suggested, it's for download course contents, it won't list your private files and other files not in course context, we must develop other web service method for private files.

 

You can download files via webservice/pluginfile.php, it requires token, you need web service token for other web service communication right?

In reply to Dongsheng Cai

Re: Vote for API functions and the params/returned values you would like

by Jérôme Mouneyrac -

Ah ... thanks Donghseng, I don't know much about the files in Moodle yet. So we'll need some functions for getting the private file urls and other context file urls (then we can download these files with the pluginfile.php urls). So I guess Juan if you need them, can you suggest them on the Roadmap and create the matching issues. It would be nice.

Just a note about authentication with wsusername/wspassword, it has been implemented in the web service system but it is not recommended. It's why we don't mention it from all documentation. If there is some place mentioning that, let me know that I can remove it big grin

In reply to Jérôme Mouneyrac

Re: Vote for API functions and the params/returned values you would like

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Jerome and Dong,

about using tokens and not wsusername/wspassword, how you achieve this in the Mobile app? As far as I know, you use wsusername and wspassword for calling the webservices (this is the information that the user enter in him mobile phone)

Is there any way to get a token using the wsusernamd and wspassword?

I need to use wsusername and wspassword because I'm developing a FTP server that using web services implements the ftp common commands for downloading, uploading, etc..
For configure the FTP server the user must enter his Moodle username and password  (as the mobile phone does)

The wsusername and wspassword are not mentioned in the docs, but I like more to read code than documentation smile

Regards

In reply to Juan Leyva

Re: Vote for API functions and the params/returned values you would like

by Jérôme Mouneyrac -

Hi Juan,
yes, in 2.2, you can retrieve the token with login/token.php: http://docs.moodle.org/dev/Creating_a_web_service_client#How_to_get_a_user_token 

If I remember in 2.1 you can too, except that if you request a different service than the mobile one, the token needs to already exists. The script will not create a token for the user, even if the user has the capability to do it. This feature has been added since 2.2 (currently there: https://github.com/moodle/moodle/blob/master/login/token.php).