Quantcast
Channel: Web services
Viewing all 2364 articles
Browse latest View live

Re: update grades via webservices

$
0
0

by Helen Foster.  

Hello,

Sorry I don't know anything about updating grades via web services, however I thought I'd just make sure you've seen the documentation on various ways of importing grades into Moodle: Grade import.


Re: update grades via webservices

$
0
0

by Joscha Zander.  

Yes i have seen these and i am missing an excel-file template there (f.e.). I think most of the documentation lacks basic information on important work flows and features. But thanks for your answer anyway. 

Re: Set grades using webservices and core api.

$
0
0

by Joscha Zander.  

I am currently working on a solution for that. Did you achieve anything on that?

Webservice API core_message_get_messages limitfrom

$
0
0

by Robert Schrenk.  

Hi,

I want to read all messages using the Webservices API. In order to load only new Items I want to use the parameter "limitfrom" as described in the API documentation.

In the first run I stored the latest messageid, but this did not work. So I expected the parameter to count the messages and store the amount.

In order to catch all messages (from-me-read, from-me-unread, to-me-read, to-me-unread), I need to call the webservice 4 times (is this correct???)

#1 Get all messages that have been sent to me and are read
[wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 18
[useridfrom] => 0
[read] => 1
[limitfrom] => 30 #2 Get all messages that have been sent to me and are unread [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 18
[useridfrom] => 0
[read] => 0
[limitfrom] => 0 #3 Get all messages that I have sent and are unread [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 0
[useridfrom] => 18
[read] => 0
[limitfrom] => 36 #4 Get all messages that I have sent and are read [wstoken] => 22fa2[.....]2c36b
[moodlewsrestformat] => json
[wsfunction] => core_message_get_messages
[type] => conversations
[newestfirst] => 0
[useridto] => 0
[useridfrom] => 18
[read] => 1
[limitfrom] => 0

The limitfrom Parameter always shows the amount of messages that have been loaded during the first run.

Case #1 works as expected. It loads 30 messages in the first run, stores that amount. In the second run no more messages are loaded and the counter stays the same.

Case #2 and #4 do not show any messages (there are none), this is too expected behaviour.

Case #3 loads 36 messages in the first run, stores that amount. In the second run it loads again 36 messages, the counter doubles.

I have no idea whats going wrong here, is this a bug in the Moodle Code?

EDIT:  The Moodle Version i used was 3.0.7

Regards

Robert

Moodle And Totara Web Services API Compatibility

$
0
0

by Phil Nichols.  

Hi, does anyone know if the Totara web services API is exactly the same as the Moodle web services API?

Ideally I would like to know if I develop simple functionality such as, marking activity completion for a user using Moodle web services, will migrate straight across to Totara with no changes. 

Thanks,

Phil

Re: Moodle And Totara Web Services API Compatibility

$
0
0

by Marcus Green.  

You are probably asking in the wrong place. Totara is a fork of Moodle and I believe that currently source code is not publicly available. The people who are most likely to be able to answer your question are the people who produce Totara. The chances are that it is highly compatible at the moment and will gradually become slightly less compatible over time.

when i want Add functions,dropdown hide automatically

$
0
0

by sadaf sadafian.  

hi.

i have this problem after upgraded to Moodle 3.2. Please look at this short film:

http://www.screencast.com/t/dODB4Kfdwfns

When i want to add functions to the web service, the dropdown list for select Name of webservice is hide.indeed one second the list is showing and Immediately hidden and result look like the attached image:


using webservice to download audiofiles for quiz questions?

$
0
0

by Jerry Kalkhof.  

Hi guys,

I've been developing a mobile app to display quiz questions, however I ran into a particular problem with the quiz information question type.

Normally I can use the files api to download audio files this way:

When I submit a url query based on the data sent back in question get attempt:

http://localhost/moodle//webservice/pluginfile.php/181/question/questiontext/527/i/157/pinyin.mp3?token=33d918456dca5f5577fd307444ddfa0d

I get this error:

{"error":"Coding error detected, it must be fixed by a programmer: There is no question_attempt number 0 in this attempt.","stacktrace":null,"debuginfo":null,"reproductionlink":null}

The only way I found around this was to add in a "fix" in mod/quiz/lib.php : in function quiz_question_pluginfile

// fix to handle getting audio for information type questions from webservice/pluginfile.php
    if (($slot != 'i') && !$attemptobj->check_file_access($slot, $isreviewing, $context->id,
            $component, $filearea, $args, $forcedownload)) {
        error_log("mod/quiz/lib.php: quiz_question_pluginfile: check_file_access FAILED!");
        send_file_not_found();
    }


Is there a better way around this problem? I haven't found anything from my research in Moodle Tracker.


thanks


Re: when i want Add functions,dropdown hide automatically

$
0
0

by sadaf sadafian.  

friendly bump wink

Browse private files

$
0
0

by Turakar Turakar.  

Hello,

I'm trying to implement a client which allows browsing the private files of a user to display them on a connected beamer.

I therefore obtained a token successfully (as service moodle_mobile_app, as I did not yet register an own service) and saved it. I then did a request like this:

curl 'https://thehost/webservice/rest/server.php?wstoken=mytoken&moodlewsrestformat=json&wsfunction=core_files_get_files&component=user&filearea=private&itemid=0&filepath=%2F&filename=test.txt&contextid=0'

I obtained values for all the parameters using various searches, but I did not yet understand the meaning of component, itemid and contextid. What would be appropiate values for them?

I also tried the following request to browse the files in generale, i.e. list them:

curl 'https://thehost/webservice/rest/server.php?wstoken=mytoken&moodlewsrestformat=json&wsfunction=core_files_get_files&component=user&filearea=private&itemid=0&filepath=%2F&filename=&contextid=0'

But this delivered, like the first command:

{"parents":[],"files":[]}

So what am I doing wrong?

Best regards,

Turakar


Getting the error "Invalid response value detected" for "oktech_get_user_byusername" through REST webservice

$
0
0

by Praneeth D.  

Hello,

We use the method oktech_get_user_byusername and pass the wstoken and the username as the input parameters. For the generated link we are receiving the below response for some employees.

 <?xml version="1.0" encoding="UTF-8" ?>

-<EXCEPTION class="invalid_response_exception">

 <ERRORCODE>invalidresponse</ERRORCODE>
 <MESSAGE>Invalid response value detected</MESSAGE>
 </EXCEPTION>


Sample URL format: https://aaaa.bbb.cc/webservice/rest/server.php?wstoken=<wstokennumber>&wsfunction=oktech_get_user_byusername&userinfo=<username>

We are using Moodle 2.0.

Could you please help in resolving this error.

Thanks,

Praneeth

Re: Web service for obtaining a Feedback activity

$
0
0

by lee kirkland.  

I'm looking for the same and can not find it. I guess, I'll have to make something in house for the web service portion. 

Web service not worked in moodle 3.2

$
0
0

by Aniket Sankpal.  

Hi,

I upgraded my moodle from 2.9.3 to 3.2. My web service is installed in local directory.

This web service is worked perfectly fine on moodle 2.9.3 and even it is working on my another moodle version 2.9.5.

But when I updated moodle to 3.2 it is not working.

And I have a feeling that my web service is not getting called.

I checked moodle doc it is showing web service for 2.X version not for 3.X

How to make this work ?

Any suggestion?

Re: .NET C# Moodle Integration Class

$
0
0

by Steve Bergen.  

Hi Mark,


Thank you for your code.  This will be very useful for an integration project I am working on.


There seem to be a couple of dependencies missing and I'm hoping you could provide them:

  • Website.Common.Exceptions.MoodleIntegration
  • Website.Common.Objects.BC.Moodle


It seems that Elmah and BC.Website.Infrastructure.Dependencies.Abstract.Moodle are not required in this implementation.


Thanks.

Re: Web service not worked in moodle 3.2

$
0
0

by Mohammed Essaid MEZERREG.  

Perhaps you should check if they still enabled along with the related configurations like the authenticated users, tokens, protocols, .. etc.

And if everything is good, I think you should check the functions you are using, are they still there, because some functions are deleted from the webservices like core_user_get_users_by_id (this I know about) and they added additional services too, so maybe your client is outdated by the new upgrade. You check the list of functions in this page http://yourmoodleurl/admin/webservice/documentation.php or you can go to site administration > plugins > webservices > API Documentation

Re: moodle REST Web Services optiional fields not work

$
0
0

by Mohammed Essaid MEZERREG.  

The second way is the correct one, also you should use the same name of the custom field when you created it also, the function is core_user_create_users so as the function mentions it's 'users' and not 'user' plural taking all this in mind this is how you create a new user or n users:

assuming that you have userOne to userN classes ready and you want to pass them to the in a post request:

first you should wrap them in an array like this : $users = array($userOne, $userTwo, ...., $userN);

then wrap them in the list of users (it can be an object or an array) : $param = array("users" => $users);


you can also make it short like this $param = array("users" => array($userOne, $userTwo, ..... , $userN)):

then pass the $param to your method or function that will handle the post request

Re: Integrating moodle with a mobile application

$
0
0

by Mohammed Essaid MEZERREG.  

Yes, most of the apis are ready through moodle webservices plugins, it provides you with the capability to create external webservices along with a built-in mobile service which you can use with their mobile app (open source also) the mobile app also has two version the first one built on top of phonegap and the second using ionic (and you can build it with phonegap). You can customize it as you wish and it contains all the necessary functionalities for having a course. You can also in the new version of it, to register as a new user.

And believe me, you don't want to reinvent the wheel, it's complicated and time consuming to think everything through, but if you want to spend time on it I recommend reading their code which is very beautiful and professional ( I learned a lot from this app as a developer).

Re: REST Web service - Missing required key in single structure: groups

$
0
0

by Alexis Rengifo.  

Hey Alex. Where exactly did you set up plugin permissions?

I am running my custom rest service and having the same response from the server (the one you mentioned on top)

Error - Web Services - No access rights in module context

$
0
0

by Usaamah Patel.  

Hi I am running the following code in PHP (Curl), However on execution of the code below:

<?php


$curlint = curl_init();


curl_setopt($curlint,CURLOPT_URL,'http://localhost/Project/moodle/webservice/rest/server.php?wstoken=cc1a302430c43a8b2df5bfee7d4ebc56&wsfunction=mod_assign_get_grades&assignmentids[0]=1&moodlewsrestformat=json');


$run = curl_exec($curlint);


curl_close($curlint);


if (empty($run)){

      print "Nothing returned from url.<p>";

  }

  else{

      print $run;

  }

?>


I get the following error:


{"assignments":[],"warnings":[{"item":"assignment","itemid":1,"warningcode":"1","message":"No access rights in module context"}]}1


I have had a look at the assignment id in the mod_assign table in the database and it shows as 1, I have no idea where I am going wrong?

How can I place an image on the page using *.ftl template?

$
0
0

by testuser1 test1.  

I am using Restlet framework for creating Web server application. I created a resource on the server: /accounts/{accountId}. Template page accountPage.ftl is used to display the resource.

Just for testing purpose I created a very simple template containing just one string:
<h1>Hello world</h1>
In this case everything seems to be ok. For example page localhost:8111/accounts/21 is displayed correctly.

Now I want to go further and to add some more information to the resource. What I tried to do first, was adding an image on the template:
<h1>Hello, world</h1> <img src="img/user21.jpg">
But this time the image is not displayed. I have an error: "the resource localhost:8111/accounts/21/img/user21.jpg is not found". It does not metter where to place the folder img. It looks like the server is looking for the image in the network but not in the local machine's file system. How can I add the image on my template using local machine's file system?

Viewing all 2364 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>