APIs

Questions specific to particular APIs, libraries, etc.

48 Topics 167 Posts
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • braincloud javascript and edge

    2
    0 Votes
    2 Posts
    154 Views

    Hi Bigzer,

    We aren't aware of any issues running our javascript client lib under Edge - and haven't been able to repro your issue.

    I'm not a javascript guy - but I'm noticing other warnings / errors there - do those also happen in Chrome?

    Paul.

  • 0 Votes
    2 Posts
    174 Views

    To limit operations like IncrementExperiencePoints() to cloud code only. This will essentially take away the ability to make these calls from the bare client API. You can see a script that enforces these restrictions here - https://getbraincloud.com/apidocs/cloud-code-central/handy-cloud-code-scripts/restrictclientcalls-script/

    Refer to another post below for more strategies you can apply to prevent cheating: https://forums.getbraincloud.com/topic/23/discussion-strategies-to-prevent-cheating-in-tournaments

  • 0 Votes
    3 Posts
    290 Views

    @Henry-Smith said in Recommended way to read Entity data? (Unity, C#):

    Sorry to bring back an old thread, but I'm just learning the platform and I thought I'd share my solution to this.

    First, define a generic class to handle the raw json response data:
    eg. my Tut1_AddTwoNumbers api returns:

    {"data":{"response":{"answer":24},"success":true},"status":200} public class Response<T> { public ResponseData<T> data; public int status; } public class ResponseData<T> { public T response; public bool success; }

    Then for each api call that you have, define a class that contains the fields that are custom to that response.

    public class Tut1_AddTwoNumbersResponse { public int answer; }

    Now, you call your function and handle the response like this:

    public void Tut1_AddTwoNumbers() { string scriptName = "Tut1_AddTwoNumbers"; // Anonymous object to supply the params. var data = new { num1 = 16, num2 = 8 }; var jsonScriptData = JsonWriter.Serialize(data); SuccessCallback successCallback = (response, userdata) => { var responseObject = JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response); //var responseObject = JObject.Parse(response); Debug.Log($"Success The answer is '{responseObject.data.response.answer}' | raw_json={response}"); }; FailureCallback failureCallback = (status, code, error, userdata) => { Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error)); }; // Call the script _bc.ScriptService.RunScript(scriptName, jsonScriptData, successCallback, failureCallback); }

    this line is the important part:

    JsonReader.Deserialize<Response<Tut1_AddTwoNumbersResponse>>(response);

    Hope that helps someone!

  • Processing Refunds?

    6
    0 Votes
    6 Posts
    406 Views

    @Paul-Winterhalder It'd be great if we can have this info. +1

  • How to view users online ?

    2
    0 Votes
    2 Posts
    289 Views

    Hi Jose,

    Sounds like you want to look into our Presence feature.

    Presence is designed to let users know when their friends are online. You can think of it like the old Xbox Live friends feature - where you can see which of your friends are online - and optionally what they are doing.

    And Presence uses RTT - so users will be notified in realtime when the presence information of a followed user changes.

    Presence works with Friends, Groups, and arbitrary lists of users.

    More details here - http://getbraincloud.com/apidocs/apiref/#capi-presence

    Hope that helps!

    Paul.

  • 0 Votes
    3 Posts
    351 Views

    Thank you! I will try that out.

    Just for anyone else's future reference, I realized you can "log in" as another user using GetSessionForProfile(). So if the other user is offline, you will be able to modify their data (for example, to increment an attribute for number of matches they have).

    I believe this way, you can also do what JasonL said and TurnShieldOn() for the other user, stopping them from being able to match anymore.

    Correct me if I'm wrong.

  • Simple S2S call via nodejs server

    Moved
    2
    0 Votes
    2 Posts
    336 Views

    This seems to be working now, the error is a wee misleading. The code was correct. The URL was incorrect and was changed to (or leave blank):

    const url = "sharedprod.braincloudservers.com"; ... brainclouds2s.request(global.s2sContext, { service: "group", operation: "SYS_CREATE_GROUP", data: groupData, }); })
  • 0 Votes
    2 Posts
    373 Views

    Hi Dylan, actually, the argument purchaseData for StartPurchase() method takes the Steam Item ID (from Edit Price Entry pop-up) as the input field (not the Item ID from the product list)
    7e9ff7b1-1854-4a48-8e38-d219501da3fd-image.png

  • This topic is deleted!

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • 0 Votes
    2 Posts
    321 Views

    Call AttachUniversalIdentity() method from client lib, the username is uniqueness enforced.

  • Authentication error - Unity iOS

    4
    0 Votes
    4 Posts
    456 Views

    Hi Gavin,

    Did you resolve the crash issue on iOS? I am experiencing it as well, so I feel I must have missed something 🙂

    Cheers,
    Andreas

  • 0 Votes
    1 Posts
    429 Views
    No one has replied
  • 0 Votes
    2 Posts
    284 Views

    Hi Kirlos, as you can see from the response's message field, there are two elements (id and name) underneath, you need to append .id to specify the first search field for id, so change the "message.from" to "messsge.from.id" should solve this problem.

  • 0 Votes
    2 Posts
    305 Views

    Hmm, not really...

    You can get the number of sessions created in an hour with this call: https://getbraincloud.com/apidocs/apiref/#capi-globalapp-sysgetdailycounts

    But brainCloud doesn't otherwise track a concurrent session count per app.

    There are certainly 3rd party analytics packages that you could link into your client that would give you that sort of information though.

    Paul.

  • 0 Votes
    2 Posts
    395 Views

    Hello! Thanks for your inquiry.

    The format of this response has been used for several years so to change it at this point would cause many errors for our clients. However, in situations like this, we have included the JsonFx library to help deserialize dynamic JSON objects with.

    One way to deserialize the JSON items would be to include a DeserializeItems(string) method in your Data class to be able to store them in an array using JsonFx's JsonReader.Deserialize(string) method:

    public List<Item> Items = new List<object>(); public void DeserializeItems(string jsonResponse) { var response = JsonReader.Deserialize<Dictionary<string, object>>(jsonResponse); var data = response["data"] as Dictionary<string, object>; var items = data["items"] as Dictionary<string, object>; foreach (Dictionary<string, object> item in items.Values) { var newItem = new Item(); newItem.itemId = (string)item["itemId"]; newItem.defId = (string)item["boost_rapidfire"]; newItem.quantity = (int)item["quantity"]; // etc... Items.Add(newItem); } }

    Alternatively, you can also use JsonFx's JsonWriter.Serialize(object) method in the foreach loop to then be able to use Unity's JsonUtility to automatically map it as an Item.

    Understandably, both methods have their own pros and cons. However, it should be able to get the job done in this case.

    Hope this helps! Please let us know if you have further questions or inquiries about this.

  • Error 40316 on authenticate

    Moved
    3
    0 Votes
    3 Posts
    427 Views

    @panagiotis-milios Thank you for your response, appreciate your time !
    I solved the issue :
    The url I was using was wrong, more precisely I was using the wrong servlet :
    I was using

    /dispatcherv2

    while I was supposed to use

    /s2sdispatcher.

    I also want to point out that you are right about the "appId" below the "packetId", it is not needed.
    Thank you, I hope this thread will help anyone encountering this problem !

  • 0 Votes
    3 Posts
    427 Views

    thank you

  • UserItems.AwardUserItem cannot be blocked for clients

    Unsolved
    4
    0 Votes
    4 Posts
    424 Views

    Update - we have patched this issue in our Public BaaS.

    The API call is now blockable via API Blocking - but it's also disabled by default now (via the core API itself). There's a new compatibility flag (that is by default enabled for all existing apps) that preserves the old functionality.

    Paul.