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

Enable web services for mobile devices

$
0
0

by Amanda Hayes.  

I am trying to enable this in my moodle. But when I save changes, the check mark disappears. Why? How can I fix this? I am trying to set up simple push notifications to our clients from moodle, and think this is the right step?


Enable Web services for mobile devices

$
0
0

by Amanda Hayes.  

I am trying to enable this in my moodle. But when I save changes, the check mark disappears. Why? How can I fix this? I am trying to set up simple push notifications to our clients from moodle, and think this is the right step?

Re: Debugging web services - How ?

$
0
0

by Cristian Blanquer.  

I have a little trick to do a var_dump:

Function example xxx

- In xxx_parameters we do not have to do anything

- In xxx will put a var_dump($something);die;

- In xxx_returns will put 

return new external_value(PARAM_RAW, 'Description');
In our ws client we must have our headers on TEXT/PLAIN
header('Content-Type: text/plain');

And we'll see the log.

Hope that helps, regards

Quiz: review attempts

$
0
0

by Ricardo Flores Cabal.  


Hi guys

I'm developing an webapp using angularjs and phonegap. A few days ago, I started to work with quiz services, when I process the quiz, I'm using this url:

https://mysite.com/webservice/rest/server.php?moodlewsrestformat=json&attemptid=230&wstoken=<token>&wsfunction=mod_quiz_process_attempt&finishattempt=1

Answers are being save it with mod_quiz_save_attempt.

Once the quiz is saved and finished, in my database, in table mdl_quiz_attempts, the attempt has the column preview as "1"

My problem is that "1", when I used mod_quiz_get_user_attempts for getting the attempts of my user doesn't show the attempt that I already did.

Are there a way to make preview as "0" using mod_quiz_process_attempt?


Thank you!



I can't enable webservices

$
0
0

by Johannes Bucka.  

I am trying to enable webservices. But when I save changes, the check mark disappears.
In Database moodle_config the value shows 1, but in my moodle the webservices are not enabled.

Re: Debugging web services - How ?

$
0
0

by Suraj Kumar.  

I would like to add one point here that I got going through the moodle tracker regarding calling web service function through xml-rpc client. 


If we are using moodle version < 3.1 , then we should use

header('Content-Type: text/plain');
For moodle version 3.1 onward, 

$curl->setHeader('Content-type: text/xml');

Moodle tracker link - https://tracker.moodle.org/browse/MDL-54808

Re: Debugging web services - How ?

$
0
0

by Suraj Kumar.  

I would like to add one point here that I got going through the Moodle Tracker regarding calling web service function through xml-rpc client. 


If we are using moodle version < 3.1 , then we should use

header('Content-Type: text/plain');
For moodle version 3.1 onward, 

$curl->setHeader('Content-type: text/xml');

Moodle tracker link - https://tracker.moodle.org/browse/MDL-54808

Enable Web services for mobile devices

$
0
0

by Amanda Hayes.  

I am trying to enable this in my moodle. But when I save changes, the check mark disappears. Why? How can I fix this? I am trying to set up simple push notifications to our clients from moodle, and think this is the right step?


Web service to upload files (Diplomas) to the area of ​​Private Files of users

$
0
0

by Agustin Viera.  

Hello to the whole community,

The question is the following to see if anyone knows or done something similar: is it possible, using the Moodle web services, upload files (pdf diplomas created in another application) to a user's Private Files zone?

Following the steps indicated in Moodle,

I have enabled Web Services, protocols (SOAP in this case), I have created a role and I have assigned it to a user with permissions to make use of the web service, checked user privileges, selected a service and added functions. The most seemingly similar functions to do what I intend are:

Core_files_upload: upload a file to moodle

Core_user_add_user_private_files: Copy files from a draft area to users private files area

I have added the web service user as an authorized user, created a tab, enabled the generation of web services documentation,

And now what I have left is the service check for which I have to create and use a web services client. But the web service test client that incorporates Moodle (I am using version 3.2) does not allow me to use the service I just created.

"All the web services functions in the test client have not yet been implemented"


Would someone be so kind to guide me or tell me how to use the web service? I have read the documentation and get lost with so much technicality.


Thank you very much to the whole community.


A greeting.

error in using REST service to upload file in moodle

$
0
0

by fazel faraji.  

I want to use moodle's REST api to apload a file to moodle.

this is my code in java script:

            var domainname = 'http://192.168.1.75/moodle';
            var token = '7e086857a2c98be468d804c5be8a1fae';
            var functionname = 'core_files_upload';
            var serverurl = domainname + '/webservice/rest/server.php';
            var userstocreate = [{
                component: 'mod_lesson',
                contextid: 1,
                filearea: 'private',
                itemid: 1,
                filepath: "/test",
                filename: "nametothefile",
                filecontent: "string hellooooo",
                contextlevel: "module",
                instanceid: 1576,

            }];
            var data = {
                wstoken: token,
                wsfunction: functionname,
                moodlewsrestformat: 'json',
                users: userstocreate
            };
            var response = $.ajax({
                type: 'POST',
                data: data,
                url: serverurl
            });
            window.console.info(response);

But when i run it , It gives me this error :

exception":"invalid_parameter_exception","errorcode":"invalidparameter","message":"Invalid parameter value detected","debuginfo":"Missing required key in single structure: component

what should i do??


How To implement Private / Public Key Certificate ready for both Acuity and IBIS Server.

$
0
0

by JAGADEESH G G.  

How To implement Private / Public Key Certificate ready for both Acuity and IBIS Server.

How To make the system/ Application with an integration to WS-security Axis 2 Ready

$
0
0

by JAGADEESH G G.  

How To make the system/ Application with an integration to WS-security Axis 2 Ready

How To implement SOAP content encrypt / decrypt by using x.509 certificate Cryptography.

$
0
0

by JAGADEESH G G.  

How To implement SOAP content encrypt / decrypt by using x.509 certificate Cryptography.

core_course_search_courses Invalid parameter value detected

$
0
0

by Sanjay Singh.  

Hi,

I am trying to consume the service core_course_search_courses, which was working well for version 3.0 but not working as per my expecting for version 3.2.


 $function_name = 'core_course_search_courses';
    $course['criterianame'] = 'search';
    $course['criteriavalue'] = 'AEE4_P2_2015';
 

   $token = 'xxxxxxxxxxxxxxxxxxxx';
   $domainname = 'http://xxxxxxxxxxxxx';

   $serverurl = $domainname . '/webservice/soap/server.php'. '?wsdl=1&wstoken=' . $token;
    $xml = simplexml_load_file($serverurl);
    $faulcode = $xml->xpath('/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultcode');
    if (!empty($faulcode[0]))
    {
        $faultcode = (array) $faulcode[0];
        print_r($faultcode[0]);
        $faultstring = $xml->xpath('/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault/faultstring');
        if (!empty($faultstring[0]))
        {
            $faultstring = (array) $faultstring[0];
            print_r('<BR/>');
            print_r($faultstring[0]);
        }
        die();
    }
   
    $client = new SoapClient($serverurl);
    try
    {
        $resp = $client->__soapCall($functionname, $params);
    }
    catch (Exception $e)
    {
        print_r($e);
    }
   
    if (isset($resp))
    {
        return $resp;
    }


When the above code is executed, it gives the following output

SoapFault Object ( [message:protected] => Invalid parameter value detected | ERRORCODE: invalidparameter [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/html/moodle/myservices/test/SoapCall_1.php [line:protected] => 35 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/html/moodle/myservices/test/SoapCall_1.php [line] => 35 [function] => __soapCall [class] => SoapClient [type] => -> [args] => Array ( [0] => core_course_search_courses [1] => Array ( [criterianame] => search [criteriavalue] => AEE4_P2_2015 ) ) ) [1] => Array ( [file] => /var/www/html/moodle/myservices/test/lib/CreateCourse.php [line] => 19 [function] => SoapCall1 [args] => Array ( [0] => core_course_search_courses [1] => Array ( [criterianame] => search [criteriavalue] => AEE4_P2_2015_Samabula ) ) ) [2] => Array ( [file] => /var/www/html/moodle/myservices/test/Server.php [line] => 28 [function] => checkCourse [args] => Array ( [0] => AEE4_P2_2015 ) ) ) [previous:Exception:private] => [faultstring] => Invalid parameter value detected | ERRORCODE: invalidparameter [faultcode] => Receiver [faultactor] => invalidparameter [detail] => requiredcapabilities => Invalid parameter value detected: Only arrays accepted. The bad value is: '' )


Can you assist me in identifying what am I doing wrong here


Thanks

Sanjay

use web services to upload a file and get it

$
0
0

by fazel faraji.  

i want to use moodle services to upload a file and use it later .what should i do?


core_user_create_users

$
0
0

by tim shannon.  

Greetings,

I have a web service that creates new users - with the core_user_create_users function.  It creates the users, it returns the info as per the docs, with user number etc.

However, I cannot log in as the new user created by the webservice.  This is returned in the address bar:

/?errorcode=3


If I then use the "lost password" page - moodle emails the email with the reset password page.  After re-inserting the password - it works.


I have checked the password variables to the very last - to this point:

    $user1 = new stdClass();
    $user1->username     = $userName;
    $user1->password     = $slpWord;
    $user1->firstname = $firstName;
    $user1->lastname     = $familyName;
    $user1->email         = $email;
    $user1->auth         = 'manual';
    $user1->city         = $city;
    $user1->country     = $country;

All is good, but it (the password) does not work for the newly created user.

Any suggestions very welcome,  tim

core_course_get_courses by categoryid

$
0
0

by Tony C. Batista.  

I want get a list of courses from one category, because i have a lot of courses (10000+).

It's possible using function core_course_get_courses or another?

Something like this: https://tracker.moodle.org/browse/MDL-29659

Thanks.

Manual grade item names

$
0
0

by Zoe Bogner.  

I'm attempting to extract some user grade information using web services. The grades are a mix of activities and manual items.

I have been able to extract the grades using gradereport_user_get_grade_items, but this function doesn't return the titles of the items.

Is there any way to get the names of manual grade items using web services?

Thanks,
Zoe

Getting redirected to login page when using REST Web Service

$
0
0

by Agustín Rodríguez.  

Hi! 


The Context:

I have a Moodle 3.x installation and right now I'm trying to integrate an external system to it. This system needs to fetch users and courses so I want to provide a web service (preferably rest) in order to allow his developers to fetch that info.


The Problem:

I followed this steps: https://docs.moodle.org/dev/Creating_a_web_service_client in order to enable the web service, so I created a user, with Manual Authentication, then a role, assigned that role to the created user, after that I created the external service, assigned the necessary capabilities, etc, etc and finally tested the web service using the tool provided in the Overview page of Web Services plugin:  http://[hostname]/admin/webservice/testclient.php. It works! But here is the problem: When I try to use it from my external system (Using the curl.php script found here: https://github.com/moodlehq/sample-ws-clients), or even using a REST client (Insomnia) I get redirected to the login page instead of receiving the REST operation result. The URL that I'm using to call the REST service is: http://[hostname]/webservice/rest/server.php?wstoken=[token]&wsfunction=[function]&moodlewsrestformat=json


What I'm doing wrong? Could you help me please?


Thanks

Re: Manual grade item names

Viewing all 2364 articles
Browse latest View live


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