Global Entities retrieval issues and questions
-
I'm able to get GlobalEntities using:
_bc.GlobalEntityService.ReadEntity(entityId, successCallback, failureCallback);
But only when using the "Entity ID" (ie long string of letters and numbers). When I use the "Entity Indexed ID" ("mainsettings" in this case), the response is:
{"packetId":1,"responses":[{"status_message":"Processing exception (message): Missing record - global entity not found","reason_code":40345,"status":202}]}
So, is the indexed ID not used for that? Is it only used for GetListByIndexedId? In that case I suppose it is not unique?
My overarching question is related to the responses retrieved using any of these sorts of methods.
How do I parse these json objects once I receive them? I've seenusing BrainCloud.JSONHelper;
and
using BrainCloud.JsonFx.Json;
And some other stuff like BCEntity.ReadFromJson and BCEntityFactory. Should I be able to have those responses be converted into classes and access any of the data like mainSettingsGlobalEntity.data, mainSettingsGlobalEntity.version, etc?
Thanks
-
Hi @wjurica ,
Yes - if you want to use the entityIndexedId (which we recommend) - you should be calling GetListByIndexedId().
And yes - brainCloud returns the JSON to the client - but it's up to the client app to handle it in a way that makes sense for their app. Our client libs <unfortunately> do not automatically de-serialize it into native classes.
<Forum folks may have some suggestions on that.>
I hope that helps!
Paul.
-
Thanks Paul, I appreciate the quick response.
That really is unfortunate. I understand that making data structures for each and every response is a lot of work for your team but that is work that each and every user of BrainCloud is going to have to do themselves. That's a big ask when considering, as a new user, I'm not even sure which requests I'm going to be making yet and just trying things out is going to be a headache. I'll have to rethink this.
-
Hi @wjurica ,
I do appreciate the perspective (for sure).
That said - 99% of entities are custom JSON - and most of our API objects have extensible JSON components. And of course - there are competing JSON libraries and approaches that devs use. Plus the complications of the capabilities of the different client+library platforms (Unity/C# vs. Unreal/C++ vs. JavaScript vs. Java, etc).
So - we've tried to have our libs take a light approach and focus on the networking + error handling + security
- overall communications with the server - allowing our customers to develop their own approach for handling the JSON itself (and it is all just JSON after-all - most of the responses hardly need custom data structures).
Your feedback is heard though! brainCloud is an ever-evolving platform. Never say never!
Paul.
-
@wjurica Assuming you're using c#, consider Newtonsoft for the deserialization & mapping process. It's two lines of code to map your data to a class.