Understand API Responses
This guide helps you understand what a typical API response looks like from LootLocker in Unity. 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 also have a class for each response. The response class contains all the variables from any JSON response from all methods. You can see this when checking out the Sample App that comes with the SDK. You can also check the API responses for the 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
public class GetPersistentStorageResponse : LootLockerResponse
14
{
15
public bool success { get; set; }
16
public Payload[] payload { get; set; }
17
}
18
public class Payload
19
{
20
public string key { get; set; }
21
public string value { get; set; }
22
}
Copied!
From the example above you can get the data from the JSON without worrying about deserializing yourself.
Last modified 6mo ago