How to integrate with Moodle?

Describe the problem/error/question

how to integrate with Moodle? or call their api?

What is the error message (if any)?

Asked n8n assistant, got the hallucination which is not available…

Please share your workflow



Share the output returned by the last node

Information on your n8n setup

  • 1.60.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (n8n cloud):
  • Operating system: windows

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

What data are you trying to return? and are you familiar with HTTP requests?

If you are not, there’s an overview here of the HTTP request node (which you can use to call the Moodle API): HTTP Request node documentation | n8n Docs

You’ll likely need:

  • An API key that gets sent secretly in the header or query (from your Moodle account)
  • The endpoint / url you are requesting data from
  • To know what you are sending to Moodle to get or post the correct data e.g. if you’re uploading content for a cms, you’ll need to append it to the body as part of the http request

Hi @Simon_Coton

Thanks for reply.

Moodle suggests to use user token
https://docs.moodle.org/dev/Creating_a_web_service_client

How should I setup the HTTP request node?
Authentication: Generic Credential Type
Generic Auth Type ?
Custom Auth ?

Moodle endpoint
core_user_get_users
core_course_get_courses

Thanks

From what I can see, you’d need to make two requests:

  1. Login to retrieve a token >> use a HTTP request with Generic Auth type i.e. username and password >> get “token” from the response

  2. This token should then be passed in the “core_user_get_users” or other requests as it validates that YOU as a user are making a request. I can’t see exactly the terminology but it seems to be ‘token’ in name, then the actual token value you’ve received from your login request in value

This is where I got that info from:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.