public static MoodleCourse[] getCoursesById(long[] courseids) throws MoodleRestException, UnsupportedEncodingException{
        Vector v=new Vector();
        MoodleCourse course=null;
        StringBuilder data=new StringBuilder();
        String functionCall=MoodleCallRestWebService.isLegacy()?MoodleServices.MOODLE_COURSE_GET_COURSES:MoodleServices.CORE_COURSE_GET_COURSES;
        if (MoodleCallRestWebService.getAuth()==null)
            throw new MoodleRestCourseException();
        else
            data.append(MoodleCallRestWebService.getAuth());
        data.append("&").append(URLEncoder.encode("wsfunction", MoodleServices.ENCODING)).append("=").append(URLEncoder.encode(functionCall, MoodleServices.ENCODING));
        for (int i=0;i<courseids.length;i++) {
            if (courseids[i]<1) throw new MoodleRestCourseException(MoodleRestException.REQUIRED_PARAMETER+" courseid"); data.append("&").append(URLEncoder.encode("options[ids]["+i+"]", MoodleServices.ENCODING)).append("=").append(courseids[i]);
        }
        data.trimToSize();
        NodeList elements=MoodleCallRestWebService.call(data.toString());
        course=null;
        for (int j=0;j<elements.getLength();j++) {
            String content=elements.item(j).getTextContent();
            String nodeName=elements.item(j).getParentNode().getAttributes().getNamedItem("name").getNodeValue();
            if (nodeName.equals("id")) {
                if (course==null)
                    course=new MoodleCourse(Long.parseLong(content));
                else {
                    v.add(course);
                    course=new MoodleCourse(Long.parseLong(content));
                }
            }
            course.setMoodleCourseField(nodeName, content);
        }
            
        if (course!=null)
            v.add(course);
        MoodleCourse[] courses=new MoodleCourse[v.size()];
        for (int i=0;i<v.size();i++) {
            courses[i]=(MoodleCourse)v.get(i);
        }
        v.removeAllElements();
        return courses;
    }