Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-22965

Create Moodle REST client

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 2.0
    • Hub, Web Services
    • MOODLE_20_STABLE

      A Moodle REST client would be useful for web services and also hub.

      /**
       * REST client class
       */
      class webservice_rest_client {
          /**
           * Execute client WS request with token authentication
           * @param string $entrypointurl
           * @param string $token
           * @param string $functionname
           * @param array $params
           * @return mixed
           */
          public function call($entrypointurl, $token, $functionname, $params) {
              global $DB, $CFG;
       
              //traditional Zend xmlrpc client call (integrating the token into the URL)
              $serverurl = $entrypointurl."?wstoken=".$token;
              $result = download_file_content($serverurl.'&wsfunction='.$functionname, null, $params);
              $result = convert_xml_to_object($result);
              return $result;
          }
       
          /**
           * Convert the REST XML response into php object/array/primary type
           * @param string $xml
           */
          public function convert_xml_to_object($xml) {
              //TO DO
          }
      }

            jerome Jérôme Mouneyrac
            jerome Jérôme Mouneyrac
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.