Skip to content

Plugin Usage

Vladimir Alyamkin edited this page Jun 29, 2014 · 4 revisions

Key usage ideas

To make a request you should make few steps:

  1. Create new request, set the Verb and Content Type [required]
  2. Bind events that will be called when request will be finished (OnComplete, OnFail)
  3. Set request parameters
  4. Process the request [required]

Request parameters

Request parameters are set using RequestJsonObj object that can be accessed with GetRequestObject() function.

If you're using application/x-www-form-urlencoded content type, parameters will be serialized in percent-encoded url form, f.e.: mykey1=myval1&mykey2=mayval2&mykey3=.. , so avoid using any nested Json structs with this content type.

In case of application/json type json struct will be uses as is to be Json parameter.

Any other content types currently are not supported.

Response data

You can get the response data in two forms:

  1. As a FString using the ResponseContent public variable
  2. As a Json object using the GetResponseObject() function. Of course, the server should provide valid Json responce in this case, so you can check bIsValidJsonResponse public variable to be sure that responce was successfully decoded.

JsonValue wrapper and arrays

VaRestJsonValue class is the fully functional wrapper around FJsonValue struct and provides set of functions to operate json values despite their real nature.

That's the way how you can construct (and read) non-uniform arrays:

Array Example

If you're using uniform arrays or simple Json struct, it can be easier to use function that created to operate strict data types: FString, float, etc. (see examples below)

Parse Usage

Plugin contains the helper class to make communications with Parse servers easier to use. If you want to enable this feature, you should use the UVaRestParseManager class as Request object and process the request with special ProcessParseURL() function instead of default ones.

Also, don't miss to auth the Parse! To make it work, you need to provide Parse Api Key and App Id to the plugin. Just make it once on game startup and then auth data will be included in all your Parse requests.

Parse Auth Example

Usage Examples

I've prepared basic usage examples to show how to use the plugin.

Simple GET Request

Parse User Login

Parse Analytics Custom Event

You can’t perform that action at this time.