> 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 Recently Viewed Courses

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

The `POST /api/user/recentlyViewed`endpoint is used to retrieve recently viewed courses by a user based on the user ID.

### Request

- Method: POST
    
- Base URL: {{baseUrl}}
    
- Path: /api/user/recentlyViewed
    
- Headers:
    
    - Content-Type: application/x-www-form-urlencoded
        
- Body:
    
    - `idst` (text): The user ID for which details are to be retrieved.
        
    - `auth` (text): The authentication token
        

### Response

- The response will be in JSON format with the following structure:
    
    - `success` (boolean): Indicates the success of the request.
        
    - `courses` (array): An array object representing courses, each having these propertiies:
        
        - `idCourse` (string): course ID
            
        - `course_type` (string): type of the course
            
        - `idCategory` (string): category ID
            
        - `code` (string): course code
            
        - `name` (string): course name
            
        - `description` (string): course description
            
        - `box_description` (string): description of the course box
            
        - `difficult` (string): difficulty level of the course
            
        - `status` (string): course status
            
        - `level_show_user` (string): user level visibility
            
        - `course_edition` (string): edition of the course
            
        - `sub_start_date` (string): subscription start date
            
        - `sub_end_date` (string): subscription end date
            
        - `max_num_subscribe` (string): maximum number of subscribers
            
        - `create_date` (string): creation date of the course
            
        - `direct_play` (string): direct play option
            
        - `img_othermaterial` (string): image of other materials
            
        - `course_demo` (string): course demo file
            
        - `use_logo_in_courselist` (string): use logo in course list
            
        - `img_course` (string): course image
            
        - `lang_code` (string): language code
            
        - `course_vote` (string): course voting score
            
        - `hour_end` (string): end hour of the course
            
        - `hour_begin` (string): begin hour of the course
            
        - `date_begin` (string): start date of the course
            
        - `date_end` (string): end date of the course
            
        - `valid_time` (string): validity time of the course
            
        - `show_result` (string): show result option
            
        - `userStatusOp` (string): user status operation
            
        - `auto_unsubscribe` (string): auto unsubscribe option
            
        - `unsubscribe_date_limit` (string): unsubscribe date limit
            
        - `user_status` (string): user status
            
        - `level` (string): user level
            
        - `date_inscr` (string): date of enrollment
            
        - `date_first_access` (string): first access date
            
        - `date_complete` (string): course completion date
            
        - `waiting` (boolean): waiting status
            
        - `date_unsubscribe_date_limit` (string): date of unsubscribe limit
            
        - `show_progress` (boolean): show progress option
            
        - `enrolled` (number): number of enrolled users
            
        - `numof_waiting` (string): number of waiting users
            
        - `first_lo_type` (boolean): first learning object type
            
        - `nameCategory` (string): category name
            
        - `escaped_name` (string): escaped course name
            
        - `level_icon` (string): icon representing the level
            
        - `level_text` (string): text representing the level
            
        - `is_enrolled` (boolean): enrollment status
            
        - `canEnter` (boolean): can enter course status
            
        - `editions` (boolean): course editions availability
            
        - `course_full` (boolean): course full status
            
        - `in_cart` (boolean): in cart status
            
        - `userCanUnsubscribe` (boolean): user can unsubscribe option
            
        - `show_options` (boolean): show options status
            
        - `courseBoxEnabled` (boolean): course box enabled status
            
        - `stats` (object)
            
            - `total` (number): total number of students
                
            - `total_complete` (string): total number of completed courses
                
            - `total_failed` (string): total number of failed courses
                
            - `perc_completed` (number): percentage of courses completed
                
            - `perc_failed` (number): percentage of courses failed

Reference: https://docs.tangerine365.com/tangerine-365-enterprise/get-recently-viewed-courses

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Tangerine365 Enterprise
  version: 1.0.0
paths:
  //api/user/recentlyViewed:
    post:
      operationId: get-recently-viewed-courses
      summary: Get Recently Viewed Courses
      description: >-
        The `POST /api/user/recentlyViewed`endpoint is used to retrieve recently
        viewed courses by a user based on the user ID.


        ### Request


        - Method: POST
            
        - Base URL: {{baseUrl}}
            
        - Path: /api/user/recentlyViewed
            
        - Headers:
            
            - Content-Type: application/x-www-form-urlencoded
                
        - Body:
            
            - `idst` (text): The user ID for which details are to be retrieved.
                
            - `auth` (text): The authentication token
                

        ### Response


        - The response will be in JSON format with the following structure:
            
            - `success` (boolean): Indicates the success of the request.
                
            - `courses` (array): An array object representing courses, each having these propertiies:
                
                - `idCourse` (string): course ID
                    
                - `course_type` (string): type of the course
                    
                - `idCategory` (string): category ID
                    
                - `code` (string): course code
                    
                - `name` (string): course name
                    
                - `description` (string): course description
                    
                - `box_description` (string): description of the course box
                    
                - `difficult` (string): difficulty level of the course
                    
                - `status` (string): course status
                    
                - `level_show_user` (string): user level visibility
                    
                - `course_edition` (string): edition of the course
                    
                - `sub_start_date` (string): subscription start date
                    
                - `sub_end_date` (string): subscription end date
                    
                - `max_num_subscribe` (string): maximum number of subscribers
                    
                - `create_date` (string): creation date of the course
                    
                - `direct_play` (string): direct play option
                    
                - `img_othermaterial` (string): image of other materials
                    
                - `course_demo` (string): course demo file
                    
                - `use_logo_in_courselist` (string): use logo in course list
                    
                - `img_course` (string): course image
                    
                - `lang_code` (string): language code
                    
                - `course_vote` (string): course voting score
                    
                - `hour_end` (string): end hour of the course
                    
                - `hour_begin` (string): begin hour of the course
                    
                - `date_begin` (string): start date of the course
                    
                - `date_end` (string): end date of the course
                    
                - `valid_time` (string): validity time of the course
                    
                - `show_result` (string): show result option
                    
                - `userStatusOp` (string): user status operation
                    
                - `auto_unsubscribe` (string): auto unsubscribe option
                    
                - `unsubscribe_date_limit` (string): unsubscribe date limit
                    
                - `user_status` (string): user status
                    
                - `level` (string): user level
                    
                - `date_inscr` (string): date of enrollment
                    
                - `date_first_access` (string): first access date
                    
                - `date_complete` (string): course completion date
                    
                - `waiting` (boolean): waiting status
                    
                - `date_unsubscribe_date_limit` (string): date of unsubscribe limit
                    
                - `show_progress` (boolean): show progress option
                    
                - `enrolled` (number): number of enrolled users
                    
                - `numof_waiting` (string): number of waiting users
                    
                - `first_lo_type` (boolean): first learning object type
                    
                - `nameCategory` (string): category name
                    
                - `escaped_name` (string): escaped course name
                    
                - `level_icon` (string): icon representing the level
                    
                - `level_text` (string): text representing the level
                    
                - `is_enrolled` (boolean): enrollment status
                    
                - `canEnter` (boolean): can enter course status
                    
                - `editions` (boolean): course editions availability
                    
                - `course_full` (boolean): course full status
                    
                - `in_cart` (boolean): in cart status
                    
                - `userCanUnsubscribe` (boolean): user can unsubscribe option
                    
                - `show_options` (boolean): show options status
                    
                - `courseBoxEnabled` (boolean): course box enabled status
                    
                - `stats` (object)
                    
                    - `total` (number): total number of students
                        
                    - `total_complete` (string): total number of completed courses
                        
                    - `total_failed` (string): total number of failed courses
                        
                    - `perc_completed` (number): percentage of courses completed
                        
                    - `perc_failed` (number): percentage of courses failed
      tags:
        - ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Get Recently Viewed Courses_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:
    ApiUserRecentlyViewedPostResponsesContentApplicationJsonSchemaCoursesItemsStats:
      type: object
      properties:
        total:
          type: integer
        perc_failed:
          type: integer
        total_failed:
          type: string
        perc_completed:
          type: integer
        total_complete:
          type: string
      required:
        - total
        - perc_failed
        - total_failed
        - perc_completed
        - total_complete
      title: >-
        ApiUserRecentlyViewedPostResponsesContentApplicationJsonSchemaCoursesItemsStats
    ApiUserRecentlyViewedPostResponsesContentApplicationJsonSchemaCoursesItems:
      type: object
      properties:
        rel:
          type: string
        code:
          type: string
        name:
          type: string
        level:
          type: string
        stats:
          $ref: >-
            #/components/schemas/ApiUserRecentlyViewedPostResponsesContentApplicationJsonSchemaCoursesItemsStats
        status:
          type: string
        in_cart:
          type: boolean
        waiting:
          type: boolean
        canEnter:
          type: boolean
        date_end:
          description: Any type
        editions:
          type: boolean
        enrolled:
          type: integer
        hour_end:
          type: string
        idCourse:
          type: string
        difficult:
          type: string
        lang_code:
          type: string
        date_begin:
          description: Any type
        date_inscr:
          type: string
        hour_begin:
          type: string
        idCategory:
          type: string
        img_course:
          type: string
          format: uri
        level_icon:
          type: string
        level_text:
          type: string
        show_rules:
          type: string
        valid_time:
          type: string
        course_demo:
          type: string
        course_full:
          type: boolean
        course_type:
          type: string
        course_vote:
          description: Any type
        create_date:
          type: string
        description:
          type: string
        direct_play:
          type: string
        is_enrolled:
          type: boolean
        show_result:
          type: string
        useLightBox:
          type: boolean
        user_status:
          type: string
        escaped_name:
          type: string
        nameCategory:
          type: string
        show_options:
          type: boolean
        sub_end_date:
          description: Any type
        userStatusOp:
          type: string
        date_complete:
          description: Any type
        first_lo_type:
          type: boolean
        numof_waiting:
          type: string
        show_progress:
          type: boolean
        course_edition:
          type: string
        sub_start_date:
          description: Any type
        box_description:
          type: string
        level_show_user:
          type: string
        auto_unsubscribe:
          type: string
        courseBoxEnabled:
          type: boolean
        date_first_access:
          type: string
        img_othermaterial:
          type: string
        max_num_subscribe:
          type: string
        userCanUnsubscribe:
          type: boolean
        unsubscribe_date_limit:
          description: Any type
        use_logo_in_courselist:
          type: string
        date_unsubscribe_date_limit:
          description: Any type
      required:
        - rel
        - code
        - name
        - level
        - stats
        - status
        - in_cart
        - waiting
        - canEnter
        - editions
        - enrolled
        - hour_end
        - idCourse
        - difficult
        - lang_code
        - date_inscr
        - hour_begin
        - idCategory
        - img_course
        - level_icon
        - level_text
        - show_rules
        - valid_time
        - course_demo
        - course_full
        - course_type
        - create_date
        - description
        - direct_play
        - is_enrolled
        - show_result
        - useLightBox
        - user_status
        - escaped_name
        - nameCategory
        - show_options
        - userStatusOp
        - first_lo_type
        - numof_waiting
        - show_progress
        - course_edition
        - box_description
        - level_show_user
        - auto_unsubscribe
        - courseBoxEnabled
        - date_first_access
        - img_othermaterial
        - max_num_subscribe
        - userCanUnsubscribe
        - use_logo_in_courselist
      title: >-
        ApiUserRecentlyViewedPostResponsesContentApplicationJsonSchemaCoursesItems
    Get Recently Viewed Courses_Response_200:
      type: object
      properties:
        courses:
          type: array
          items:
            $ref: >-
              #/components/schemas/ApiUserRecentlyViewedPostResponsesContentApplicationJsonSchemaCoursesItems
        success:
          type: boolean
      required:
        - courses
        - success
      title: Get Recently Viewed Courses_Response_200

```

## SDK Code Examples

```python Get Recently Viewed Courses_example
import requests

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

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

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

print(response.json())
```

```javascript Get Recently Viewed Courses_example
const url = 'https://localhost:8090//api/user/recentlyViewed';
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 Recently Viewed Courses_example
package main

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

func main() {

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

	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 Recently Viewed Courses_example
require 'uri'
require 'net/http'

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

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 Recently Viewed Courses_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Get Recently Viewed Courses_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Get Recently Viewed Courses_example
using RestSharp;

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

```swift Get Recently Viewed Courses_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://localhost:8090//api/user/recentlyViewed")! 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()
```