Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

MNet API: Difference between revisions

From MoodleDocs
(New page: Category:MNET ==Introduction== This page aims to serve as the canonical location for documenting the MNET API, both the XMLRPC functions and the associated code. It is a work in pro...)
 
Line 39: Line 39:
** username: string, username of user to find
** username: string, username of user to find
** format: string: currently just 'file', could be more later  
** format: string: currently just 'file', could be more later  
** data: keyed array, information PER FORMAT.
** data: keyed array, information '''per format'''
*** shared keys, expected by all formats:
*** shared keys, expected by all formats:
****  totalsize: total filesize of included files (in bytes)
****  totalsize: total filesize of included files (in bytes)

Revision as of 12:53, 9 September 2008


Introduction

This page aims to serve as the canonical location for documenting the MNET API, both the XMLRPC functions and the associated code. It is a work in progress, please add to it as you discover undocumented code.

Entry points/XMLRPC documentation

The entry point is wwwroot/xmlrpc/server.php, which at some point calls mnet_permit_rpc_call, which sets some member variables in the MNET_REMOTE_CLIENT object (mnet/remote_client.php) so that later when mnet_server_dummy_method is called, it can dispatch the call accordingly. I think mnet_server_dummy_method is the only way functions get called.

Currently you can call class methods, static methods and functions. However, for a class method, there is currently only support to construct the object with no constructor arguments.

Authentication Functions

TODO

Enrolment Functions

TODO

Portfolio Functions

send_content_intent

  • Defined in: portfolio/type/mahara/lib.php
  • Implemented in: Mahara. Moodle has this function but it is not an xmlrpc function, only a helper function to call the xmlrpc function in Mahara. (See MDL-16269)
  • Parameters:
    • username: username of user to find or create
  • Returns: Stdclass object with keys:
    • sendtype: string - either 'queue' or 'immediate' depending on what the remote system has decided
    • token: string - to use for all further communication

send_content_ready

  • Defined in: portfolio/type/mahara/lib.php
  • Implemented in: Mahara. Moodle has this function but it is not an xmlrpc function, only a helper function to call the xmlrpc function in Mahara. (See MDL-16269)
  • Parameters:
    • token: string, previously return from from send_content_intent
    • username: string, username of user to find
    • format: string: currently just 'file', could be more later
    • data: keyed array, information per format
      • shared keys, expected by all formats:
        • totalsize: total filesize of included files (in bytes)
      • 'file' format keys:
        • filesmanifest: keyed array of file information (keyed by filename):
          • filename: desired name of file
          • sha1: sha1 of file
          • size: size of file (in bytes)
        • zipfilesha1: sha1 of the zipfile containing the file(s)
        • zipfilesize: size of the zipfile containing the file(s)
    • wait: boolean. whether the remote system is expected to immediately launch a request to fetch file or queue it for cron.#
  • Returns: Stdclass object with keys:
    • status: boolean, success or failure
    • type: string, 'queued' or 'complete'

fetch_file

  • Defined in: portfolio/type/mahara/lib.php
  • Implemented in: Moodle.
  • Parameters:
    • token: string, same that was returned in send_content_intent and used subsequently in send_content_ready
  • Returns: base64 encoded file (currently a zipfile, as can include multiple files)