Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: RemoteControl: Invalid Survey ID

RemoteControl: Invalid Survey ID 1 Jahr 3 Monate her #95207

  • kobaltz
  • kobaltzs Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 24
  • Dank erhalten: 4
  • Karma: 1
I'm trying to use the RemoteControl API and am using the latest version of LimeSurvey. I have the API working for the most part. However, I am running into an issue when trying to get the survey properties (get_survey_properties). It returns the error "Invalid Survey ID".

Here is the Survey ID that I am trying to access.



Here is my code (Ruby) when trying to request the information. There is code above this, but for practical purposes, isn't needed in this issue. I reference the iSurveyID number as an integer. Also tried passing it as a string.



I know that the method Limesurvey and class API works properly since I get a return for the session key and am able to list the surveys. However, whenever it tries to get the survey ID of an object, it returns Invalid Survey ID.

Der Administrator hat öffentliche Schreibrechte deaktiviert.

RemoteControl: Invalid Survey ID 1 Jahr 2 Monate her #95358

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6198
  • Dank erhalten: 787
  • Karma: 238
Really not sure, and maybe it's really a bad idea, but maybe try with:

surveyid = 863234
.... get_survey_pro..... iSurveyID: surveyid

Denis
PS: if you have some simple ruby script to use remote control, it can be great to have it in documentation (maybe if you have a gitorious or a github account ;) )
Der Administrator hat öffentliche Schreibrechte deaktiviert.

RemoteControl: Invalid Survey ID 1 Jahr 2 Monate her #95366

  • kobaltz
  • kobaltzs Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 24
  • Dank erhalten: 4
  • Karma: 1
I will post an article on using Ruby with the RemoteControl. However, need it to get working first. :) Declaring a variable and then referencing to it shouldn't make a difference that manually entering it. I am thinking that it is an issue with the iSurveyID variable that is being posted. I think that it could be wrong. As I am looking through the documentation, there are variances in the variable for the Survey ID when posting data. It does not seem to be consistent.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

RemoteControl: Invalid Survey ID 1 Jahr 2 Monate her #95369

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6198
  • Dank erhalten: 787
  • Karma: 238
However, need it to get working first.
Sure :laugh:

In PHP:
$info = $myJSONRPCClient->get_survey_properties($sessionKey,515576,array('owner_id'));
work lik e a charm (with the good survey id)

Try first:
list_surveys( sSessionKet : sessionKey)
if you find your sid

Denis
Letzte Änderung: 1 Jahr 2 Monate her von DenisChenu.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

RemoteControl: Invalid Survey ID 1 Jahr 2 Monate her #95447

  • kobaltz
  • kobaltzs Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 24
  • Dank erhalten: 4
  • Karma: 1
Here is the result from the below code. I initially create a new object called survey where it is opening a connection to the remote control api. It creates four calls to the API and returns their responses; Session Key, Survey Properties, Survey List and Add Participant. As you can see from the image, the code does correctly establish a connection to the server and returns a valid session key. However, it will now accept the Survey ID as found in the Survey Lists.



If I change my get_survey_properties to not include the variable names (which is strange when doing a POST call in an API), I do not get an error.
response = survey.get_survey_properties(session_key,"863224",["owner_id"])



It looks like some API calls allow you to submit the POST with the variable names. However, other calls return an error if you submit them with the variable names.


survey = Limesurvey::API.new('http://localhost/limesurvey/index.php?r=admin/remotecontrol')
system("cls")
session_key = survey.get_session_key(username,password)
puts "Session Key: #{session_key}"
puts "\n"
 
response = survey.get_survey_properties(sSessionKey: session_key, iSurveyID: 863224, aSurveySettings: ["owner_id"])
puts "Properties:  #{response['status']}"
puts "\n"
 
response = survey.list_surveys(sSessionKey: session_key, sUser: "dkimura")
puts "Survey List:  #{response}"
puts "\n"
 
response = survey.add_participants(
    sSessionKey: session_key, 
    surveyID: "1",
    participantData: [
        email:"me@example.com",
        lastname:"Bond",
        firstname:"James"
      ]
  )
puts "Add Participant:  #{response['status']}"
Letzte Änderung: 1 Jahr 2 Monate her von kobaltz.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

RemoteControl: Invalid Survey ID 1 Jahr 2 Monate her #95453

  • kobaltz
  • kobaltzs Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 24
  • Dank erhalten: 4
  • Karma: 1
Now with it working in Ruby, despite not agreeing how it handles the POSTing of the data, I have updated the RemoteControl2 API Wiki Page. Feel free to make any changes. I simply copied and pasted and threw in some notes.

http://manual.limesurvey.org/RemoteControl_2_API#Ruby_Example
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.255 Sekunden
Donation Image