Users Groups

Introduction

Using the Users Groups object, you can get information about available groups in your project. You can use this information to change user group or target some data inside your game.

The Users Groups object is closed and requires the provision of application keys.

Available methods

Below you can see the available API methods for working with the User Groups object.

Method Usage
users.get_group_list Returns all groups list for current project.
users.get_group_data Returns information about group.
users.set_group Set group for user by group ID.

Users.Get_Group_List

Use this method to get all groups list of your project. You can add more groups in the Ocugine Dashboard. By default you have one invisible for Dashboard, but available for API group - default.

Method Usage

To get all groups list, you need to send a POST request to the following URL:

https://cp.ocugine.pro/api/users/get_group_list/

Accepted Parameters:

Param Type Usage
app_id double Ocugine Project ID
app_key string Ocugine Project Client Key

After which the server will give the following information:

{
  "complete": true,
  "message": null,
  "data": {
    "list": [
      {
        "uid": -1,
        "project_id": 1,
        "group_name": "Default Group",
        "group_desc": "Default Ocugine Users Group"
      },
      {
        "uid": "1",
        "project_id": "1",
        "group_name": "VIP",
        "group_desc": "VIP-users of the game"
      }
    ]
  }
}

Where:

Param Type Usage
complete bool The status of the operation. If false, the locale could not be obtained.
message string / null Error message. If complete = true, returns null
data object with list array Array of groups based on short group_data object

Short Group Data Object

The following describes the group object returned by the server.

Param Type Usage
uid bool Internal group ID
group_name string Group Name
group_desc string Group Description
project_id double Ocugine Project ID for requested groups list

Users.Get_Group_Data

Use this method to get full information about requested user group. You can use this information inside your application logic.

Method Usage

To get information about group, you need to send a POST request to the following URL:

https://cp.ocugine.pro/api/users/get_group_data/

Accepted Parameters:

Param Type Usage
app_id double Ocugine Project ID
app_key string Ocugine Project Client Key
group_id double Internal Group ID

After which the server will give the following information:

{
  "complete": true,
  "message": null,
  "data": {
    "uid": "1",
    "project_id": "1",
    "group_name": "VIP",
    "group_desc": "VIP-users of the game",
    "time": "0",
    "conditions": [],
    "can_select": false,
    "auto_detect": false
  }
}

Where:

Param Type Usage
complete bool The status of the operation. If false, the locale could not be obtained.
message string / null Error message. If complete = true, returns null
data object Group data object
Group Data: Param Type Usage
uid double Internal Group ID
project_id double Ocugine Project ID
group_name string Group Name
group_desc string Group Description
time double Last update time for this group
conditions array Conditions object or [] if not has a conditions
can_select bool User can select this group or not
auto_detect bool Auto-detect group conditions

Users.Set_Group

Use this method to set group for user.

Method Usage

To set group for user, you need to send a POST request to the following URL:

https://cp.ocugine.pro/api/users/set_group/
Accepted Parameters: Param Type Usage
app_id double Ocugine Project ID
app_key string Ocugine Project Client Key
group_id double Internal Group ID
profile_uid double Profile UID

After which the server will give the following information:

{
  "complete": true,
  "message": null,
}

Where:

Param Type Usage
complete bool The status of the operation. If false, the locale could not be obtained.
message string / null Error message. If complete = true, returns null