> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-unsw-v6.advance-uac.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-unsw-v6.advance-uac.com/_mcp/server.

# Add a course to a structure

POST https://institution/catalogue/structures/{id}/courses
Content-Type: application/json

Reference: https://docs-unsw-v6.advance-uac.com/unsw-advance-institution-api/institution/catalogue/structure/add-a-course-to-a-structure

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /institution/catalogue/structures/{id}/courses:
    post:
      operationId: Add a course to a structure
      summary: Add a course to a structure
      tags:
        - structure
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: programCode
          in: query
          description: >-
            Optional - Enforce check if the structure ID belongs to the right
            program and year
          required: false
          schema:
            type: string
        - name: programYear
          in: query
          required: false
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/institution_catalogue_structure_Add a
                  course to a structure_Response_201
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostInstitutionCatalogueStructuresIdCoursesRequestBadRequestError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
                year:
                  type: integer
              required:
                - code
                - year
servers:
  - url: https:/
    description: https://{baseurl}
components:
  schemas:
    institution_catalogue_structure_Add a course to a structure_Response_201:
      type: object
      properties:
        id:
          type: string
          format: uuid
        itemType:
          type: string
        code:
          type: string
        year:
          type: integer
        name:
          type: string
        uoc:
          type: integer
        resolved:
          type: boolean
      required:
        - id
        - itemType
        - code
        - year
        - name
        - uoc
        - resolved
      title: institution_catalogue_structure_Add a course to a structure_Response_201
    PostInstitutionCatalogueStructuresIdCoursesRequestBadRequestError:
      type: object
      properties:
        error:
          type: string
        status:
          type: integer
      required:
        - error
        - status
      title: PostInstitutionCatalogueStructuresIdCoursesRequestBadRequestError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "code": "MATH1131",
  "year": 2026
}
```

**Response**

```json
{
  "id": "77a61986-7938-4137-92b4-0de78c3534c7",
  "itemType": "Course",
  "code": "MATH1131",
  "year": 2026,
  "name": "Mathematics 1A",
  "uoc": 6,
  "resolved": true
}
```

**SDK Code**

```python institution_catalogue_structure_Add a course to a structure_example
import requests

url = "https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses"

payload = {
    "code": "MATH1131",
    "year": 2026
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript institution_catalogue_structure_Add a course to a structure_example
const url = 'https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"code":"MATH1131","year":2026}'
};

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

```go institution_catalogue_structure_Add a course to a structure_example
package main

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

func main() {

	url := "https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses"

	payload := strings.NewReader("{\n  \"code\": \"MATH1131\",\n  \"year\": 2026\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	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 institution_catalogue_structure_Add a course to a structure_example
require 'uri'
require 'net/http'

url = URI("https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"code\": \"MATH1131\",\n  \"year\": 2026\n}"

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

```java institution_catalogue_structure_Add a course to a structure_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"code\": \"MATH1131\",\n  \"year\": 2026\n}")
  .asString();
```

```php institution_catalogue_structure_Add a course to a structure_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses', [
  'body' => '{
  "code": "MATH1131",
  "year": 2026
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp institution_catalogue_structure_Add a course to a structure_example
using RestSharp;

var client = new RestClient("https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"code\": \"MATH1131\",\n  \"year\": 2026\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift institution_catalogue_structure_Add a course to a structure_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "code": "MATH1131",
  "year": 2026
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://https/institution/catalogue/structures/05678075-7e69-4c37-96b5-a266ec60cf06/courses")! 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()
```