# User Data

## GetUserAllData

#### Purpose

Retrieves all user data based on the provided user ID.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetUserAllData  
```

#### Method

* `GET` or `POST`

#### Request Parameters (JSON body)

* `userID` (string): The unique identifier of the user.

#### Responses

* **200 OK**: Successful retrieval. Returns a `GetAllUserDataResult` object with user data.
* **400 Bad Request**: If there is an error in retrieving the data.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetUserAllData', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        userID: 'existing-user-id'    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "UserID": "existing-user-id",  
    "CustomUserData": {  
        "DataVersion": 1,  
        "Data": {}  
    },  
    ...  
}  
```

## GetUserInventory

#### Purpose

Retrieves the inventory of a user.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetUserInventory  
```

#### Method

* `GET` or `POST`

#### Request Parameters (JSON body)

* `userID` (string): The unique identifier of the user.

#### Responses

* **200 OK**: Successful retrieval. Returns a `GetUserInventoryResult` object with inventory data.
* **400 Bad Request**: If there is an error in retrieving the inventory.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetUserInventory', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        userID: 'existing-user-id'    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "Inventory": [  
        {  
            "ItemID": "item-1",  
            "Quantity": 5  
        },  
        ...  
    ]  
}  
```

## UpdateCustomUserData

#### Purpose

Updates custom user data with the provided key-value pair.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/UpdateCustomUserData  
```

#### Method

* `POST`

#### Request Parameters (JSON body)

* `key` (string): Key of the custom user data to update.
* `value` (string): New value for the custom user data.

#### Responses

* **200 OK**: Successful update. Returns a success message.
* **400 Bad Request**: If there is an error in the update request.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/UpdateCustomUserData', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        key: 'customKey',    
        value: 'customValue'    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "Message": "SUCCESS"  
}  
```

## DeleteTitlePlayerAccount

#### Purpose

Deletes the account of a player in a specific title.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/DeleteTitlePlayerAccount  
```

#### Method

* `POST`

#### Request Parameters (JSON body)

* `userID` (string): The unique identifier of the user.

#### Responses

* **200 OK**: Successful deletion. Returns a success message.
* **400 Bad Request**: If there is an error in the deletion request.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/DeleteTitlePlayerAccount', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        userID: 'existing-user-id'    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "Message": "SUCCESS"  
}  
```

## UpdateLeaderBoard

#### Purpose

Updates the leaderboard score for a user.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/UpdateLeaderBoard  
```

#### Method

* `POST`

#### Request Parameters (JSON body)

* `userID` (string): The unique identifier of the user.
* `amount` (int, optional): The amount to update the leaderboard score by. Default is 1.

#### Responses

* **200 OK**: Successful update. Returns a success message.
* **400 Bad Request**: If there is an error in the update request.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/UpdateLeaderBoard', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        userID: 'existing-user-id',    
        amount: 5    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "Message": "SUCCESS"  
}  
```

## GetCatalogItems

#### Purpose

Retrieves the catalog items for a specific catalog version.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetCatalogItems  
```

#### Method

* `GET` or `POST`

#### Request Parameters (JSON body)

* `catalogVersion` (string): The version of the catalog to retrieve items from.

#### Responses

* **200 OK**: Successful retrieval. Returns a list of catalog items.
* **400 Bad Request**: If there is an error in retrieving the catalog items.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetCatalogItems', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        catalogVersion: 'v1'    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "CatalogItems": [  
        {  
            "ItemID": "item-1",  
            "Name": "Sword",  
            "Price": 100  
        },  
        ...  
    ]  
}  
```

## GetLeaderboard

#### Purpose

Retrieves the leaderboard data for a specific leaderboard ID.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetLeaderboard  
```

#### Method

* `GET` or `POST`

#### Request Parameters (JSON body)

* `leaderboardID` (string): The ID of the leaderboard to retrieve data from.

#### Responses

* **200 OK**: Successful retrieval. Returns leaderboard data.
* **400 Bad Request**: If there is an error in retrieving the leaderboard data.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetLeaderboard', {    
    method: 'POST',    
    headers: {    
        'Content-Type': 'application/json'    
    },    
    body: JSON.stringify({    
        leaderboardID: 'leaderboard-1'    
    })    
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "Leaderboard": [  
        {  
            "UserID": "user-1",  
            "Score": 1500  
        },  
        ...  
    ]  
}  
```

## GetServerTime

#### Purpose

Retrieves the current server time.

#### URL

```plaintext
https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetServerTime  
```

#### Method

* `GET`

#### Responses

* **200 OK**: Successful retrieval. Returns the current server time.

#### Example Usage

**Request**:

```javascript
fetch('https://api.idosgames.com/api/[titleTemplateId]/[titleId]/Client/UserData/GetServerTime', {    
    method: 'GET',    
    headers: {    
        'Content-Type': 'application/json'    
    }  
})    
.then(response => response.json())    
.then(data => console.log(data))    
.catch(error => console.error('Error:', error));  
```

**Response**:

```json
{  
    "ServerTime": "2023-04-01T12:00:00Z"  
}  
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.idosgames.com/api/api-v1/user-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
