How to Create Web Services in Moodle

Поделиться
HTML-код
  • Опубликовано: 12 июн 2021
  • In this video you are going to learn How Web Services Infrastructure Works in Moodle.
    Web services enable other systems to login to Moodle Sites and perform certain operations.
    To run the web service and make it works, you can visit the end point from the browser or via curl.
    For example to call a function via REST protocol, we can use below endpoints:
    1) Generating a Token for Web Service
    yoursite/login/token.php?username=USERNAME&password=PASSWORD&service=SERVICESHORTNAME
    URL : yoursite/login/token.php
    username : xyz
    password : abc
    service : service123
    2) Making an API Call
    yoursite/webservice/rest/server.php?wstoken=7c335a5bd39a46cb2db589735d97774e&wsfunction=local_custom_service_update_courses_sections&moodlewsrestformat=json&courseids=14
    URL : yoursite/webservice/rest/server.php
    wstoken : 04e3a50c7c60b0ffdb175c45bdecd850
    wsfunction : local_custom_service_update_courses_sections
    moodlewsrestformat : json
    PARAM1 : 123
    PARAM2 : 557
    PARAM3 : 777
    Read more about moodle web services here :
    docs.moodle.org/dev/Web_services
    Read more about moodle by visiting :
    docs.moodle.org/311/en/Main_page
    Explore this sample plugin for making custom services :
    github.com/arjunsingh0037/Cus...
    I hope you gain something out of this video. Incase you got any queries, do comment the same in the comment box. Also please make sure to like this video and subscribe to my channel.
    { Moodle Arjun }: { / @moodlerarjun }

Комментарии • 58

  • @georgeishere3791
    @georgeishere3791 2 года назад +17

    Just FYI to those using a later version than in the video, you may find that the 'web services' subcategory shown at 3:40 has moved from the plugins tab to the Server tab.
    This is the case for 3.11.6 but may be the case for earlier versions too.

  • @itsjustaname7311
    @itsjustaname7311 Месяц назад

    thanks a lot!
    part from 11:00-14:00 is crucial to understanding the whole!
    give this part more attention, folks =)

  • @astuteaarthi
    @astuteaarthi 2 года назад

    New subscriber here.Thanks for the content.please do more videos on moodle especially in development.Thanks again

  • @user-ld4qw1ml9l
    @user-ld4qw1ml9l Год назад

    Thank you very much!

  • @fate784
    @fate784 2 года назад

    thank you so much, you've saved my life

  • @LM2CH
    @LM2CH 4 месяца назад

    Great!!! You help me, so much thank you!!!😀

  • @muhammadnaveedkhan6739
    @muhammadnaveedkhan6739 Год назад

    Thank you Sir. Please make more videos on moodle especially in development.

  • @varenneriocha8712
    @varenneriocha8712 3 года назад +1

    Hi Arjun, very userful. Thank you!

  • @muhammadnaveed7953
    @muhammadnaveed7953 5 месяцев назад

    Please upload videos on a regular basis. It's really necessary.

  • @varenneriocha8712
    @varenneriocha8712 Год назад

    You are on a Linux desktop, right? What is the distribution and the window manager?

  • @chandankumar-jp4li
    @chandankumar-jp4li 2 месяца назад

    Please make a video on How to setup Global search in moodle in webserver?

  • @Javed.humayun
    @Javed.humayun 2 года назад +1

    Hello . very useful video. Kindly make tutorial for moodle mobile app plugin. or moodle mobile support for plugin.

    • @moodlerarjun
      @moodlerarjun  2 года назад

      Thanks. Surely i'll be making videos on Moodle Mobile App and its customization.

  • @muhammadnaveed7953
    @muhammadnaveed7953 5 месяцев назад

    Hi sir, please make a video series on how to create a mod plugin in Moodle?

  • @meeramolennasseril9819
    @meeramolennasseril9819 2 года назад

    Hi , Could u pls share the custom files ie.Service.php and version.php etc

  • @panupongsirirat8363
    @panupongsirirat8363 2 года назад

    Can web service post to login moodle session without using SSO?

  • @hikingmiles9992
    @hikingmiles9992 2 месяца назад

    I want to give discount to students if they are member on another website and also i have created api to handle request by user member id but i ma stuck on how to achive this in moodle to change the original price of course and give them discounts if they are a member please suggest me any lead

  • @marchypolite
    @marchypolite 2 года назад +3

    What theme are you using tho it looks good

  • @christianmiguez1379
    @christianmiguez1379 9 месяцев назад

    Hi guys,
    I need to allow students to subscribe to courses depending on the response from a third party web service. I mean the user will be allowed or not first depending on this external service.
    I am new developing moodle, I know the best way is to create a plugin to handle it, but can you put me in the right direction on how would be the best way to do it? Some documentation or something similar built before.
    Thanks in advance!

    • @moodlerarjun
      @moodlerarjun  6 месяцев назад

      there are many authentication plugins given by moodle on default, however a little customisation is required in order to achieve your workflow. You can go with the userkey authentication plugin and as soon as the users gets in the system(created or logging in), you can add your condition or login. On passing that, you can redirect them to relevant pages/courses etc. This is the function 'user_login_userkey() ' which handles this, you can extend it or customise there itself

  • @MatiasBautista
    @MatiasBautista 2 года назад +1

    Gracias amigo, me has salvado el culo.

  • @ngothequyen7955
    @ngothequyen7955 3 года назад +1

    Thank you, your video so useful, could you please share your demo code?

    • @ngothequyen7955
      @ngothequyen7955 3 года назад +2

      And, could you plesa show me how can i call this function via javascript (ajax)?

    • @moodlerarjun
      @moodlerarjun  3 года назад +1

      You can find it in the video description.

    • @moodlerarjun
      @moodlerarjun  3 года назад +1

      If you know how to use Moodle AMD structure, below could help you.
      define(['jquery','core/ajax'], function($, ajax) {
      return {
      init: function() {
      var crs = $('[data-region="data-sample"]').data('displaycourse');
      var promises = ajax.call([
      {
      methodname: 'local_custom_service_get_course_modules',
      args: {courseid: crs}
      }
      ]);
      promises[0].done(function(result) {
      //do something
      }).fail(function() {
      //do something
      });
      }
      };
      });

    • @moodlerarjun
      @moodlerarjun  2 года назад +1

      Sure. You can check this sample plugin for the same : github.com/moodlerarjun/Custom-service

    • @layendiaye7366
      @layendiaye7366 2 года назад

      @@moodlerarjun Hi great jo goahead. This repo is not available. Can you please share it again.

  • @alexgana8417
    @alexgana8417 2 года назад +1

    Bhai plzzzzz🙏🙏🙏 make a video in hindi plzzz broo form integration api including checkbox, drop-down,, etc plzzz

    • @moodlerarjun
      @moodlerarjun  2 года назад

      Sure, why not. I'll share the link once it is ready and up.

  • @rahullad8846
    @rahullad8846 2 года назад +1

    Arjun I am not able to get web service link in the Plugin section, Can you please help me out same

    • @moodlerarjun
      @moodlerarjun  2 года назад

      Sure, you can send your files to moodlerarjun@gmail.com . I'll look into it.

  • @gabrieladedayo9156
    @gabrieladedayo9156 2 года назад

    Hi, thanks for this video. But mine is not showing web service under plugins

    • @maheshchahare
      @maheshchahare 2 года назад +1

      It is under server in 3.11 version.

  • @vcfaiz
    @vcfaiz Год назад

    Hi, can we edit the existing functions on moodle ?

    • @moodlerarjun
      @moodlerarjun  6 месяцев назад

      Yes we can, what are you trying to changes. Better extend the class to your native plugin(s), and make the required changes

  • @mathieubilodeau9262
    @mathieubilodeau9262 3 года назад +1

    What is that specific Moodle theme?

    • @moodlerarjun
      @moodlerarjun  3 года назад

      Basically this is Moodle Space Theme.
      Check here : demo.rosea.io/space/1/

    • @moodlerarjun
      @moodlerarjun  3 года назад

      Sure. Thank you 🙂

  • @alexgana8417
    @alexgana8417 2 года назад +1

    Plzzz bro

  • @raviyerra9148
    @raviyerra9148 2 года назад +1

    How can I get the course quiz and its password via request ?

    • @moodlerarjun
      @moodlerarjun  2 года назад

      Good question. However in similar approach, we can do this. Pass a quiz id and get all related data like quiz details, response, correct answer,etc. Please check this plugin as a reference : github.com/moodlerarjun/Custom-service

  • @jorgeprada7197
    @jorgeprada7197 8 месяцев назад

    Me aparece el plugin en overview pero no en external services ayuda

    • @moodlerarjun
      @moodlerarjun  6 месяцев назад

      can you please ellaborate a little more

  • @venkateshvenkatesh.p9473
    @venkateshvenkatesh.p9473 Год назад

    Arjuna please share me core user creation web services api very urgent

  • @fridaynightfirstshow1406
    @fridaynightfirstshow1406 2 года назад

    Bro how to customise login page with code pls let me know

    • @moodlerarjun
      @moodlerarjun  2 года назад +2

      You should not touch the core login pages. However you can do full customisation via theme layouts and any auth type plugin.

  • @mdashiquehusain1982
    @mdashiquehusain1982 11 месяцев назад

    Wbservice on karne ke liye kahan type karna hai yo jo aap type kar rahe hain wo to bataya nahi aapne?

    • @moodlerarjun
      @moodlerarjun  6 месяцев назад

      So there is an option in site administration where you can check all the enabled protocols and related settings. Make sure those are enabled.