Sign In Register

How can we help you today?

Start a new topic
Answered

Challenge accesType

Hi,
I am trying to implement different access types for the challenges in my game.
I saw in the manual page that, when you send a "CreateChallengeRequest", you can add the "accessType" parameter to the request.
The issue I have is, every time I try to send the request, GameSparks sends me back an error response.

I do not know if I am doing something wrong or if there is some sort of bug.


Here is the request:

{
"@class":".CreateChallengeRequest",
"accessType":"FRIENDS",
"challengeMessage":"League",
"usersToChallenge":["537b4329e4b0383fa4ccaa20"],
"challengeShortCode":"LEAGUE",
"endTime":"2014-07-06T16:28Z",
"requestId":"63537668928181_9"
}

And the response I receive:

{
"@class": ".GameSparksErrorResponse",
"error": {
"message": "Wrapped java.lang.IllegalArgumentException: invalid ObjectId [undefined] (160360-response-CreateChallengeResponse#7)"
},
"message": "Wrapped java.lang.IllegalArgumentException: invalid ObjectId [undefined] (160360-response-CreateChallengeResponse#7)",
"requestId": "63537668928181",
"scriptData": null
}


Thanks.


Best Answer

Hi


In the response it's saying that the error is being created by your cloud code script "CreateChallengeResponse" at line 7 (It's actually line 8 in the editor as the index here is 0 based;


I suspect you are trying to pass in a value that is not in the response, could you disable your script and run the request again to validate the data you are trying to get is actually in the response?


Let me know how you get on


Gabriel


Answer

Hi


In the response it's saying that the error is being created by your cloud code script "CreateChallengeResponse" at line 7 (It's actually line 8 in the editor as the index here is 0 based;


I suspect you are trying to pass in a value that is not in the response, could you disable your script and run the request again to validate the data you are trying to get is actually in the response?


Let me know how you get on


Gabriel

Thanks for the quick answer.
I found the problem. When creating a Challenge with access type "FRIENDS" you can not add the array of users to challenge.
It would be great to allow the player to select which players he wants to invite in first place, and then leave it open to others friends to join.

 

Login to post a comment