Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[RELEASED] Moodle API

Discussion in 'Assets and Asset Store' started by bdovaz, Dec 26, 2017.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,016
    My asset only implements User login, User details and all Scorm endpoints by default but it is extensible enough so you can add the endpoints you want and need.

    There are more than 100 endpoints so it is not feasible for me to implement them, that's why I left the door open for anyone to add the ones they need.
     
    d41602031 likes this.
  2. Grinchi

    Grinchi

    Joined:
    Apr 19, 2014
    Posts:
    123
    if anyone will have problem with Password or Username that contains #@% ect special symbols remember to encode your username and password before sending to to API with EscapeURL :)
     
    bdovaz likes this.
  3. Selva_Ofl

    Selva_Ofl

    Joined:
    Sep 22, 2022
    Posts:
    3
    Hi bdovaz,
    I am using the Moodle API and I have set all the configurations in Moodle and checked with postman for tokens. It 's working on Postman. But When use the same thing in example code in documentation. I get an Argument Null Exception. I am also new to Moodle can anyone help?

    Thanks in advance!.

    upload_2023-1-25_12-32-43.png
     
  4. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,016
    Please show me the stacktrace, looking at that error I can't see the context of which script on which line is failing....
     
  5. Selva_Ofl

    Selva_Ofl

    Joined:
    Sep 22, 2022
    Posts:
    3
    Thanks For the immediate Response bdovaz. It turns out, it was a Silly mistake I made and realized it. The field username was in Camel case like "userName" that's the error. I have fixed it it's working good and It's a nice Package. Thanks.
     
    bdovaz likes this.
  6. MiguelAtencio

    MiguelAtencio

    Joined:
    May 7, 2019
    Posts:
    4
    Can I get a demo before purchasing this asset?
     
  7. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,016
    I don't have any demo available but you can see that I have a good reputation in the reviews of my assets.

    If you purchase it I will be glad to answer your questions.
     
  8. isasaurio

    isasaurio

    Joined:
    Nov 13, 2016
    Posts:
    17
    Hello friends, when trying to execute the "sample" scene, I get the following error



    NullReferenceException: Object reference not set to an instance of an object
    Moodle.MoodleAPI.DoGet (System.String path, System.Action`1[T] OnCompleted) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:144)
    Moodle.MoodleAPI.Get[T] (System.String path, System.Action`1[T] OnComplete) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:128)
    Moodle.MoodleAPI.GetToken (System.String username, System.String password, System.String service) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.User.cs:41)
    Moodle.MoodleAPI.GetToken (System.String username, System.String password) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.User.cs:29)
    Moodle.Samples.Sample.Awake () (at Assets/MoodleAPI/Samples/Sample.cs:23)


    how can I solve that?
     
  9. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,016
    Change that Sample.cs Awake to Start, it's a race condition in the sample script.
     
  10. isasaurio

    isasaurio

    Joined:
    Nov 13, 2016
    Posts:
    17
    Thanks now it works fine but I have another problem, try to do the example "Get tracks example
    " and when I run it I get this error:


    NullReferenceException: Object reference not set to an instance of an object
    Moodle.GetTrackExample+<>c__DisplayClass2_0.<Start>b__1 (Moodle.MoodleAPI sender, Moodle.User[] users) (at Assets/GetTrackExample.cs:37)
    Moodle.MoodleAPI.<GetUser>b__114_0 (System.String json) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.User.cs:60)
    Moodle.MoodleAPI+<>c__DisplayClass33_0.<Get>b__0 (System.String json) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:122)
    Moodle.MoodleAPI.HandleComplete (System.String json, System.Action`1[T] OnComplete) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:183)
    Moodle.MoodleAPI+<>c__DisplayClass35_0.<DoGet>b__1 (System.String json) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:152)
    Moodle.DefaultWebRequest+<DoGet>d__10.MoveNext () (at Assets/MoodleAPI/Runtime/Request/DefaultWebRequest.cs:53)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <56073df97ede4f769c2cc45d546d986d>:0)
     

    Attached Files:

  11. isasaurio

    isasaurio

    Joined:
    Nov 13, 2016
    Posts:
    17
    I have another problem, try to do the example "Get tracks example
    " and when I run it I get this error:


    NullReferenceException: Object reference not set to an instance of an object
    Moodle.GetTrackExample+<>c__DisplayClass2_0.<Start>b__1 (Moodle.MoodleAPI sender, Moodle.User[] users) (at Assets/GetTrackExample.cs:37)
    Moodle.MoodleAPI.<GetUser>b__114_0 (System.String json) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.User.cs:60)
    Moodle.MoodleAPI+<>c__DisplayClass33_0.<Get>b__0 (System.String json) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:122)
    Moodle.MoodleAPI.HandleComplete (System.String json, System.Action`1[T] OnComplete) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:183)
    Moodle.MoodleAPI+<>c__DisplayClass35_0.<DoGet>b__1 (System.String json) (at Assets/MoodleAPI/Runtime/API/MoodleAPI.cs:152)
    Moodle.DefaultWebRequest+<DoGet>d__10.MoveNext () (at Assets/MoodleAPI/Runtime/Request/DefaultWebRequest.cs:53)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <56073df97ede4f769c2cc45d546d986d>:0)
     

    Attached Files:

  12. MiltonPulgarImova

    MiltonPulgarImova

    Joined:
    Nov 2, 2020
    Posts:
    6
    Hi, Will you implement (using api rest) other LMS such as blackboard, Canvas, succesfactors, etc? Do you have any roadmap?
    Regards!
     
  13. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,016
    I think all the LMS you mention are commercial ones with which I don't have access to them and moreover each one implements a completely different API and I don't even know if they allow interacting with Scorms which is precisely the origin of this asset.
     
  14. MiltonPulgarImova

    MiltonPulgarImova

    Joined:
    Nov 2, 2020
    Posts:
    6
    Hi! I’ve purchased the package and read the documentation. Like others, I’ve encountered several errors, but fortunately, I’ve been able to solve them thanks to various comments.
    I’m new to e-learning, so I don’t understand why the configuration needs a SCORM dummy. What is the purpose of that?.
    On the other hand, there are 2 different documents: one from the Asset Store and one inside the package. The package only has one test scene called "Sample".
    Regards!
     
    Last edited: Oct 26, 2023
  15. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,016
    What do you mean by SCORM dummy? To create a SCORM type activity in the LMS? It is necessary because the API needs a scorm type activity of a course, it has to exist.

    The documentation offline exists by Unity requirement, the most updated is the online one.

    And the example scene is the one that covers all the functionality of the asset.

    If you have specific doubts do not hesitate to ask.