skip to Main Content

Performing Http calls

In this post we’re going to see how to use the http module that is built inside the engine to perform http calls to various APIs. We’re going to perform a basic http call without sending any data, however I have commented out the code that you can use in order to send simple data (eg strings) or even data in the form of a json file type.

Adding the required Dependencies

For this post I have created a project using the 4.20 version of the engine. Then, I added the Http module as a dependency in the public module names in my <MyProject>.build.cs file:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay", "HTTP" });

Performing the http request

The http module offers an straightforward way to both perform http calls as well as react to the answer of the server. Having said that, I have created two functions in my header file, one for performing a request and one function that fires when our request has been processed (meaning the server has responded):

Here’s the implementation of both functions:

For my testing, in the Url link I used my GitHub’s username (ie ). Here’s the response of the server when I performed my call:

(Click on image to enlarge in a new tab)

As you can see the response is really a json file. In case you would like to consume the retrieved data check out my tutorial on Json Parsing.

(The reason that my OnResponse event fired twice is because I performed two requests)

Avatar photo

This Post Has One Comment

  1. Hello, can you please explain me how do you do the call if there is security that requires a token, for example an oauth 2.0.

    Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back To Top