Welcome to the LimeSurvey Community Forum

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

Adding Participants using API

  • premosystems
  • premosystems's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 3 months ago #179389 by premosystems
Adding Participants using API was created by premosystems
I am trying to add participants using the API but get a response of {"id":1,"result":{"status":"No permission"},"error":null}

I have successfully created a session key and retrieved the list of surveys. I am accessing the call using the owner of the survey who is also an admin with full access.

My JSON call is:

{"method": "add_participants","params": ["SessionKey",123456,[{"firstname": "James","lastname": "Bond","email": "james@bond.com","attribute_1": "Male","attribute_2": "042"}],true ], "id": 1}

I have tried a wide variety of changes with no joy.

What am I doing wrong or is this part of the API broken?

I am having similar issues with some other calls. Some are adding records like this one and some are getting data like token responses.

Any assistance will be greatly appreciated.
The topic has been locked.
More
5 years 2 months ago #179751 by iosman
Replied by iosman on topic Adding Participants using API
wow great information totally love it buddy.
The topic has been locked.
More
5 years 2 months ago - 5 years 2 months ago #179801 by iosman1
Replied by iosman1 on topic Adding Participants using API
SPAM
Last edit: 5 years 2 months ago by DenisChenu.
The topic has been locked.
  • premosystems
  • premosystems's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 2 months ago #180059 by premosystems
Replied by premosystems on topic Adding Participants using API
OK, so I have managed to add participants using the API.

Format is

{
"method": "add_participants",
"params": {
"sSessionKey":"##############################",
"iSurveyID": 123,
"aParticipantData":
[
{
"firstname": "Stephen",
"lastname": "Jones",
"email": "stephenj@hotmail.com",
"emailstatus": "OK",
"language": "en",
"token":"MG0007",
"attribute_1": "XYZ"
}
]
},
"bCreateToken": "false",
"id": 1
}

But how do I do this and SET the token for the user. I want specific tokens that relate to other information.

When I use the following in aParticipantData nothing happens and a Token is set for the user irrespective of the bCreateToken setting:

"token":"MG0007"

If I can't set as part of add_participant, can I change using set_participant_properties ?

I get a "No valid Data" status if I use this JSON:

{
"method": "set_participant_properties",
"params": {
"sSessionKey":"##########################",
"iSurveyID": 123,
"iTokenId" : 8,
"aTokenData":
[
{
"token":"MG0007"
}
]
},
"id": 1
}
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose