Avoid Error 400 on Buddy Service group creation

0 votes

Hi I've doing some tests for the implementation of the buddy service in our Unity game, right now Im not using the User Servcie, just the storage service to save my users, but when I try to Create a group for a User, I get the next messages on the console Xcode:

 

Create FriendList for player [Guest] with UniqueID[0f607264fc6318a92b9e13c65db7cd3c]

 

Json String : {"app42":{"buddy":{"userName":"0f607264fc6318a92b9e13c65db7cd3c","groupName":"Friends"}}}

 

apiKey9b45a57f861c7d6356cfbdc2f82005eb8efb15bdb651b86dd5a285d4d8800619body{"app42":{"buddy":{"userName":"0f607264fc6318a92b9e13c65db7cd3c","groupName":"Friends"}}}timeStamp2014-05-27T22:55:29.399Zversion1.0

 

GetInstance Not Null

 

QueryString is ?

 

POST URI : https://api.shephertz.com/cloud/1.0/buddy/group?

 

Calling: Wait For request callback

 

Exception on group creation : com.shephertz.app42.paas.sdk.csharp.App42Exception: 400 bad request

 

with code AppCode[0] HttpCode[0]

 

The "With code AppCode [0] HttpCode[]" comes from my code on the Callback:

 

public class GroupCreatedCallBack : App42CallBack  

{   

    public void OnSuccess(object response)  

    {  

        App42Log.Console("Friend Group Succesfully Created!");

        Buddy buddy = (Buddy) response;       

        App42Log.Console("userName is : " + buddy.GetUserName()); 

        buddy.SetOwnerName(buddy.GetUserName());

        App42Log.Console("groupName is : " + buddy.GetGroupName());

        //Do Something OnSuccess

    }   

 

    public void OnException(Exception e)  

    {  

      App42Log.Console("Exception on group creation : " + e); 

       App42Exception appException = (App42Exception)e; 

       int appErrorCode = appException.GetAppErrorCode();

       int httpErrorCode = appException.GetHttpErrorCode();

       Debug.Log("with code AppCode["+appErrorCode+"] HttpCode["+httpErrorCode+"]");

    }  

}

 

 

What could be the problem with this implmentation?

 

PD: Is The BuddyService App42HQ dashboard ner realease?

 

Thabks in Advance!

 

asked May 27, 2014 in App42 Cloud API-BaaS by chrystiansilva (33 points)

1 Answer

0 votes

Hi Chrystiansilva,

Can you print the message of 400 Bad Request which you are having in creating group & let me know that which SDK version you are working on.

By just printing the app42Excpetion.GetMessage() . So that we can better explain what is the issue it is.

answered May 28, 2014 by hs00105 (517 points)
edited May 28, 2014 by hs00105
Sure the result is the next:

Create FriendList for player [Guest] with UPID[0f607264fc6318a92b9e13c65db7cd3c]
 
 Json String : {"app42":{"buddy":{"userName":"0f607264fc6318a92b9e13c65db7cd3c","groupName":"Friends"}}}
 
apiKey9b45a57f861c7r6356cfbdc2f82005eb8efb15bdb651b86dd5a285d4d8800619body{"app42":{"buddy":{"userName":"0f607264fc6318a92b9e13c65db7cd3c","groupName":"Friends"}}}timeStamp2014-05-28T14:25:24.461Zversion1.0
 
 GetInstance Not Null
 
 QueryString is ?

POST URI : https://api.shephertz.com/cloud/1.0/buddy/group?
 
Calling: Wait For request callback

Exception on group creation : com.shephertz.app42.paas.sdk.csharp.App42Exception: 400 bad request
 
with code AppCode[0] HttpCode[0] Message[]

The code of the last line is:

App42Log.Console("Exception on group creation : " + e);
App42Exception appException = (App42Exception)e;
int appErrorCode = appException.GetAppErrorCode();
int httpErrorCode = appException.GetHttpErrorCode();
Debug.Log("with code AppCode["+appErrorCode+"] HttpCode["+httpErrorCode+"] Message["+appException.GetMessage()+"]");

Not sure if this is better or worts =/

Thanks
Looks like I've already found the problem, that user already have a group called friends, and I was expecting for an error code telling me that, now that I know, I am able to solve it, it still is weird to get no error message or a valid code, though.

Any idea?

Thanks!
Can you tell me that which SDK version you are working on.
Sure, the version is the 2.6.

Best,
I can check with that release.
Also, I will recommend you that work with the latest release that have some new feature and few bug fix.You can download the SDK from here.
https://github.com/shephertz/App42_Unity3D_SDK/archive/master.zip
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...