Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

I'm stuck with the API (remotecontrol) of LimeSurvey

  • DidierH
  • DidierH's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207004 by DidierH
I am trying to develop a scenario on Integromat.com to call the API ("RemoteControl") of LimeSurvey to dynamically add participants to a survey.

I tested the call to the "get_session_key" function.

URL: survey.mydomain.com/index.php/admin/remotecontrol

HTTP method: POST

Header:
Content-Type: application/json
Accept: application/json
Accept-Charset: utf-8

Body:
{"method": "get_session_key", "params": {"username": "my_user_name", "password": "my_password","plugin":"Authdb"}}

Username and password are correct. I always get a "null" response.

Can someone tell me where I am wrong?
The topic has been locked.
  • DidierH
  • DidierH's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207051 by DidierH
This is the answer I receive when I try with Advanced Rest Client (Chrome extension) :

{"id":null,"result":null,"error":"unable to decode malformed json"}
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207060 by DenisChenu
I think there are a HTML error here maybe have a look to server log ?
(we must imporove error log with remote_control, really difficult).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • DidierH
  • DidierH's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207087 by DidierH
Hi !
I had a look at log files. Nothing found. And http response is "200".
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207111 by DenisChenu
Silly question surely : remote control is activated ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • DidierH
  • DidierH's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207118 by DidierH
:)
Yes...Remotecontrol is enabled.

Activated RPC Interface : JSON-RPC
Publish API in /admin/remotecontrol : YES
Devine Access-Control_allow_origin header : NO
(no difference if yes, obviously)

Are there some specific php modules that should be activated too ? Something else I have to think about ?
The topic has been locked.
  • DidierH
  • DidierH's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 5 months ago #207136 by DidierH
I finally found the error. Stupid me : I just had to scrupulously respect JSON-RPC.
Instead of this :
{"method": "get_session_key", "params": {"username": "my_user_name", "password": "my_password","plugin":"Authdb"}}
I had to write :
{"method": "get_session_key", "params": ["my_user_name","my_password","Authdb"],"id":1}
And it works...
Thank you for your help.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #207145 by DenisChenu
Thanks ,

Yes, josn api 1 : forums.limesurvey.org/forum/french-forum...tion-de-l-api#207010

You just need to add the id and fix the array ?

Can you try with
{"method": "get_session_key", "params": ["username": "my_user_name", "password": "my_password","plugin":"Authdb"],"id":1}
?

If you fopund time to add some elements on manual.limesurvey.org/RemoteControl_2_API#Example_and_helper it can be really great :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose