> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tangerine365.com/llms.txt.
> For full documentation content, see https://docs.tangerine365.com/llms-full.txt.

# Get User Statistics

POST https://localhost:8090//api/user/userStats
Content-Type: application/x-www-form-urlencoded

The `POST /api/user/userStats`endpoint is used to retrieve user statistics in the application courses based on the user'name.

### Request

- Method: POST
    
- Base URL: {{baseUrl}}
    
- Path: /api/user/userStats
    
- Headers:
    
    - Content-Type: application/x-www-form-urlencoded
        
- Body:
    
    - `idst` (text): User ID
        
    - `auth` (text): The authentication token
        

### Response

- `success` (boolean): Indicates the success of the request.
    
- `data` (object)
    
    - `general` (object):
        
        - `name`: user's username
            
        - `user_type`: Type of user
            
        - `member_since`: Date user was registered
            
    - `course_attendance:`
        
        - `subscribed`: number of courses user is subscribed to.
            
        - `in _progress`: number of courses currently in progress by user.
            
        - `completed`: number of completed courses
            
        - `total_courses`: total number of courses associated with the user
            
    - `competencies_attained:` number of competencies attained.
        
    - `certificates_attained:` number of certificates attained.
        
    - `last_login:` Last login date/time for the user

Reference: https://docs.tangerine365.com/tangerine-365-enterprise/get-user-statistics

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Tangerine365 Enterprise
  version: 1.0.0
paths:
  //api/user/userStats:
    post:
      operationId: get-user-statistics
      summary: Get User Statistics
      description: >-
        The `POST /api/user/userStats`endpoint is used to retrieve user
        statistics in the application courses based on the user'name.


        ### Request


        - Method: POST
            
        - Base URL: {{baseUrl}}
            
        - Path: /api/user/userStats
            
        - Headers:
            
            - Content-Type: application/x-www-form-urlencoded
                
        - Body:
            
            - `idst` (text): User ID
                
            - `auth` (text): The authentication token
                

        ### Response


        - `success` (boolean): Indicates the success of the request.
            
        - `data` (object)
            
            - `general` (object):
                
                - `name`: user's username
                    
                - `user_type`: Type of user
                    
                - `member_since`: Date user was registered
                    
            - `course_attendance:`
                
                - `subscribed`: number of courses user is subscribed to.
                    
                - `in _progress`: number of courses currently in progress by user.
                    
                - `completed`: number of completed courses
                    
                - `total_courses`: total number of courses associated with the user
                    
            - `competencies_attained:` number of competencies attained.
                
            - `certificates_attained:` number of certificates attained.
                
            - `last_login:` Last login date/time for the user
      tags:
        - ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Get User Statistics_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                auth:
                  type: string
                idst:
                  type: string
              required:
                - auth
                - idst
servers:
  - url: https://localhost:8090
components:
  schemas:
    ApiUserUserStatsPostResponsesContentApplicationJsonSchemaDataGeneral:
      type: object
      properties:
        name:
          type: string
        user_type:
          type: string
        member_since:
          type: string
      required:
        - name
        - user_type
        - member_since
      title: ApiUserUserStatsPostResponsesContentApplicationJsonSchemaDataGeneral
    ApiUserUserStatsPostResponsesContentApplicationJsonSchemaDataCourseAttendance:
      type: object
      properties:
        others:
          type: integer
        waiting:
          type: integer
        completed:
          type: integer
        suspended:
          type: integer
        subscribed:
          type: integer
        in-progress:
          type: integer
        not-started:
          type: integer
        overbooking:
          type: integer
        total_courses:
          type: integer
        subscription_to_confirm:
          type: integer
      required:
        - others
        - waiting
        - completed
        - suspended
        - subscribed
        - in-progress
        - not-started
        - overbooking
        - total_courses
        - subscription_to_confirm
      title: >-
        ApiUserUserStatsPostResponsesContentApplicationJsonSchemaDataCourseAttendance
    ApiUserUserStatsPostResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        general:
          $ref: >-
            #/components/schemas/ApiUserUserStatsPostResponsesContentApplicationJsonSchemaDataGeneral
        last_login:
          type: string
        course_attendance:
          $ref: >-
            #/components/schemas/ApiUserUserStatsPostResponsesContentApplicationJsonSchemaDataCourseAttendance
        certificates_attained:
          type: integer
        competencies_attained:
          type: integer
      required:
        - general
        - last_login
        - course_attendance
        - certificates_attained
        - competencies_attained
      title: ApiUserUserStatsPostResponsesContentApplicationJsonSchemaData
    Get User Statistics_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/ApiUserUserStatsPostResponsesContentApplicationJsonSchemaData
        success:
          type: boolean
      required:
        - data
        - success
      title: Get User Statistics_Response_200

```

## SDK Code Examples

```python Get User Statistics_example
import requests

url = "https://localhost:8090//api/user/userStats"

payload = ""
headers = {"Content-Type": "application/x-www-form-urlencoded"}

response = requests.post(url, data=payload, headers=headers)

print(response.json())
```

```javascript Get User Statistics_example
const url = 'https://localhost:8090//api/user/userStats';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: new URLSearchParams('')
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Get User Statistics_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://localhost:8090//api/user/userStats"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Content-Type", "application/x-www-form-urlencoded")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Get User Statistics_example
require 'uri'
require 'net/http'

url = URI("https://localhost:8090//api/user/userStats")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/x-www-form-urlencoded'

response = http.request(request)
puts response.read_body
```

```java Get User Statistics_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://localhost:8090//api/user/userStats")
  .header("Content-Type", "application/x-www-form-urlencoded")
  .asString();
```

```php Get User Statistics_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://localhost:8090//api/user/userStats', [
  'form_params' => null,
  'headers' => [
    'Content-Type' => 'application/x-www-form-urlencoded',
  ],
]);

echo $response->getBody();
```

```csharp Get User Statistics_example
using RestSharp;

var client = new RestClient("https://localhost:8090//api/user/userStats");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
IRestResponse response = client.Execute(request);
```

```swift Get User Statistics_example
import Foundation

let headers = ["Content-Type": "application/x-www-form-urlencoded"]

let request = NSMutableURLRequest(url: NSURL(string: "https://localhost:8090//api/user/userStats")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```