# Viewer Group

<details>

<summary>Viewer Group Schema</summary>

* **id**: Unique id for every file
* **name**: name of the file
* **created\_at:** File creation timestamp

</details>

## Get All Viewer Group

<mark style="color:green;">`POST`</mark> `https://api.gmetri.com/sdk/viewer_group/getAll`

Get All viewer group of the organization

#### Headers

| Name                                            | Type   | Description       |
| ----------------------------------------------- | ------ | ----------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Token \<apiToken> |

#### Request Body

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| orgSlug<mark style="color:red;">\*</mark> | String |             |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "status": {
        "success": true
    },
    "data": {
        "orgViewerGroups": [
            {
                "id": 7,
                "name": "Group (1)",
                "created_at": "2022-09-05T08:06:56.375671"
            },
            {
                "id": 8,
                "name": "SAML",
                "created_at": "2022-09-08T10:30:47.483744"
            }
        ],
        "globalViewerGroups": [
            {
                "id": 1,
                "name": "Social",
                "created_at": "2022-09-05T06:37:22.024655"
            },
            {
                "id": 3,
                "name": "Public",
                "created_at": "2022-09-05T06:37:22.024655"
            },
            {
                "id": 4,
                "name": "SCORM",
                "created_at": "2022-09-05T06:37:22.428923"
            },
            {
                "id": 5,
                "name": "Public with History (beta)",
                "created_at": "2022-09-05T06:37:22.592825"
            },
            {
                "id": 2,
                "name": "Editor",
                "created_at": "2022-09-05T06:37:22.024655"
            },
            {
                "id": 6,
                "name": "Load From Another Experience",
                "created_at": "2022-09-05T06:37:24.890609"
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

## Get Viewer Group

<mark style="color:green;">`POST`</mark> `https://api.gmetri.com/sdk/viewer_group/get`

Get viewer group of the organization by viewer group id

#### Headers

| Name                                            | Type   | Description       |
| ----------------------------------------------- | ------ | ----------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Token \<apiToken> |

#### Request Body

| Name                                            | Type   | Description                           |
| ----------------------------------------------- | ------ | ------------------------------------- |
| orgSlug<mark style="color:red;">\*</mark>       | String |                                       |
| viewerGroupId<mark style="color:red;">\*</mark> | String | Unique identifier of the viewer group |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
    "status": {
        "success": true
    },
    "data": {
        "id": 3,
        "name": "Public",
        "created_at": "2022-09-05T06:37:22.024655"
    }
} 
```

{% endtab %}

{% tab title="200: OK No Viewer Group Found" %}

```javascript
{
    "status": {
        "success": false,
        "errorMessage": "No viewer group found"
    }
} 
```

{% endtab %}
{% endtabs %}


---

# 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.gmetri.com/metaverse/sdk/gmetri-sdk-apis/viewer-group.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.
