Example of web services token from external application

Example of web services token from external application

by sai prasad -
Number of replies: 1

I'm trying to find an example for webservices token based call from external application, could anyone give me an example of that, my external application is in asp.net, I'm not familiar with PHP so please provide me with an example .


i have also tried using user key authentication web service but the only problem is how to call from external application through webservice??


i was trying this below:

https://myserver/MoodleN/webservice/rest/server.php?wstoken=506d602cf47a74de6e819123244b4141&wsfunction=testwebservice&moodlewsrestformat=jsonplease help?

Average of ratings: -
In reply to sai prasad

Re: Example of web services token from external application

by Arshad Syed -

1. First check in moodle site you have enable WEB services or not

how to enable:

1=>site adm->plugins->web services->overview->click on "Enable web services"-> Enable web services "Mark Checkbox".

2=>site adm->plugins->web services->manage Protocols->Enable (which ever protocol you want).

3=>site adm->plugins->web services-> manage tokens->click Add button->select user you want to give access for APIs-> It will generates token(use for accessing APIs).


How to get token:

https://www.yourmoodle.com/login/token.php?username=USERNAME&password=PASSWORD&service=SERVICESHORTNAME


How to use web services:

http://www.yoursite.com/webservice/rest/server.php?wstoken=7c6b2cba5c27e8eabbb8cd8c69c8e5c0&wsfunction=core_completion_get_activities_completion_status&courseid=7&userid=5&moodlewsrestformat=json;

'header' => "Content-type: application/x-www-form-urlencoded",
'method' => 'POST'


Regards

Arshad Syed

https://www.3esofttech.com/