APIs

Questions specific to particular APIs, libraries, etc.

48 Topics 167 Posts
  • How do I look-up a player?

    Solved
    2
    0 Votes
    2 Posts
    291 Views

    Hi,

    brainCloud offers a number of APIs for looking up other players. You'll find them all in the Friend service.

    As far as looking up players by name, it isn't highly recommended - since names in brainCloud are not guaranteed to be unique (and thus lookups are less deterministic and slower).

    It's generally more useful to look up other players by UniversalId - which are guaranteed to be unique.

    Now - maybe your app isn't using Universal Identities - so it seems odd to lookup by the UniversalId. Luckily, brainCloud supports a non-login version of a UniversalId - so you can have the user pick a Display Name which will be associated with their account, but they don't actually log in via it (and there's no password for it stored).

    To use non-login UniversalIds...

    Attach the non-login identity via AttachNonLoginUniversalId() Later on, to update the id, use UpdateUniversalIdLogin() <-- disregard the misleading name - it works for both login and non-login versions of UniversalId Set the player's name to match the universalId (useful for leaderboards) via UpdateUserName() Finally, to look-up a player, use FindUserByExactUniversalId() or FindUserByUniversalIdStartingWith()

    Hope that helps!

    Paul.

  • 0 Votes
    2 Posts
    315 Views

    Hi,

    Here are the steps to setting up a webhook to call a custom cloud code script in brainCloud:

    Step 1 - Write your script

    Go to Design | Cloud Code | Scripts and create your script You might want to just start with a simple script that logs the incoming parameters (see sample below) Be sure to enable the S2S callable field on the Details page.

    Step 2 - Declare the webhook and link it to your script

    Go to Design | Cloud Code | WebHooks and create your webhook Link it to the script that you just wrote. If you don't see your script in the list, double-check the state of the S2S callable field You can optionally restrict the webhook to be callable via a range of ip ranges (good for additional security) Click [Save] and copy the webhook URL that gets generated

    Step 3 - Go to the external service, and give it your webhook URL

    This step varies by service of course.

    Step 4 - Trigger the webhook to test

    This also varies by service. You could use Postman to do it as well.

    Step 5 - Confirm the structure of the incoming parameters

    It is a bit difficult to figure out what a webhook will send you ahead-of-time The simplest is to invoke the hook, and then examine the results See the sample logging script below for an example Then view the logged input data via Monitoring | Global Monitoring | Recent Errors. Be sure to enable Info -level messages, and click [Refresh]

    Step 6 - Complete the writing of your script

    Now that you know how the parameters are being sent, you should be good to complete your script. More info on webhook development here - https://getbraincloud.com/apidocs/apiref/?cloudcode#cc-ccscripts-webhooks Good luck!

    Sample script - just dumps parameters:

    var response = {}; bridge.logInfoJson("Script invoked from webhook. Contents of data...", data); // Return the webhook response response.statusOverride = 200; response.jsonResponse = {}; response;

    Note - you can also view the request sent and response received from your webhook via the Server Logs. For more information on brainCloud logs - see this knowledge base article.

    Hope that helps!

    Paul.

  • Update profile name

    Solved
    2
    0 Votes
    2 Posts
    278 Views

    Hi,

    The call you're looking for is called UpdateUserName() - https://getbraincloud.com/apidocs/apiref/#capi-playerstate-updateusername

    Good luck!

    Paul.

  • 2 Votes
    24 Posts
    3k Views

    I just got our iOS Push Notifications working with brainCloud and would like to add a few tips to this thread.

    For the less Mac-Savvy developers like me, here's what it looks like when you only have your certificate with no private key to export as a P12 file:

    Screen Shot 2019-06-19 at 4.02.20 PM.png

    Notice the selected category is [My Certificates]. Certificates in the [Certificates] category have the P12 export option greyed out.

    I am using Unity as a development platform and for some reason my device would only receive Development Push Notifications even when running in Release in Xcode. It's only after uploading to TestFlight that my Production Push Notifications started working.
  • [Unity] Authenticated Event ?

    Solved
    2
    0 Votes
    2 Posts
    264 Views

    Hmm, actually Eric, authentication only happens when called directly in brainCloud.

    If you try calling an API and your app isn't authenticated, you'll receive an error - and generally would trigger authentication yourself as part of your error handling.

    Does that make sense?

    Paul.

  • Getting names for request and invites to a group

    Solved
    3
    0 Votes
    3 Posts
    407 Views

    As an interim solution, you can add a cloud code script or a post-hook to retrieve the missing data, using the profileIds found in the request.

    https://getbraincloud.com/apidocs/apiref/#capi-friend-getsummarydataforprofileid

    ... "pendingMembers": { "382eb04f-f80c-4bfc-9a12-fca508cad476": { // <- These profile ids "role": "MEMBER", "attributes": {}, "pendingReason": "ASKED_TO_JOIN" } } ...
  • Getting public groups only

    Solved
    4
    0 Votes
    4 Posts
    317 Views

    D'oh - bit late on the update, but 4.1 has been released, and you can now search on isOpenGroup (as well as the new groupSummaryData).

    4.1 Release notes here - https://getbraincloud.com/apidocs/release-4-1/

    Cheers!

    Paul.

  • GetMyGroups never returns

    Solved
    2
    0 Votes
    2 Posts
    205 Views

    This error has been since resolved.

    A help article has been made on the groupType page: http://help.getbraincloud.com/en/articles/3272656-design-groups-group-types

    If experience similar problems to this forum topic with our Unity library, ensure brainCloud has been added to a gameObject, and that gameObject is not disabled.

  • Group system with larger than 50 limit

    Solved
    2
    0 Votes
    2 Posts
    248 Views

    Hi Chris,

    The maximum # of group members is controllable by our support team.

    Just send a request to our support team, indicating the name and appId of the app, and what you'd like the max to be and why. (A short description of your use cases would be helpful - since we just need to review to see if we think there would be any performance gotchas).

    We'll do a quick review and hopefully approve!

    Cheers!

    Paul.

  • Unity basic setup

    Solved
    5
    0 Votes
    5 Posts
    384 Views

    Cool to see the forums working! 🙂

    I've marked @Panagiotis-Milios more detailed explanation as the accepted solution, but kudos to you @Chris-Brown for pointing it out, and @Panagiotis-Milios for providing the detailed example. Thanks a bunch! 🙂

  • Unity AddressableAssets

    Solved
    4
    0 Votes
    4 Posts
    348 Views

    Follow-up on this...

    My guys have looked into it, and the way we version our global files isn't compatible with this new feature from Unity. Apologies!

    (PS - No plans yet for when/if we'll support it. Certainly tons of folks use an external CDN with brainCloud apps though - so the option is still there for you!)

  • Timeouts?

    Solved
    4
    0 Votes
    4 Posts
    344 Views

    Thanks guys! I figured it would be ridiculous if I had to do timeout checks and retries myself 🙂

  • 0 Votes
    4 Posts
    348 Views

    Happy to help! 👍

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • lobbyId ?

    Solved
    6
    0 Votes
    6 Posts
    516 Views

    Oh okay, I understand.
    Yeah I was already trying to use the C++ SDK, and I will also be waiting for the Obj-C one.

    Thank you!

  • NodeJS setup question

    Solved
    6
    0 Votes
    6 Posts
    490 Views

    Thanks @Paul-Winterhalder and @David-St-Louis-0 . I'm communicating with our web dev and am passing on the information to him. I'll respond here once I get more information from him. Appreciate the quick replies.

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

    1
    0 Votes
    1 Posts
    11 Views
    No one has replied
  • 0 Votes
    4 Posts
    230 Views

    Hi Chris,

    User entities are primarily indexed by profileId + entityType - so the singleton API will scale well no matter how many players you have.

    That said, if your use case gets more complicated, with say hundreds of entities of a particular type per user (say maybe you are modelling user created towns, that sort of thing) - you could consider using Owned Custom Entities instead. You can define addition, custom indexes for those... keeps those lookups fast and efficient.

    In addition, if you end up having >1000 Global Entities, you should definitely look at switching to Unowned Custom Entities. Same deal - you can define your own custom indexes...

    Hope that helps!

    Paul.

  • Unity Room Server

    Moved Solved
    20
    0 Votes
    20 Posts
    901 Views

    @David-St-Louis-0 @Paul-Winterhalder
    Hi again.
    I would like to debug my server locally, in Unity. I have the _S2S stuff all hooked up as described in the walk through.
    But then I tried to do the following (actual numbers redacted)

    #if UNITY_EDITOR var appId = "00000"; var serverName = "MyServerName"; var secret = "00000000-0000-0000-0000-000000000000"; _lobbyId = "00000:myLobbyTypeId:00"; #else // Load environment variables passed in by brainCloud to our container var appId = Environment.GetEnvironmentVariable("APP_ID"); var serverName = Environment.GetEnvironmentVariable("SERVER_NAME"); var secret = Environment.GetEnvironmentVariable("SERVER_SECRET"); _lobbyId = Environment.GetEnvironmentVariable("LOBBY_ID"); #endif

    However, I am getting a perpetual error:
    #S2S S2S Failed: {"packetId":1,"messageResponses":[{"reason_code":40613,"status_message":"Processing exception: Unrecognized lobby: 00000:myLobbyTypeId:00","status":400}]}

    I even signed up for a Dev+ subscription, just in case that was the problem, per this thread. No luck.

    How can I test my server code locally, while still planning for the full-on S2S Docker container deployment?
    Thanks