Module:ZoteroAPI
La documentation pour ce module peut être créée à Module:ZoteroAPI/doc
local p = {}
function p.getItemRawJson(frame)
local itemKey = frame.args[1]
if not itemKey or itemKey == '' then
return '❌ Aucun itemKey fourni.'
end
local url = 'https://api.zotero.org/groups/4893620/items/' .. itemKey .. '?include=data&format=json'
local data = mw.ext.externalData.getExternalData({
url = url,
format = 'json'
})
if not data or next(data) == nil then
return '❌ Aucune donnée reçue de Zotero.'
end
-- Encode le tableau en JSON lisible si possible
local ok, json = pcall(mw.text.jsonEncode, data)
if not ok then
return '❌ Erreur d’encodage JSON.'
end
return '<pre>' .. json .. '</pre>'
end
return p