Trying to make first REST call - getting invalid_parameter_exception

Trying to make first REST call - getting invalid_parameter_exception

autor Carol Griffiths -
Počet odpovedí: 1

I'm trying to make a call to the rest webservice.

   POST  http://domain.com/webservice/rest/server.php?wstoken=4725a345345435342322a6560b068547297748e17&wsfunction=mod_forum_get_forum_discussions_paginated

The token is assigned to my user.

with post data:

    {

        "forumid":2438

    }

Headers:

    Accept: application/json

    Content-Type: application/json

But I get the error:

    <?xml version="1.0" encoding="UTF-8" ?>

    <EXCEPTION class="invalid_parameter_exception">

    <ERRORCODE>invalidparameter</ERRORCODE>

    <MESSAGE>Invalid parameter value detected</MESSAGE>

    </EXCEPTION>

I have my moodle session as a cookie. What am I doing wrong here?

Priemer hodnotení : -
V odpovedi na Carol Griffiths

Re: Trying to make first REST call - getting invalid_parameter_exception

autor Darko Miletić -

You are sending input parameters s JSON. Moodle web services do not support that. You should send parameters as classic POST or GET params.

http://domain.com/webservice/rest/server.php?wstoken=4725a345345435342322a6560b068547297748e17&wsfunction=mod_forum_get_forum_discussions_paginated&forumid=2438