Server Authoritative
The Venly API can also be used in any of your custom Microservices. All endpoints of the Venly API are available because Microservices run server-side anyway.
First, you have to make sure that your Microservice has access to some required dependencies. To achieve this, some configurations have to be applied to the Assembly Definition file of the corresponding Microservice. Follow the instructions described here.
- Add the '
venly.beamable.microservice
' to the Assembly Definition References list - Add 'Newtonsoft.Json.dll' to the Assembly References list
- Add 'VenlyAPI.Core.dll' to the Assembly Reference list
- Press Apply
Second, before you'll be able to use any of the features of the API is to initialize it. This can be achieved in one of two ways using the VenlyBeamable
class:
Option 1: Initialize by passing the Realm Config Service
This requires you to set up your Realm configuration with some expected keys, see Configure Realm Config
[ClientCallable]
public async Task MyCustomServerTask()
{
//This will initialize the Venly API (using your RealmConfig)
await VenlyBeamable.Initialize(Services.RealmConfig);
//Call any Venly API function you want!
var transferResult = await VenlyAPI.Wallet.MetaTransaction_TransferMultiToken(/*...*/);
//...
}
Option 2: Initialize by passing Client Credentials
You can also initialise immediately by providing your Client Credentials and selecting the target environment.
[ClientCallable]
public async Task MyCustomServerTask()
{
//This will initialize the Venly API (using your Credentials)
await VenlyBeamable.Initialize("CLIENT-ID", "CLIENT-SECRET", eVyEnvironment.staging);
//Call any Venly API function you want!
var transferResult = await VenlyAPI.Wallet.MetaTransaction_TransferMultiToken(/*...*/);
//...
}
Updated about 1 year ago