# Sharing: UE5 RpcUpdateMetadata

**URL:** <https://forum.heroiclabs.com/t/sharing-ue5-rpcupdatemetadata/5635>\
**Category:** Client Libraries\
**Tags:** sdk-unreal\
**Created:** [September 13, 2024, 9:18pm UTC](https://forum.heroiclabs.com/t/sharing-ue5-rpcupdatemetadata/5635 "2024-09-13T21:18:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadowfinderstudios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/shadowfinderstudios/32/2343_2.png) [@shadowfinderstudios](https://forum.heroiclabs.com/u/shadowfinderstudios)\
**Post date:** [September 13, 2024, 9:18pm UTC](https://forum.heroiclabs.com/t/sharing-ue5-rpcupdatemetadata/5635/1 "2024-09-13T21:18:12Z")

</div>

In case anyone else needs to update metadata for the account in UE blueprints, I managed it using VaRest:

> **[RpcUpdateMetadata posted by anonymous | blueprintUE | PasteBin For Unreal Engine](https://blueprintue.com/blueprint/8c45sny8/)**
>
> No description provided

And, the server code (Typescript) file update\_metadata.ts:

```auto
let rpcUpdateMetadata: nkruntime.RpcFunction = function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, payload: string): string {
    if (!ctx.userId) { throw Error('No user ID in context'); }
    if (!payload) { throw Error('Payload expected.'); }

    let metadata = null;
    try {
        metadata = JSON.parse(payload);
    } catch (error) {
        logger.error('Error parsing: %q', error);
        throw error;
    }

    let username = null;
    let displayName = null;
    let timezone = null;
    let location = null;
    let langTag = null;
    let avatarUrl = null;

    try {
        nk.accountUpdateId(ctx.userId, username, displayName, timezone, location, langTag, avatarUrl, metadata);
    } catch (error) {
        logger.error('Could not update account: %q', error);
        throw error;
    }

    return JSON.stringify({});
}

```

Also, make sure to edit your tsconfig.json to add “./update\_metadata.ts” to the “files” array.

And, in main.ts update to:

```auto
...
const rpcIdUpdateMetadata = 'update_metadata_js';

function InitModule(ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, initializer: nkruntime.Initializer) {
   ...
   initializer.registerRpc(rpcIdUpdateMetadata, rpcUpdateMetadata);
   ...
}

```

Consider any code or blueprints I release on the forums to be licensed under MIT license and feel free to make use of them.

VaRest is located at (Just drop it in your Plugins, re-generate and build… I’ve confirmed it works on 5.4.4):

> **[GitHub - ufna/VaRest: REST API plugin for Unreal Engine 4 - we love...](https://github.com/ufna/VaRest)**
>
> REST API plugin for Unreal Engine 4 - we love restfull backend and JSON communications!
