LMSouq
moodle-core Open

Moodle Docker Web Service working but can not be called from another docker container in the same network

RI
rixpl
1 month ago
3 views
Problem Description
I am running a moodle docker container and one other container to call moodle web service function in a same network. I'm pretty sure I have set up the moodle properly because I can call moodle web service from postman. I am also aware i need to use the container alias of the running moodle container, which in this case is `webserver`. This is what i have tried calling `http://localhost:8000/webservice/rest/server.php?moodlewsrestformat=json&wstoken=fa4e7222df472b032ca9b4bd6d17595a&wsfunction=core_user_get_users&criteria[0][key]=id&criteria[0][value]=2` from Postman and it return the following response ``` { "users": [ { "id": 2, "username": "admin", "firstname": "Admin", "lastname": "User", "fullname": "Admin User", "email": "abc@def.com", "department": "", "firstaccess": 1655901976, "lastaccess": 1655907821, "auth": "manual", "suspended": false, "confirmed": true, "lang": "en", "theme": "", "timezone": "99", "mailformat": 1, "description": "", "descriptionformat": 1, "profileimageurlsmall": "http://localhost:8000/theme/image.php/boost/core/1655902245/u/f2", "profileimageurl": "http://localhost:8000/theme/image.php/boost/core/1655902245/u/f1", "preferences": [ { "name": "core_message_migrate_data", "value": "1" }, { "name": "auth_manual_passwordupdatetime", "value": "1655902098" }, { "name": "email_bounce_count", "value": "1" }, { "name": "email_send_count", "value": "1" }, { "name": "login_failed_count_since_success", "value": "0" }, { "name": "_lastloaded", "value": 1655907864 } ] } ], "warnings": [] } ``` but when i try calling the same API from the other container i get a...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base