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

Creating users using core_user_create_users WS

$
0
0
by Amit Gairola.  

Hi,

   I am trying to create a new user through the core_user_create_users web services through SOAP protocol (I am new to webservices smile). I am using Moodle 2.9.


I am getting the following error : Invalid Parameter. The error is not detailed enough to let me know which parameter is invalid. Here is the print of the SOAP FaultObject.


The issue is that the error is not detailed enough to let me know which parameter is invalid. 


SoapFault Object
(
    [message:protected] => Invalid parameter value detected | ERRORCODE: invalidparameter
    [string:Exception:private] =>
    [code:protected] => 0
    [file:protected] => C:\xampp2504\htdocs\test\index.php
    [line:protected] => 22
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => C:\xampp2504\htdocs\test\index.php
                    [line] => 22
                    [function] => __soapCall
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => core_user_create_users
                            [1] => Array
                                (
                                    [0] => Array
                                        (
                                            [0] => stdClass Object
                                                (
                                                    [username] => TestUser
                                                    [password] => Abcdefg123#
                                                    [firstname] => User
                                                    [lastname] => Test
                                                    [email] => admin.user@gmail.com
                                                )

                                        )

                                )

                        )

                )

        )

    [previous:Exception:private] =>
    [faultstring] => Invalid parameter value detected | ERRORCODE: invalidparameter
    [faultcode] => Receiver
    [faultactor] => invalidparameter
)



Re: using web service from one moodle to another moodle

$
0
0
by Daniel Neis Araujo.  

Hello,


here is a brief explanation of how to install the "Moodle Provas" or "Exam Moodle" infrastructure:


  • Inside this plugin there is a file at cli/configure_remote.php , that you must set some options and run to finish the configuration of the plugin
  • On the "exam moodle", you wil have to install two plugins:


There is also a repository with the livecd project and instructions how to configure it to point to your moodle and generate instructions: https://gitlab.setic.ufsc.br/moodle-provas/livecd-provas

Here is the link to instructions on how to create the ISO: https://gitlab.setic.ufsc.br/moodle-provas/livecd-provas/wikis/GeracaoAutomatizadaDoLiveCD

Let me know if you need help translating those info too.


Kind regards,

Daniel

Re: Creating users using core_user_create_users WS

$
0
0
by Dallas Ray Smetter.  

Convert your usernames to lowercase. Change 'TestUser' to 'testuser' and I think you might be in business wink

Moodle mobile app themes

Moodle user login with external API

$
0
0
by Tom Stallings.  

Hi all, need a little guidance or where to look for some information to get some things to work.  Basically what I need to happen is when a user logins, they are authentication to an outside website via API using REST.  Once they authenticate, they are taking to their Student page and can see their course progress, completion etc. (from external site)  I believe once I figure out the login and registering piece, the rest I can figure out.

Here is an example PHP code the execute properly: (This is the login)

https://moodle.org/pluginfile.php/71946/mod_forum/post/1286482/logintest.php

Here is an example user create PHP

https://moodle.org/pluginfile.php/71946/mod_forum/post/1286482/create%20user.php


Re: Moodle user login with external API

Re: Moodle user login with external API

Re: External services - unable to add functions

$
0
0
by David Monllaó.  

Hi Gentle,

local_mobile is a non-core plugin that you installed separately, the cause might be there (or in other plugins if you have more) I will ping Juan Leyva (the plugin developer) in case he's aware of any issue there.

Thanks for commenting.


Re: External services - unable to add functions

$
0
0
by Juan Leyva.  

Hi Gentle,

how do you see the error you mentioned?, clicking in any of the Functions list links in the external services section or just in your custom service?

This error usually happens if you have a plugin/db/services.php files with functions pointing to an invalid classpath.

(I checked the last version of local_mobile and it works as expected)

Regards, Juan

Re: External services - unable to add functions

$
0
0
by Gentle Mark.  

Hi David & Juan,

Thanks for your response.

Somehow it works now. And I don't know how. I did not do anything.

When I encountered the error, I was using the Firefox browser in Windows 10.

When I used Firefox in Windows 7, it worked.

Wonder how?

Thanks for all your responses.

Re: Web services test client Error

AMF protocol to contrib

$
0
0
by David Monllaó.  

Hi all,

We would be interested in knowing how many people is using AMF protocol.

We are thinking of moving it to contrib. It has not been actively maintained for some releases, but we found no comments in moodle.org about it nor tracker issues reporting bugs. The conclusions are that, it is awesome and perfect or nobody uses it. We failed to make the AMF test client work in 29 and master (I've even tried in 2.0) what makes me think that nobody is using it. We know of people using REST, XML-RPC and SOAP with Java, anyone using AMF?

Thanks in advance,

David

Using angular-js with moodle for frontend.

$
0
0
by Joey Andres.  

Before I get started. I vomited at the sight of Moodle's OUTPUT API. I'm sorry, but those conditionals are too many states for my tiny brain to keep track of.


Now that I've stated my position, I'm currently making an activity that utilizes angular-ui as frontend. It talks to Moodle beautifully via REST. At first, I didn't use Moodle's Web Services API, but used the PHP Framework, Slim, for the routing. That being said, even though slim feels more natural (well it feels like expressjs), I tried to convert the PHP-Javascript communication to Web Services, and I've managed  to do this. Kinda.

The problem:

Web services needs token. To acquire token, the client needs username and password. To acquire username and password, Moodle must hand it in to Javascript. From here I can think of the following options:


1. User $PAGE->require->js_init_call('main_foo', array('username'=>$username, 'password'=>$password)); And you just posted the user's password in the DOM. 

2. Use Slim to hand in username/password for start. And use Moodle's Web API for the rest.

3. Send token at start via  $PAGE->require->js_init_call.


Well (1) IS NOT AN OPTION. And (2), although ugly (It feels like I'm gonna need UML sequence diagram to transfer knowledge), makes sense since Moodle's Web API can handle the capability check for the rest of the REST calls. Although I should mention the initialization, Slim handing password and username is susceptible to XSS attack. Last one, (3), I have no idea how to implement, but this is still a bad solution. Though not as bad as (1), this is still unacceptable. At least a session cookie changes each time. I could delete token each time to emulate session cookie, but that sounds wrong.


It seems that I should just use my original implementation with Slim, (I don't have to hand in sensitive information to the client, just some session cookies). But at the same time I'd really like to use Moodle's Web Services (those capability enforcements are a selling point). Can someone tell me a solution using Moodle's Web Service API. 

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

$
0
0
by Alex Legg.  

So the following is a REST call to sever.php, It successfully uses the token and calls the external function:

http://collectiveintelligencerepository.com/webservice/rest/server.php?wstoken=dd70e39c37d50d9e806305eab51c4593&wsfunction=local_myplugin_create_groups

The required parameters from the accessible external function are:

courseid => PARAM_INT
name => PARAM_TEXT
description => PARAM_RAW
enrolmentkey => PARAM_RAW

I have tried the following:

http://collectiveintelligencerepository.com/webservice/rest/server.php?wstoken=dd70e39c37d50d9e806305eab51c4593&wsfunction=local_myplugin_create_groups&courseid=10&name=tgmg&description=thisisadescription&enrolmentkey=5

And get an error...

<EXCEPTIONclass="invalid_parameter_exception">
<ERRORCODE>invalidparameter</ERRORCODE>
<MESSAGE>Invalid parameter value detected</MESSAGE>
<DEBUGINFO>Missing required key in single structure: groups</DEBUGINFO>
</EXCEPTION>

Re: AMF protocol to contrib

$
0
0
by Matt Bury.  

Hi David,

I maintain the SWF Activity Module: https://moodle.org/plugins/view.php?plugin=mod_swf

In Moodle 1.9, I couldn't get the Zend AMF library to work and so used amfPHP ( http://www.silexlabs.org/amfphp/ ) instead. However, something in Moodle 2.x breaks when used with amfPHP; the $USER object fails to instantiate correctly; and I couldn't find a fix. Since then I've been relying on URLVariables; not as powerful and flexible as AMF but at least they work.

Some members of the Moodle community can be decidedly hostile towards ActionScript and Flash which I think tends to drive away would-be adopters. I don't think that the Zend AMF library in Moodle would be missed.

Just my €0.02! smile


Re: Using angular-js with moodle for frontend.

Re: Using angular-js with moodle for frontend.

$
0
0
by Joey Andres.  

Thanks. But we are still in 2.8. Either way, we made the decision to stick with Slim for now to do the routing.

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

$
0
0
by Alex Legg.  

Plugin permissions were incorrect.

Re: How to get all assignments for a course.

$
0
0
by Ryan VanAlstine.  

Has anyone found a solution for this yet?  I'm running into the same issue.  

Re: Web services test client Error

$
0
0
by Elano yo.  

Hello All @David I am trying to use https://github.com/moodlehq/sample-ws-clients/tree/master/PHP-SOAP could you give me clue why the following error is displayed? Thank you Warning: SimpleXMLElement::xpath(): Undefined namespace prefix in /Applications/XAMPP/xamppfiles/htdocs/HRM/soap.php on line 54 Warning: SimpleXMLElement::xpath(): xmlXPathEval: evaluation failed in /Applications/XAMPP/xamppfiles/htdocs/HRM/soap.php on line 54 SoapFault Object ( [message:protected] => Invalid parameter value detected | ERRORCODE: invalidparameter [string:Exception:private] => [code:protected] => 0 [file:protected] => /Applications/XAMPP/xamppfiles/htdocs/HRM/soap.php [line:protected] => 69 [trace:Exception:private] => Array ( [0] => Array ( [file] => /Applications/XAMPP/xamppfiles/htdocs/HRM/soap.php [line] => 69 [function] => __soapCall [class] => SoapClient [type] => -> [args] => Array ( [0] => core_user_create_users [1] => Array ( [0] => Array ( [0] => stdClass Object ( [username] => testusername1 [password] => Testpassword1! [firstname] => testfirstname1 [lastname] => testlastname1 [email] => testemail1@moodle.com [auth] => manual [idnumber] => testidnumber1 [lang] => en [theme] => standard [timezone] => -12.5 [mailformat] => 0 [description] => Hello World! [city] => testcity1 [country] => au [preferences] => Array ( [0] => Array ( [type] => preference1 [value] => preferencevalue1 ) [1] => Array ( [type] => preference2 [value] => preferencevalue2 ) ) ) [1] => stdClass Object ( [username] => testusername2 [password] => Testpassword2! [firstname] => testfirstname2 [lastname] => testlastname2 [email] => testemail2@moodle.com [timezone] => Pacific/Port_Moresby ) ) ) ) ) ) [previous:Exception:private] => [faultstring] => Invalid parameter value detected | ERRORCODE: invalidparameter [faultcode] => Receiver [faultactor] => invalidparameter [detail] => Invalid theme: standard ) here is the token: $token = '21f9cc43fff73f06d408a447554ddb2c'; $domainname ='http://localhost/moodle'; $functionname ='core_user_create_users';

Viewing all 2363 articles
Browse latest View live