- Posts: 5
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
LSRC2 JSON/RPC export_responses() returns an empty string
2 years 1 week ago #216754
by kawsay
LSRC2 JSON/RPC export_responses() returns an empty string was created by kawsay
Hi,
I'm trying to export responses through the API using Ruby. I've no problem for getting a session key and the call to the method export_responses returns a 200 OK with an empty string as payload.
After several tests, I can't figure out what's wrong with my instance. Here's what I've tested:
Here's the JSON payload I'm sending:
The headers:
It returns 200OK and the payload is "" (empty string)
My questions is: should I install a plugin in order to export responses through the API ?
Thanks for your time,
Regards
ps: I'd be glad to share my script (once working & clean) to the community, as it lack of a Ruby example
I'm trying to export responses through the API using Ruby. I've no problem for getting a session key and the call to the method export_responses returns a 200 OK with an empty string as payload.
After several tests, I can't figure out what's wrong with my instance. Here's what I've tested:
- Verify that the 'Content-Type' header is set to 'application/json'
The content-type of the HTTP request must be application/json. Most formatting errors are a failure to set the content-type header. This will result in a null response from the server (not a JSON response).
- Verify that each parameters are passed in the corresponding order
The parameter structure uses arrays of values - you *must* send the values in the API expected order (see jsonrpc specification ).
- Fill 3 or more parameters (3 are required, session_key, survey_id, document_type)
- Tweak some parameter's value
- Test different value for the DocumentType parameter:
@param string $sDocumentType any format available by plugins (for example : pdf, csv, xls, doc, json)
Here's the JSON payload I'm sending:
Code:
"{\"method\":\"export_responses\",\"params\":[\"JatBameDZtYllc9jGFCvZnZeUWXUrjVI\",534582,\"json\"]}"
Code:
accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3 accept: */* user-agent: Ruby host: my.instance.org content-type: application/json connection: Keep-Alive content-length: 89
My questions is: should I install a plugin in order to export responses through the API ?
Thanks for your time,
Regards
ps: I'd be glad to share my script (once working & clean) to the community, as it lack of a Ruby example
The topic has been locked.
2 years 1 week ago - 2 years 1 week ago #216758
by kawsay
Replied by kawsay on topic LSRC2 JSON/RPC export_responses() returns an empty string
I solved my problem by passing "id": 1 as additional parameter (as in other snippets)
The full payload is
If you've time,
Why is this parameter needed ? Is it a LimeSurvey requirement, or a JSON/RPC one ? Can't see any reference to it in the documentation
The full payload is
Code:
"{\"method\":\"export_responses\",\"params\":[\"mCazeazeaezIOkJ~K5RC29anh1sq~m\",534582,\"json\"],\"id\":1}"
If you've time,
Why is this parameter needed ? Is it a LimeSurvey requirement, or a JSON/RPC one ? Can't see any reference to it in the documentation
Last edit: 2 years 1 week ago by kawsay. Reason: format
The topic has been locked.
- DenisChenu
-
- Offline
- LimeSurvey Community Team
-
Less
More
- Posts: 13146
- Thank you received: 2423
2 years 1 week ago - 2 years 1 week ago #216774
by DenisChenu
No JSONRPC library for Ruby ?
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.
Replied by DenisChenu on topic LSRC2 JSON/RPC export_responses() returns an empty string
JSON-RPC ! not related to LimeSurvey implementation.I solved my problem by passing "id": 1 as additional parameter (as in other snippets)
The full payload isCode:"{\"method\":\"export_responses\",\"params\":[\"mCazeazeaezIOkJ~K5RC29anh1sq~m\",534582,\"json\"],\"id\":1}"
If you've time,
Why is this parameter needed ? Is it a LimeSurvey requirement, or a JSON/RPC one ? Can't see any reference to it in the documentation
No JSONRPC library for Ruby ?
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.
Last edit: 2 years 1 week ago by DenisChenu. Reason: ? to !
The topic has been locked.
2 years 6 days ago #216814
by kawsay
Replied by kawsay on topic LSRC2 JSON/RPC export_responses() returns an empty string
indeed, I'm so ignorant !
There's some, though I prefer reinventing the wheel using native libraries (already learned something by doing so).
Thanks for you answer
There's some, though I prefer reinventing the wheel using native libraries (already learned something by doing so).
Thanks for you answer
The topic has been locked.