[Plugin] Http/s REST, blueprintable JSON query and Parse API manager [VaRest]

Unhook the RequestCompleteCopy (red line) and see how it’s run. It’s just a “custom event” but by default it’s set not to replicate. For online use it should replicate and be run from/by the server not the user.

EDIT:
Does it work with 4.7.3? And do I still need to start a code template or does it work with Blueprint only projects as well?

I have the same problem regarding this situation.

I have something like that, as you…

{“FirstName”:“Awesome”,“LastName”:“Plugin”,“HighScore”:“642”},
{“FirstName”:“Facing”,“LastName”:“Worlds”,“HighScore”:“377”},
{“FirstName”:“YouBe”,“LastName”:“Dead”,“HighScore”:“321”}]

but I can’t read the content of this array.

Any workaround??

Thanks.

Is it possible to send a request with body content with this plugin? I need to send a post request to get an access token.

**@
**
make sure your json looks like this


{  
   "data":  
      {  
         "FirstName":"Awesome",
         "LastName":"Plugin",
         "HighScore":"642"
      },
      {  
         "FirstName":"Facing",
         "LastName":"Worlds",
         "HighScore":"377"
      },
      {  
         "FirstName":"YouBe",
         "LastName":"Dead",
         "HighScore":"321"
      }
   ]
}


this can be parsed with “Get Object Array Field” using data as the Field Name

@ Thumper

yes this should be possible. To set post date you can:

“Construct Json Request” (verb=POST) -> Get Request Object -> Set String Field

So apparently a .net web api cant accept JSON to get an access token :frowning:

So is there a way to post a request with body content in x-www-form-urlencode format?

I had to mod the plugin a little to send a request with a body. The function in the ihttp interface is called SetContentAsString

Hello, I would first like to thank you for making this plugin. It works great! My only concern is I am trying to connect my game launcher to the same php script I am using to get the login info. Does the json look something like this?
{
“password”: “www”,
“username”: “qqq”
}

or does it have to include “data”: like @ has it?

Link to the Image - json-array.jpg&d=1433250938

Record stored in CouchDB’s database. This is where the _id and _rev come from.
{
“_id”: “69b3d20dc682993f4ba9f349bb001582”,
“_rev”: “1-e33cc1b08ab503c6200abea3ae49c7d3”,
“array”:
{
“object0”: “value1”
},
{
“object1”: “value2”
},
{
“object2”: “value3”
},
{
“object3”: “value4”
}
]
}

I really appreciate your plugin. My small contribution is an example of how to do this with arrays. I saw a couple people asked. I tried a few different methods which didn’t work. Cheers! (Integrated with CouchDB)

There were a few moments where I had to mess with the nodes for a while to figure out how the plugin works. You should be able to answer most questions by messing with the plugin for a few hours.

Sorry to bother you ufna. Thanks for the awesome plugin!

I’m making multiple requests in succession. It seems like the requests need to be spaced 1 seconds apart for them to work. (Trying even .5 seconds fails)

I tired putting the variables into an array like pictured below.

Also, I made sure it wasn’t a problem with my server (Using CouchDB) by writing a quick script to make 10 requests instantly. The server responded to all of the requests.

Any ideas? I’m not able to put custom events for onrequestcomplete / fail inside a function. I have a feeling it would work that way. Anyone have ideas on a solution for this? I’ve tried a lot of different things for around 6 hrs.


Request Test SH
json-sh.JPG
SH Results
json_test.JPG
UE4 output on 5 consecutive requests
json-ue4-response-5players.JPG
UE4 output on 10 consecutive requests
json-10request.JPG
UE4 output on 10 requests with 1 second delay
json-10request-1seconddelay.JPG

Got any ideas on a method without having to space the requests or a BP method of handing off requests to separate request branches if they appear in quick succession? That’s the solution I might end up using.

I don’t know if what I said made my sense. My apologies.

I ended up using a method like this…

Created a struct to hold all the JSON info. Made an event which saves each request as a struct in an array.

Then I have a delayed “for each” in array (manually, not the utility node) which fires the json plugin stuff. At the end, before Bind Event to OnGetResults the Struct entry is removed.

This keeps multiple requests “spaced” with a time delay. Sometimes it still fails to send the data. I’m going to have to use other methods for error correction.

Data -> To Struct -> Struct to Array -> Custom Delayed For Each Loop on Event BeginPlay -> JSON Request Using Struct Data -> Removes Struct From Array -> On For Each Completed Restart Loop

This creates basically throttles the plugin to 1 JSON request per second which usually returns data as it should.

I wonder why the plugin returns nothing on requests in quick succession? Both VaRest and JSONQuerry do this. I used a script to make sure it wasn’t a problem with my server. I’m posting this as food for thought. Thanks for the awesome plugin! :slight_smile:

What I did for multiple calls was have all the requests bind to the same OnComplete OnFail binds. I use an enum to tell which call was just made. I then Switch on the enum and send the handlers to a different class. Here are my BPs.

Here is an example call. I edited the Plugin a little to work with Play Fab. All my obect creation is behind the scenes to make blueprints readable. It is still the same process though. This is a request.

42c3d6dba7ef5c96bfe204b195222c9492eb18b2.jpeg

The next image is on the event graph of the same object. I use an enum to decide where the response should be sent.

575a4ed895897a3eb3eb86a8c6e4ab9533e3245a.jpeg

I am actually in the progress of adding the entire PlayFab API into a modified VaRest plugin. It simplifies the process alot.

  • Josh

I can’t seem to get this plugin working. Whenever I drop the plugin into my plugins directory and then enable the plugin, UE4 tells me I need to recompile when I open the project. When the recompile fails, UE4 says I need to rebuild it manually. How do I do that?

Got the same problem. Please help :stuck_out_tongue:

Did you grab the release or the master version. I believe one has binaries that you add to your unreal install directory the other you build from source. Are you using a source built game or one that is just using blueprints?

If your using blueprints only grab the release version of the plugin and follow the instructions on the wiki page for his plugin. If you are building from source then once you drop the plugin in the plugins folder right click on your uproject file and regenerate visual studio files. Open up the visual studio solution and rebuild your game and the plugin will be rebuilt also.

-Josh

Heya,

Thanks for this awesome plugin!

I’ve just sent a pull request for a small change to add Request itself as a parameter of Complete/Failed events Added parameter to callbacks with payload of request by xulture · Pull Request #31 · ufna/VaRest · GitHub

This should make it easier to reference which requests have completed, in cases when multiple concurrent requests may be processing.

Cheers,

Thanks for the idea Lyons! I will try that. My solution seems a bit complicated. Also, xulture, thanks for those changes!

Also, I had to switch to the current development branch for the plugin to work with UE 4.8 in case anyone else is wondering. It would crash otherwise when running more than one player instance within the editor.

I tried to follow the Parse Login tutorial, but there is no url to parse to? I dont get it :frowning: Anyone who can help? I think I have got the plugin working. When trying to do a get request it prints the content of the file on the server in the log but returns no response string to the game.
im trying to do a simple login screen.

I’ve released all new changes as 1.1-rc8 release: Release VaRest 1.1-rc8 · ufna/VaRest · GitHub

Big thanks to all guys who contributed to VaRest! :slight_smile:

Here’s how you can use a “where query” for Parse for those of you wondering, because I certainly was.
If you look at Parse documentation for this everything seems to work as explained there.
This method works for me and I haven’t found any issues yet.

  • Set up a Parse Request Object with the “GET” verb and X Www Form Urlencoded" like you would normally.
  • “Parse Class” is whichever class you want to submit a query for. You can use the “Construct where query” method if you want, but I find this quicker.

NOTE: I had to use the PercentEncode function in order for this to work my iOS device.