DRTY_KIWI 5 Posted June 3, 2022 Anyone managed to call the "RestAPI" class GET/POST methods successfully? I've been messing around trying to get a hello world type example working, but everytime I call the GET method the workbench crashes. If someone has managed to get this working I'd love to see an example. Maybe I'm just missing the obvious, so I'll include my test code below. class PY_TestGameModeClass: SCR_BaseGameModeClass { }; class PY_RestCallback : RestCallback { override void OnSuccess( string data, int dataSize ) { Print(data); // JsonApiStruct json = new JsonApiStruct; // json.ExpandFromRAW(data); SCR_HintManagerComponent.GetInstance().ShowCustomHint(data, "Cat Factz!", 20.0); }; override void OnError( int errorCode ) { Print(" !!! OnError() "); }; }; class PY_TestGameMode: SCR_BaseGameMode { override protected void EOnInit(IEntity owner) { super.EOnInit(owner); if(!System.IsConsoleApp()) //No GUI, so no events for it { Event_OnControllableSpawned.Insert(OnPlayerSpawnedClient); } } static PY_TestGameMode GetInstance() { return PY_TestGameMode.Cast(GetGame().GetGameMode()); } void OnPlayerSpawnedClient(IEntity entity) { GetGame().GetCallqueue().CallLater(ShowCatFact, 5000); } void ShowCatFact() { PY_RestCallback cbx1 = new PY_RestCallback; RestContext ctx = GetGame().GetRestApi().GetContext("https://catfact.ninja/"); ctx.GET(cbx1,"fact"); } } Share this post Link to post Share on other sites
DRTY_KIWI 5 Posted June 4, 2022 Nevermind, I've done some more research and this seems to be a confirmed bug.https://feedback.bistudio.com/T164859 Hopefully this gets fixed in an upcoming patch. 1 Share this post Link to post Share on other sites
DRTY_KIWI 5 Posted June 9, 2022 For anyone that ends up finding this thread, this issue seems to have been fixed in the latest patch (7th June). The code I was testing is now returning as expected, without crashing the Enfusion workbench. 3 Share this post Link to post Share on other sites