How to convert texture 2D to Material?

You can do a do a direct http request in unreal with HttpModule using FHttpModule

void AHttpActor::MyHttpCall(FString url, EHTTPMethod verb)
{
	FString action = UEnum::GetValueAsString<EHTTPMethod>(verb);
	//FString action = "Get";
	TSharedRef<IHttpRequest, ESPMode::ThreadSafe> Request = Http->CreateRequest();
	Request->OnProcessRequestComplete().BindUObject(this, &AHttpActor::OnResponseReceived);	
	Request->SetURL(url);
	Request->SetVerb(action);
	Request->SetHeader(TEXT("User-Agent"), "X-UnrealEngine-Agent");
	Request->SetHeader("Content-Type", TEXT("application/json"));
	Request->ProcessRequest();
}

void AHttpActor::OnResponseReceived(FHttpRequestPtr Request, FHttpResponsePtr Response, bool bWasSuccessful)
{
	//Create a pointer to hold the json serialized data
	TSharedPtr<FJsonObject> JsonObject;

	//Create a reader pointer to read the json data
	TSharedRef<TJsonReader<>> Reader = TJsonReaderFactory<>::Create(Response->GetContentAsString());

	//Deserialize the json data given Reader and the actual object to deserialize
	if (FJsonSerializer::Deserialize(Reader, JsonObject))
	{
          FString url = Request.Get()->GetURL();
	
        // process data here decode base 64 etc 
         FString c  = "NeededKey";			
	TSharedPtr<FJsonValue> foundValue  = JsonObject->TryGetField(c);

	}
}

The final processing depends on what is returned by the rest API

1 Like