How to POST using VaRest

Hi, I’m using this plugin, [Plugin] Http/s REST, blueprintable JSON and Parse REST API manager at once (VaRest) - C++ - Epic Developer Community Forums and this guide for it https://.com/ufna/VaRest/wiki/Plugin-Usage to try and use GET and POST requests but I’m having a bit of trouble getting it to accomplish anything. This is what I have so far.

I don’t have much experience with Rest so the solution might be much easier than I thought. This is the site I’m trying to POST to http://www.posttestserver.com/ but the only thing I’ve seem to have got working is opening a webpage with a URL. It’s going through the code, I think it’s just missing something crucial that tells it to post. Any help would be much appreciated.

Based on your screenshot, there are two things missing (one of which is kind of important).

The important part is: do the “Get Request Object” on your “VA JSONRequest” and use that for your “Set Field”.

Other than that, I greatly suggest you Bind “OnRequestComplete” and “OnRequestFail” from the same “VA JSONRequest”, otherwise it’s going to be a bit tricky to figure out what went wrong (or right ;)) Use the “Get Response Object” from the “VA JSONRequest” in order to see what the server is returning to you.

Hope this helps get you on your way.

I’ve included the Get Request Object now but nothing seems to have changed as far as I can see. I also tried (even before asking this question) to use OnRequestFail and Complete but for some reason when I click on them after right clicking they just don’t appear on the graph for some reason.

Also, do I need a VaRestJson Object at all? Is a Request all I need?

Binding doesn’t seem to be an option for me at all. I’m trying to do a get method now identical to the way it’s done in the link I provided above but where they have BindEvent to OnRequestCopmlete I get nothing. OnRequestComplete exists but like I said, clicking on it does nothing.

Request becomes the object.

Here’s a very short and quick example I’ve set up to demonstrate how I’ve been using VA Rest.

The Blueprint:

My Test URL is a simple PHP script I’ve created to deal with the VARequest that is being sent out to my test server. The script itself only goes through the response and spits back the parameter I gave it as a response.

27210-varestphp.png

When I ran the project, I got the expected “Request completed: Hello_VA_Rest”

I’m still getting the problem with the On Request Complete or Fail simply not working for me. It just doesn’t appear on the graph. I made a video of it.

Oh, I see now where your problem lies :slight_smile:

Bringing up the context sensitive menu by right clicking on a blue print will only give you the proper context for the blueprint itself, so all the methods available to it.

What you want is the context menu for the Object itself, in this case VA Rest Request. You need to get the variable (drag it from the hierarchy, to the blueprint and choose get) and then, use it to get its own “On Request Complete” (click and hold on the link for the variable and release on the blueprint, it will pop up a context menu with everything related to VARest, including the events).

This is just basic blueprint communication though, if you’re not familiar with it, I greatly suggest going over: Blueprint Communication Usage

I hope this helped you out :slight_smile:

Yes. I’ve managed to put it on now thanks. The reason I had Context Sensitive off in the first place is because nothing would show up when it was on and I was normally right clicking. But I have the on success/fail now so hopefully it works. Still weird that just right clicking to get it fails to do anything. I suppose that’s because it’s not being attached to anything when it’s created.

Yeah I think it’s done. I’m still having some issues, the get is working but the post isn’t quite yet. Though I think that’s because of the URLs but I’ll figure them out on my own. I should be using an online database anyway. They were just tests.

If this issue is done, can you mark it as resolved? :slight_smile:

Great! This is exactly what I was searching for…Thanks!

Hi, I am looking everywhere and can’t find an information of how to break up received Json from a website, and put it into variables inside unreal. I am just receiving the whole Json structure and I am able to print it as a whole, but I want to save parts of it in variables. could anyone help?

Thank you!

In order to get my post request to work, I had to Set Request Object from my JSON Data Object after I finished setting all the fields for the data. Before I did this, it was just sending null values!

Trandana - Yes This resolved the issue at my end. It was sending null values. Setting the JsonRequestObj before the processURL does the job. Thank you!