> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidoc.dreamclass.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidoc.dreamclass.io/_mcp/server.

# EnrollClassCourse

POST https://dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses
Content-Type: application/json

Enroll a student in classe courses.

The studentPeriodId parameter is the id as returned by GetPeriodStudents call.

The classesCourse values are the ids as returned by GetPeriodClassCourses call.

Reference: https://apidoc.dreamclass.io/dream-class-api/students/enroll-class-course

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses:
    post:
      operationId: enroll-class-course
      summary: EnrollClassCourse
      description: >-
        Enroll a student in classe courses.


        The studentPeriodId parameter is the id as returned by GetPeriodStudents
        call.


        The classesCourse values are the ids as returned by
        GetPeriodClassCourses call.
      tags:
        - subpackage_students
      parameters:
        - name: tenant
          in: header
          required: false
          schema:
            type: string
        - name: schoolCode
          in: header
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties: {}
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: >-
                  #/components/schemas/DreamclassapiV1StudentsPeriodstudent7BstudentPeriodId7DRegisterClasscoursesPostRequestBodyContentApplicationJsonSchemaItems
servers:
  - url: https:/
    description: https://{server}
  - url: https://your-webhook-url
    description: https://your-webhook-url
components:
  schemas:
    DreamclassapiV1StudentsPeriodstudent7BstudentPeriodId7DRegisterClasscoursesPostRequestBodyContentApplicationJsonSchemaItemsClassesCourse:
      type: object
      properties:
        id:
          type: integer
      required:
        - id
      title: >-
        DreamclassapiV1StudentsPeriodstudent7BstudentPeriodId7DRegisterClasscoursesPostRequestBodyContentApplicationJsonSchemaItemsClassesCourse
    DreamclassapiV1StudentsPeriodstudent7BstudentPeriodId7DRegisterClasscoursesPostRequestBodyContentApplicationJsonSchemaItems:
      type: object
      properties:
        classesCourse:
          $ref: >-
            #/components/schemas/DreamclassapiV1StudentsPeriodstudent7BstudentPeriodId7DRegisterClasscoursesPostRequestBodyContentApplicationJsonSchemaItemsClassesCourse
      required:
        - classesCourse
      title: >-
        DreamclassapiV1StudentsPeriodstudent7BstudentPeriodId7DRegisterClasscoursesPostRequestBodyContentApplicationJsonSchemaItems

```

## Examples



**Request**

```json
[
  {
    "classesCourse": {
      "id": 88
    }
  },
  {
    "classesCourse": {
      "id": 41
    }
  }
]
```

**Response**

```json
"[\n  {\n    \"id\": 281,    \n    \"classesCourse\": {\n      \"id\": 88\n    }\n  },\n  {\n    \"id\": 282,\n    \"classesCourse\": {\n      \"id\": 41\n    }\n]"
```

**SDK Code**

```python Students_EnrollClassCourse_example
import requests

url = "https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses"

payload = [{ "classesCourse": { "id": 88 } }, { "classesCourse": { "id": 41 } }]
headers = {
    "tenant": "{{tenant}}",
    "schoolCode": "{{schoolCode}}",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Students_EnrollClassCourse_example
const url = 'https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses';
const options = {
  method: 'POST',
  headers: {
    tenant: '{{tenant}}',
    schoolCode: '{{schoolCode}}',
    'Content-Type': 'application/json'
  },
  body: '[{"classesCourse":{"id":88}},{"classesCourse":{"id":41}}]'
};

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

```go Students_EnrollClassCourse_example
package main

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

func main() {

	url := "https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses"

	payload := strings.NewReader("[\n  {\n    \"classesCourse\": {\n      \"id\": 88\n    }\n  },\n  {\n    \"classesCourse\": {\n      \"id\": 41\n    }\n  }\n]")

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

	req.Header.Add("tenant", "{{tenant}}")
	req.Header.Add("schoolCode", "{{schoolCode}}")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

```ruby Students_EnrollClassCourse_example
require 'uri'
require 'net/http'

url = URI("https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses")

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

request = Net::HTTP::Post.new(url)
request["tenant"] = '{{tenant}}'
request["schoolCode"] = '{{schoolCode}}'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"classesCourse\": {\n      \"id\": 88\n    }\n  },\n  {\n    \"classesCourse\": {\n      \"id\": 41\n    }\n  }\n]"

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

```java Students_EnrollClassCourse_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses")
  .header("tenant", "{{tenant}}")
  .header("schoolCode", "{{schoolCode}}")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"classesCourse\": {\n      \"id\": 88\n    }\n  },\n  {\n    \"classesCourse\": {\n      \"id\": 41\n    }\n  }\n]")
  .asString();
```

```php Students_EnrollClassCourse_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses', [
  'body' => '[
  {
    "classesCourse": {
      "id": 88
    }
  },
  {
    "classesCourse": {
      "id": 41
    }
  }
]',
  'headers' => [
    'Content-Type' => 'application/json',
    'schoolCode' => '{{schoolCode}}',
    'tenant' => '{{tenant}}',
  ],
]);

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

```csharp Students_EnrollClassCourse_example
using RestSharp;

var client = new RestClient("https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses");
var request = new RestRequest(Method.POST);
request.AddHeader("tenant", "{{tenant}}");
request.AddHeader("schoolCode", "{{schoolCode}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"classesCourse\": {\n      \"id\": 88\n    }\n  },\n  {\n    \"classesCourse\": {\n      \"id\": 41\n    }\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Students_EnrollClassCourse_example
import Foundation

let headers = [
  "tenant": "{{tenant}}",
  "schoolCode": "{{schoolCode}}",
  "Content-Type": "application/json"
]
let parameters = [["classesCourse": ["id": 88]], ["classesCourse": ["id": 41]]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://https/dreamclassapi/v1/students/periodstudent/%7BstudentPeriodId%7D/register/classcourses")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```