Understand API Responses
This guide helps you understand what a typical API response looks like from LootLocker in Unreal. You can learn more about all API calls in the Reference documentation linked below.

Standard Response

Every response inherits from the LootLockerResponse.
1
public class LootLockerResponse
2
{
3
public bool hasError;
4
public int statusCode;
5
public string text;
6
public bool status;
7
public string message;
8
public string Error;
9
public string EventId;
10
}
Copied!
In any response from the callback of LootLocker methods, you get the structure shown above. You can get the raw response text and deserialize it into any JSON structure

Example Response

This example response is for the GetPersistentStorageResponse API call
We have a class for each response. The response class contains all the variables from the JSON response of the API request. You can see this when checking out the examples that come with the SDK and comparing them with the API JSON response expected.
1
// Example json
2
{
3
"success": true,
4
"payload": [
5
{
6
"key": "user.answer",
7
"value": "42"
8
}
9
]
10
}
11
12
//Response Class
13
14
USTRUCT(BlueprintType)
15
struct FPersistentStorageItem {
16
GENERATED_BODY()
17
UPROPERTY(BlueprintReadWrite, EditAnywhere)
18
FString key;
19
UPROPERTY(BlueprintReadWrite, EditAnywhere)
20
FString value;
21
UPROPERTY(BlueprintReadWrite, EditAnywhere)
22
bool is_public;
23
UPROPERTY(BlueprintReadWrite, EditAnywhere)
24
int order;
25
};
26
27
USTRUCT(BlueprintType)
28
struct FPersistentStorageItemsResponse : public FLootLockerResponse
29
{
30
GENERATED_BODY()
31
UPROPERTY(BlueprintReadWrite, EditAnywhere)
32
TArray<FPersistentStorageItem> items;
33
public:
34
FPersistentStorageItemsResponse()
35
{}
36
};
Copied!
Last modified 6mo ago