Sign In Register

How can we help you today?

Start a new topic
Answered

Can't issue a challenge.

Hello, just trying to follow some instructions how to add a friend. And failed with the following request:


var response = Spark.sendRequestAs({

   

 "@class": ".CreateChallengeRequest",

 "challengeMessage": "Hey, lets to be friends!",

 "challengeShortCode": "FriendsRequestChallenge",

 "endTime": "2018-12-31T12:00Z",

 "usersToChallenge": candidateId

 

}, candidateId);


As a response, i'm getting the following line:

{"@class":".CreateChallengeResponse","error":{"usersToChallenge":"REQUIRED"}}


Not sure what i'm doing wrong. The candidateId is a real existing playerID. Please, help.



Best Answer

Hi Old Scheme


If looks like you are trying to send the challenge as the user you are also trying to challenge.

An example of this in cloud code is


var request = new SparkRequests.CreateChallengeRequest()

    request.challengeMessage = "Hey, lets to be friends!",

    request.challengeShortCode = "FriendsRequestChallenge",

    request.endTime = "2018-12-31T12:00Z",

    request.usersToChallenge = candidateId;

    var response = request.Execute();



Regards

Katie


1 Comment

Answer

Hi Old Scheme


If looks like you are trying to send the challenge as the user you are also trying to challenge.

An example of this in cloud code is


var request = new SparkRequests.CreateChallengeRequest()

    request.challengeMessage = "Hey, lets to be friends!",

    request.challengeShortCode = "FriendsRequestChallenge",

    request.endTime = "2018-12-31T12:00Z",

    request.usersToChallenge = candidateId;

    var response = request.Execute();



Regards

Katie


Login to post a comment