我正在使用以下参数致电core_course_get_courses_by_field
:&field=shortname&value=test
响应不包含Visible
参数(我需要),该参数显示在Moodle文档的默认响应示例中(马上,您可以看到Moodle的默认响应包含更多数据):
我的回复
{
courses: [
{
id: 12112,
fullname: "Test course",
displayname: "Test course",
shortname: "test",
categoryid: 91,
categoryname: "2019-3",
sortorder: 320557,
summary: "",
summaryformat: 1,
summaryfiles: [ ],
overviewfiles: [ ],
contacts: [
{
id: 1111,
fullname: "John Doe"
}
],
enrollmentmethods: [
"manual",
"imsenterprise"
]
}
],
warnings: [ ]
}
Moodle的示例响应
object {
courses //Course
list of (
object {
id int //course id
fullname string //course full name
displayname string //course display name
shortname string //course short name
categoryid int //category id
categoryname string //category name
sortorder int Optional //Sort order in the category
summary string //summary
summaryformat int //summary format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
summaryfiles Optional //summary files in the summary field
list of (
//File.
object {
filename string Optional //File name.
filepath string Optional //File path.
filesize int Optional //File size.
fileurl string Optional //Downloadable file url.
timemodified int Optional //Time modified.
mimetype string Optional //File mime type.
isexternalfile int Optional //Whether is an external file.
repositorytype string Optional //The repository type for external files.
}
)overviewfiles //additional overview files attached to this course
list of (
//File.
object {
filename string Optional //File name.
filepath string Optional //File path.
filesize int Optional //File size.
fileurl string Optional //Downloadable file url.
timemodified int Optional //Time modified.
mimetype string Optional //File mime type.
isexternalfile int Optional //Whether is an external file.
repositorytype string Optional //The repository type for external files.
}
)contacts //contact users
list of (
object {
id int //contact user id
fullname string //contact user fullname
}
)enrollmentmethods //enrollment methods list
list of (
string //enrollment method
)idnumber string Optional //Id number
format string Optional //Course format: weeks, topics, social, site,..
showgrades int Optional //1 if grades are shown, otherwise 0
newsitems int Optional //Number of recent items appearing on the course page
startdate int Optional //Timestamp when the course start
enddate int Optional //Timestamp when the course end
maxbytes int Optional //Largest size of file that can be uploaded into
showreports int Optional //Are activity report shown (yes = 1, no =0)
visible int Optional //1: available to student, 0:not available
groupmode int Optional //no group, separate, visible
groupmodeforce int Optional //1: yes, 0: no
defaultgroupingid int Optional //default grouping id
enablecompletion int Optional //Completion enabled? 1: yes 0: no
completionnotify int Optional //1: yes 0: no
lang string Optional //Forced course language
theme string Optional //Fame of the forced theme
marker int Optional //Current course marker
legacyfiles int Optional //If legacy files are enabled
calendartype string Optional //Calendar type
timecreated int Optional //Time when the course was created
timemodified int Optional //Last time the course was updated
requested int Optional //If is a requested course
cacherev int Optional //Cache revision number
filters Optional //Course filters
list of (
object {
filter string //Filter plugin name
localstate int //Filter state: 1 for on, -1 for off, 0 if inherit
inheritedstate int //1 or 0 to use when localstate is set to inherit
}
)courseformatoptions Optional //Additional options for particular course format.
list of (
object {
name string //Course format option name.
value string //Course format option value.
}
)}
)warnings Optional //list of warnings
list of (
//warning
object {
item string Optional //item
itemid int Optional //item id
warningcode string //the warning code can be used by the client app to implement specific behaviour
message string //untranslated english message to explain the warning
}
)}
我创建了一个系统角色来管理API的用户权限,具有此角色的用户是具有为这些调用生成的API令牌的用户。
这是他们的许可:
报告/课程概述:查看
mod / attendance:viewsummaryreports
面条/课程:查看其他用户
面条/课程:隐藏课程
面条/课程:隐藏部分
moodle / course:viewhiddenuserfields
面条/课程:可见性
面条/课程:活动可见度
面条/课程:隐藏活动
我在这里肯定缺少什么...为什么我看不到响应中的所有字段? API是否有特定权限?我似乎找不到有关此事的相关文档。