Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

SUJET : RemoteControl: Invalid Survey ID

RemoteControl: Invalid Survey ID il y a 1 an 3 mois #95207

  • kobaltz
  • Portrait de kobaltz
  • Hors ligne
  • Junior Lime
  • Messages : 24
  • Remerciements reçus 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.

L'administrateur a désactivé l'accès en écriture pour le public.

RemoteControl: Invalid Survey ID il y a 1 an 3 mois #95358

  • DenisChenu
  • Portrait de DenisChenu
  • Hors ligne
  • Moderator Lime
  • Messages : 6252
  • Remerciements reçus 799
  • Karma: 239
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 ;) )
L'administrateur a désactivé l'accès en écriture pour le public.

RemoteControl: Invalid Survey ID il y a 1 an 3 mois #95366

  • kobaltz
  • Portrait de kobaltz
  • Hors ligne
  • Junior Lime
  • Messages : 24
  • Remerciements reçus 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.
L'administrateur a désactivé l'accès en écriture pour le public.

RemoteControl: Invalid Survey ID il y a 1 an 3 mois #95369

  • DenisChenu
  • Portrait de DenisChenu
  • Hors ligne
  • Moderator Lime
  • Messages : 6252
  • Remerciements reçus 799
  • Karma: 239
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
Dernière édition: il y a 1 an 3 mois par DenisChenu.
L'administrateur a désactivé l'accès en écriture pour le public.

RemoteControl: Invalid Survey ID il y a 1 an 3 mois #95447

  • kobaltz
  • Portrait de kobaltz
  • Hors ligne
  • Junior Lime
  • Messages : 24
  • Remerciements reçus 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']}"
Dernière édition: il y a 1 an 3 mois par kobaltz.
L'administrateur a désactivé l'accès en écriture pour le public.

RemoteControl: Invalid Survey ID il y a 1 an 3 mois #95453

  • kobaltz
  • Portrait de kobaltz
  • Hors ligne
  • Junior Lime
  • Messages : 24
  • Remerciements reçus 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
L'administrateur a désactivé l'accès en écriture pour le public.
Modérateurs: ITEd
Temps de génération de la page : 0.314 secondes
Donation Image