TaiSHiNet / lime-py-api

Python3 LimeSurvey API glue
GNU General Public License v2.0
11 stars 6 forks source link

how can i add Participant in central participant database by API? #5

Open zhangjianpinghik opened 8 years ago

zhangjianpinghik commented 8 years ago

when i use api function "cpd_importParticipants" to add Participant in central participant database, the result seem to be wrong? who can help me ? i use lime-py-api and create a add_participants method like this: def add_participants(self, email, firstname, lastname): data = """ { "id" : 1, "method":"cpd_importParticipants", "params": { "sSessionKey": "%s", "aParticipants": {"email":"%s", "firstname":"%s", "lastname":"%s"} } } """ % (self.session_key, email, firstname, lastname) return self._getJSON(data)

for excemple: aa.add_participants("abc@qq.com", "jim", "tom") but the result return add three add participants in in the central participant database ,but the info is : firstname lastname email a a a j j j t t t

Shnoulle commented 7 years ago

aParticipants : here you send 3 participant.

try:

{
    "0": {
        "email": "%s",
        "firstname": "%s",
        "lastname": "%s"
    }
}

or {"one":{"email":"%s","firstname":"%s","lastname":"%s"}}

PS : not a lime-py-api issue