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

# AddGradebookGrade

POST https://dreamclassapi/v1/grading/gradebook/grade
Content-Type: application/json

Add a new grade in a gradebook for the specified class course (gradebook should have already been created)

ClassCourse: Check GetPeriodClassCourses call

GradeMapping: Check GradeMapping call

ParentSimpleGradeId: Self referencing to another grade from the the gradebook, check Gradebook call

Type:  
4 -> Folder  
5 -> Point grade  
6 -> Grade

Colors: Check [https://tailwindcss.com/docs/colors](https://tailwindcss.com/docs/colors) for colors

Reference: https://apidoc.dreamclass.io/dream-class-api/grading/add-gradebook-grade

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /dreamclassapi/v1/grading/gradebook/grade:
    post:
      operationId: add-gradebook-grade
      summary: AddGradebookGrade
      description: >-
        Add a new grade in a gradebook for the specified class course (gradebook
        should have already been created)


        ClassCourse: Check GetPeriodClassCourses call


        GradeMapping: Check GradeMapping call


        ParentSimpleGradeId: Self referencing to another grade from the the
        gradebook, check Gradebook call


        Type:  

        4 -> Folder  

        5 -> Point grade  

        6 -> Grade


        Colors: Check
        [https://tailwindcss.com/docs/colors](https://tailwindcss.com/docs/colors)
        for colors
      tags:
        - subpackage_grading
      parameters:
        - name: classCourseId
          in: query
          description: Class course id of the gradebook
          required: false
          schema:
            type: string
        - 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:
                $ref: '#/components/schemas/Grading_AddGradebookGrade_Response_200'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                type:
                  type: integer
                color:
                  type: string
                weight:
                  type: integer
                maxGrade:
                  description: Any type
                position:
                  type: integer
                creationDate:
                  type: string
                  format: date
                gradeMapping:
                  $ref: >-
                    #/components/schemas/DreamclassapiV1GradingGradebookGradePostRequestBodyContentApplicationJsonSchemaGradeMapping
                parentSimpleGrade:
                  $ref: >-
                    #/components/schemas/DreamclassapiV1GradingGradebookGradePostRequestBodyContentApplicationJsonSchemaParentSimpleGrade
              required:
                - name
                - type
                - color
                - weight
                - position
                - creationDate
                - gradeMapping
                - parentSimpleGrade
servers:
  - url: https:/
    description: https://{server}
  - url: https://your-webhook-url
    description: https://your-webhook-url
components:
  schemas:
    DreamclassapiV1GradingGradebookGradePostRequestBodyContentApplicationJsonSchemaGradeMapping:
      type: object
      properties:
        id:
          type: integer
      required:
        - id
      title: >-
        DreamclassapiV1GradingGradebookGradePostRequestBodyContentApplicationJsonSchemaGradeMapping
    DreamclassapiV1GradingGradebookGradePostRequestBodyContentApplicationJsonSchemaParentSimpleGrade:
      type: object
      properties:
        id:
          type: integer
      required:
        - id
      title: >-
        DreamclassapiV1GradingGradebookGradePostRequestBodyContentApplicationJsonSchemaParentSimpleGrade
    Grading_AddGradebookGrade_Response_200:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type:
          type: integer
        color:
          type: string
        weight:
          type: integer
        position:
          type: integer
        gradeMappingId:
          type: integer
        parentSimpleGradeId:
          type: integer
      required:
        - id
        - name
        - type
        - color
        - weight
        - position
        - gradeMappingId
        - parentSimpleGradeId
      title: Grading_AddGradebookGrade_Response_200

```

## Examples



**Request**

```json
{
  "name": "Midterm Exam",
  "type": 6,
  "color": "blue-700",
  "weight": 2,
  "position": 3,
  "creationDate": "2024-09-15",
  "gradeMapping": {
    "id": 5
  },
  "parentSimpleGrade": {
    "id": 102
  }
}
```

**Response**

```json
{
  "id": 789,
  "name": "Midterm Exam",
  "type": 6,
  "color": "blue-700",
  "weight": 2,
  "position": 3,
  "gradeMappingId": 5,
  "parentSimpleGradeId": 102
}
```

**SDK Code**

```python Grading_AddGradebookGrade_example
import requests

url = "https://https/dreamclassapi/v1/grading/gradebook/grade"

querystring = {"classCourseId":"{{classCourseId}}"}

payload = {
    "name": "Midterm Exam",
    "type": 6,
    "color": "blue-700",
    "weight": 2,
    "position": 3,
    "creationDate": "2024-09-15",
    "gradeMapping": { "id": 5 },
    "parentSimpleGrade": { "id": 102 }
}
headers = {
    "tenant": "{{tenant}}",
    "schoolCode": "{{schoolCode}}",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Grading_AddGradebookGrade_example
const url = 'https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D';
const options = {
  method: 'POST',
  headers: {
    tenant: '{{tenant}}',
    schoolCode: '{{schoolCode}}',
    'Content-Type': 'application/json'
  },
  body: '{"name":"Midterm Exam","type":6,"color":"blue-700","weight":2,"position":3,"creationDate":"2024-09-15","gradeMapping":{"id":5},"parentSimpleGrade":{"id":102}}'
};

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

```go Grading_AddGradebookGrade_example
package main

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

func main() {

	url := "https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D"

	payload := strings.NewReader("{\n  \"name\": \"Midterm Exam\",\n  \"type\": 6,\n  \"color\": \"blue-700\",\n  \"weight\": 2,\n  \"position\": 3,\n  \"creationDate\": \"2024-09-15\",\n  \"gradeMapping\": {\n    \"id\": 5\n  },\n  \"parentSimpleGrade\": {\n    \"id\": 102\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 Grading_AddGradebookGrade_example
require 'uri'
require 'net/http'

url = URI("https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D")

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  \"name\": \"Midterm Exam\",\n  \"type\": 6,\n  \"color\": \"blue-700\",\n  \"weight\": 2,\n  \"position\": 3,\n  \"creationDate\": \"2024-09-15\",\n  \"gradeMapping\": {\n    \"id\": 5\n  },\n  \"parentSimpleGrade\": {\n    \"id\": 102\n  }\n}"

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

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

HttpResponse<String> response = Unirest.post("https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D")
  .header("tenant", "{{tenant}}")
  .header("schoolCode", "{{schoolCode}}")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Midterm Exam\",\n  \"type\": 6,\n  \"color\": \"blue-700\",\n  \"weight\": 2,\n  \"position\": 3,\n  \"creationDate\": \"2024-09-15\",\n  \"gradeMapping\": {\n    \"id\": 5\n  },\n  \"parentSimpleGrade\": {\n    \"id\": 102\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D', [
  'body' => '{
  "name": "Midterm Exam",
  "type": 6,
  "color": "blue-700",
  "weight": 2,
  "position": 3,
  "creationDate": "2024-09-15",
  "gradeMapping": {
    "id": 5
  },
  "parentSimpleGrade": {
    "id": 102
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'schoolCode' => '{{schoolCode}}',
    'tenant' => '{{tenant}}',
  ],
]);

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

```csharp Grading_AddGradebookGrade_example
using RestSharp;

var client = new RestClient("https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D");
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  \"name\": \"Midterm Exam\",\n  \"type\": 6,\n  \"color\": \"blue-700\",\n  \"weight\": 2,\n  \"position\": 3,\n  \"creationDate\": \"2024-09-15\",\n  \"gradeMapping\": {\n    \"id\": 5\n  },\n  \"parentSimpleGrade\": {\n    \"id\": 102\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Grading_AddGradebookGrade_example
import Foundation

let headers = [
  "tenant": "{{tenant}}",
  "schoolCode": "{{schoolCode}}",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Midterm Exam",
  "type": 6,
  "color": "blue-700",
  "weight": 2,
  "position": 3,
  "creationDate": "2024-09-15",
  "gradeMapping": ["id": 5],
  "parentSimpleGrade": ["id": 102]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://https/dreamclassapi/v1/grading/gradebook/grade?classCourseId=%7B%7BclassCourseId%7D%7D")! 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()
```