Key usage ideas
To make a request you should make few steps:
- Create new request, set the Verb and Content Type [required]
- Bind events that will be called when request will be finished (OnComplete, OnFail)
- Set request parameters
- Process the request [required]
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.
You can get the response data in two forms:
- As a FString using the ResponseContent public variable
- 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:
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)
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.
I've prepared basic usage examples to show how to use the plugin.
Simple GET Request
Parse User Login
Parse Analytics Custom Event