How to send a https request

i’m trying to send a https request to a website but it wouldn’t request at all.

here is my request action:

after checking on the example projects on networking, i come across this action that works

notice that in the example project, it used the action “send a request to the specified web page.” instead of “send an asynchronous request to the specified web page.”

i can’t seem to find the former action on my network actions and only the asynchronous request show up. i think it may have something to do with previous version of network action that may change the format of it.

i tried changing the example project into using the asynchronous request action which also cause it to fail sending the https request.

so where do i find this “send a request to the specified web page” action, or how do you send a https request properly using the “send an asynchronous request to the specified web page.”

I am sorry I won’t be able to help you, and the reason will be obvious when you read my question.
What is this function used for? I tried google, but nothing I read made sense. I’d love to know what this does in case it’s something I can use in the future.

It has been deprecated, and thereby hidden. It may be removed fully in a future version.

The only difference is that the asynchronous one is, well, asynchronous, which means it doesn’t execute right away. Rather, the request will be done in multiple steps between different frames of the game, and once it is done, set the variable’s value to the result.

This is because network request take very long, and a game cannot run smoothly (at 60 FPS) if the events take more than 16ms to execute. By splitting the work like this, the full request is not actually done at once, blocking the events from continuing to execute, but progressively keeping the game smooth even if the connection is slow or the data transfer is big.

That means though that you cannot use your variable in the actions after the request, since the results won’t be filled in it yet. You need to make a separate event that will check of the variables content has changed, and once it has, do something with that data.

1 Like

update: thx for the explanation on how the request action works @arthuro555, i modified my events so that it can work on asynchronous web requests and finally get it to work, i’m going to put the steps necessary here so that future readers won’t need to trouble themselves with the same problem i encountered again.

i created 2 variables for each response and error scene variables, so that i have 4 variables called
response, prev_response, error, prev_error.
prev variables are used to check if the response/error variables have changed and if they did then the request has been succesfully received and you can write actions following the requests.

here is my events for a basic web request to work



the URL you want to send a https request to.
ex. “

the data that you want to send to the https request if you used a POST request.
it can be a string, json or xml.
json ex. "{ \ "user \ ": \ "mario \ ", \ "score \ ": \ "42 \ “}”

notice the \ behind the " is necessary to be able to send the quotation mark as a string so that the resulting json sent would be {“user”: “mario”, “score”: “42”}.

request method for https request, it can be GET , POST, … depending on the api request method.
ex. “GET”

the data type of your request body content. if your data is a string then use “text/plain”, for json use “application/json”.
content type’s default parameter is “application/x-www-form-urlencoded”, so you might want to change it if you’re using a different data type.

HTML data ex. “text/HTML”