> 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.

# Student Course

POST https://#post4
Content-Type: application/json

Webhook related to student assigned to course in the context of a class, trigged upon

- Student course created: STUDENT_COURSE_CREATED
    
- Student course updated: STUDENT_COURSE_UPDATED
    
- Student course deleted: STUDENT_COURSE_DELETED
    

The provided courseId can be used in the GetSchoolCourses API.The provided classId can be used in the GetPeriodClasses API. The studentPeriodId is the one returned in the Student Period webhook

Reference: https://apidoc.dreamclass.io/dream-class-api/webhooks/student-course

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /#post4:
    post:
      operationId: student-course
      summary: Student Course
      description: >-
        Webhook related to student assigned to course in the context of a class,
        trigged upon


        - Student course created: STUDENT_COURSE_CREATED
            
        - Student course updated: STUDENT_COURSE_UPDATED
            
        - Student course deleted: STUDENT_COURSE_DELETED
            

        The provided courseId can be used in the GetSchoolCourses API.The
        provided classId can be used in the GetPeriodClasses API. The
        studentPeriodId is the one returned in the Student Period webhook
      tags:
        - subpackage_webhooks
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Webhooks_Student Course_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  format: uuid
                data:
                  $ref: >-
                    #/components/schemas/Post4PostRequestBodyContentApplicationJsonSchemaData
                type:
                  type: string
                tenant:
                  type: string
                signature:
                  type: string
                timestamp:
                  type: integer
              required:
                - id
                - data
                - type
                - tenant
                - signature
                - timestamp
servers:
  - url: https:/
    description: https://{server}
  - url: https://your-webhook-url
    description: https://your-webhook-url
components:
  schemas:
    Post4PostRequestBodyContentApplicationJsonSchemaDataClassCourse:
      type: object
      properties:
        id:
          type: integer
        classid:
          type: integer
        courseId:
          type: integer
      required:
        - id
        - classid
        - courseId
      title: Post4PostRequestBodyContentApplicationJsonSchemaDataClassCourse
    Post4PostRequestBodyContentApplicationJsonSchemaData:
      type: object
      properties:
        id:
          type: integer
        addedAt:
          type: string
          format: date-time
        endDate:
          description: Any type
        startDate:
          description: Any type
        registered:
          type: boolean
        classCourse:
          $ref: >-
            #/components/schemas/Post4PostRequestBodyContentApplicationJsonSchemaDataClassCourse
        studentPeriodId:
          type: integer
      required:
        - id
        - addedAt
        - registered
        - classCourse
        - studentPeriodId
      title: Post4PostRequestBodyContentApplicationJsonSchemaData
    Webhooks_Student Course_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Webhooks_Student Course_Response_200

```

## Examples



**Request**

```json
{
  "id": "4b32de97-dd28-4fb1-8126-129c2ff106dd",
  "data": {
    "id": 128,
    "addedAt": "2024-10-02T15:25:27.840+00:00",
    "registered": true,
    "classCourse": {
      "id": 46,
      "classid": 14,
      "courseId": 45
    },
    "studentPeriodId": 74
  },
  "type": "STUDENT_COURSE_CREATED",
  "tenant": "my-school",
  "signature": "ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=",
  "timestamp": 1727882727860
}
```

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://https/#post4"

payload = {
    "id": "4b32de97-dd28-4fb1-8126-129c2ff106dd",
    "data": {
        "id": 128,
        "addedAt": "2024-10-02T15:25:27.840+00:00",
        "registered": True,
        "classCourse": {
            "id": 46,
            "classid": 14,
            "courseId": 45
        },
        "studentPeriodId": 74
    },
    "type": "STUDENT_COURSE_CREATED",
    "tenant": "my-school",
    "signature": "ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=",
    "timestamp": 1727882727860
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://https/#post4';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"id":"4b32de97-dd28-4fb1-8126-129c2ff106dd","data":{"id":128,"addedAt":"2024-10-02T15:25:27.840+00:00","registered":true,"classCourse":{"id":46,"classid":14,"courseId":45},"studentPeriodId":74},"type":"STUDENT_COURSE_CREATED","tenant":"my-school","signature":"ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=","timestamp":1727882727860}'
};

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

```go
package main

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

func main() {

	url := "https://https/#post4"

	payload := strings.NewReader("{\n  \"id\": \"4b32de97-dd28-4fb1-8126-129c2ff106dd\",\n  \"data\": {\n    \"id\": 128,\n    \"addedAt\": \"2024-10-02T15:25:27.840+00:00\",\n    \"registered\": true,\n    \"classCourse\": {\n      \"id\": 46,\n      \"classid\": 14,\n      \"courseId\": 45\n    },\n    \"studentPeriodId\": 74\n  },\n  \"type\": \"STUDENT_COURSE_CREATED\",\n  \"tenant\": \"my-school\",\n  \"signature\": \"ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=\",\n  \"timestamp\": 1727882727860\n}")

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

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

url = URI("https://https/#post4")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"id\": \"4b32de97-dd28-4fb1-8126-129c2ff106dd\",\n  \"data\": {\n    \"id\": 128,\n    \"addedAt\": \"2024-10-02T15:25:27.840+00:00\",\n    \"registered\": true,\n    \"classCourse\": {\n      \"id\": 46,\n      \"classid\": 14,\n      \"courseId\": 45\n    },\n    \"studentPeriodId\": 74\n  },\n  \"type\": \"STUDENT_COURSE_CREATED\",\n  \"tenant\": \"my-school\",\n  \"signature\": \"ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=\",\n  \"timestamp\": 1727882727860\n}"

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

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

HttpResponse<String> response = Unirest.post("https://https/#post4")
  .header("Content-Type", "application/json")
  .body("{\n  \"id\": \"4b32de97-dd28-4fb1-8126-129c2ff106dd\",\n  \"data\": {\n    \"id\": 128,\n    \"addedAt\": \"2024-10-02T15:25:27.840+00:00\",\n    \"registered\": true,\n    \"classCourse\": {\n      \"id\": 46,\n      \"classid\": 14,\n      \"courseId\": 45\n    },\n    \"studentPeriodId\": 74\n  },\n  \"type\": \"STUDENT_COURSE_CREATED\",\n  \"tenant\": \"my-school\",\n  \"signature\": \"ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=\",\n  \"timestamp\": 1727882727860\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/#post4', [
  'body' => '{
  "id": "4b32de97-dd28-4fb1-8126-129c2ff106dd",
  "data": {
    "id": 128,
    "addedAt": "2024-10-02T15:25:27.840+00:00",
    "registered": true,
    "classCourse": {
      "id": 46,
      "classid": 14,
      "courseId": 45
    },
    "studentPeriodId": 74
  },
  "type": "STUDENT_COURSE_CREATED",
  "tenant": "my-school",
  "signature": "ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=",
  "timestamp": 1727882727860
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://https/#post4");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"id\": \"4b32de97-dd28-4fb1-8126-129c2ff106dd\",\n  \"data\": {\n    \"id\": 128,\n    \"addedAt\": \"2024-10-02T15:25:27.840+00:00\",\n    \"registered\": true,\n    \"classCourse\": {\n      \"id\": 46,\n      \"classid\": 14,\n      \"courseId\": 45\n    },\n    \"studentPeriodId\": 74\n  },\n  \"type\": \"STUDENT_COURSE_CREATED\",\n  \"tenant\": \"my-school\",\n  \"signature\": \"ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=\",\n  \"timestamp\": 1727882727860\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "id": "4b32de97-dd28-4fb1-8126-129c2ff106dd",
  "data": [
    "id": 128,
    "addedAt": "2024-10-02T15:25:27.840+00:00",
    "registered": true,
    "classCourse": [
      "id": 46,
      "classid": 14,
      "courseId": 45
    ],
    "studentPeriodId": 74
  ],
  "type": "STUDENT_COURSE_CREATED",
  "tenant": "my-school",
  "signature": "ac7YipSwLgb7hm28jpnxbdLAfRlq6swR5n1qkfLmQ74=",
  "timestamp": 1727882727860
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://https/#post4")! 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()
```