Coder Social home page Coder Social logo

moodle's Introduction

Moodle API for Golang

This is a simple Moodle API that wraps the Moodle JSON Web Service API. It is part of a project that is currently in use in a live production environment, and is under active development.

It was developed in a hurry, no warranty is given or implied. Use at your own risk. Pull requests welcome.

Example usage

// Setup
api := moodle.NewMoodleApi("https://moodle.example.com/moodle/", "a0092ba9a9f5b45cdd2f01d049595bfe91", l)

// Search moodle courses
courses, _ := api.GetCourses("History")
if courses != nil {
	for _, i := range *courses {
		fmt.Printf("%s\n", i.Code)
	}
}

// Search users	
people, err := api.GetPeopleByAttribute("email", "%")
if err != nil {
	l.Error("%v", err)
	return
}
fmt.Println("People:")
for _, p := range *people {
	// Do something
}

moodle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

moodle's Issues

Access control exeption

I get the following error while creating a user:

{"exception":"webservice_access_exception","errorcode":"accessexception","message":"Access control exception"}
panic: Access control exception. https://exam.redstoneunion.de/webservice/rest/server.php?wstoken=5ee41bb0f11b8f1c04412f2cb5c1a6c6&wsfunction=core_user_create_users&moodlewsrestformat=json&users[0][firstname]=Baum&users[0][lastname]=Garten&users[0][email]=Famefqwf%40qqff.de&users[0][username]=baum&users[0][password]=wfwHHHH54858%2A%2A%2A%23

goroutine 1 [running]:
main.main()
        /home/mrgeorgen/dev/go/RBU_account/moodle.go:9 +0x21e
exit status 2

code:

package main

import "github.com/zaddok/moodle"

func main() {
	moodle := moodle.NewMoodleApi("https://exam.redstoneunion.de/", "token")
	_, err := moodle.AddUser("Baum", "Garten",  "[email protected]" ,  "baum", "wfwHHHH54858***#")
	if err != nil {
		panic(err)
	}
}

The web service has permission for auth_email_get_signup_settings and auth_email_signup_user

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.