Update a session material.

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Moves a session material to a new position (sessionMaterialIndex), or changes the title, URL or embed code of a link or embed material on an on-demand lesson. A file cannot be replaced; remove it and attach the new one. Link and embed updates apply to on-demand lessons; live sessions only use presentation, video and PDF files.

Endpoint

put https://{TrainerCentral-API-Domain}/tc/api/v1/trainer/sessionMaterials/{sessionMaterialId}.json

OAuth Scope

TrainerCentral.sessionapi.UPDATECopied!

Headers

tc-orgIdstring(Required)

ID of the academy (orgId).

Example
51517414

Path Parameters

sessionMaterialIdstring(Required)

ID of the session material (sessionMaterialId).

Request Body

application/json
sessionMaterialJSON Object(Required)

Changes to the material: sessionMaterialIndex, or the link and embed keys.

Hide Sub-Attributes
sessionMaterialIndexinteger(Optional)

New zero-based position of the material. Used only when no link or embed key is sent.

linkTitlestring(Optional)

New title of a link (resourceType 7) or embed (resourceType 15).

linkAddressstring(Optional)

New URL of a link (resourceType 7). For session content it must be an allowed embeddable link.

embedCodestring(Optional)

New iframe HTML of an embed (resourceType 15).

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request PUT \
  --url https://trainercentral.zoho.com/tc/api/v1/trainer/sessionMaterials/{sessionMaterialId}.json \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: application/json' \
  --header 'tc-orgId: 51517414' \
  --data '{"sessionMaterial":{"sessionMaterialIndex":0}}'

Body Parameters

Move to the first position.

Move to the first position.

Change a link's title and URL.

Change an embed code.

Copied!
  {
    "sessionMaterial": {
      "sessionMaterialIndex": 0
    }
  }
                
  {
    "sessionMaterial": {
      "linkTitle": "Updated Reference",
      "linkAddress": "https://www.example.com/updated-article"
    }
  }
                
  {
    "sessionMaterial": {
      "linkTitle": "Updated Demo",
      "embedCode": "<iframe src=\"https://www.example.com/new-embed\" width=\"600\" height=\"400\"></iframe>"
    }
  }
                
▼ Show full

Response Parameters

sessionMaterialJSON Object

One attachment. Returned for a get, a link or embed update, or a text material update.

Hide Sub-Attributes
sessionMaterialIdstring

ID of the attachment (sessionMaterialId).

idstring

Same as sessionMaterialId.

sessionIdstring

ID of the lesson or live session.

sessionstring

Same as sessionId.

materialIdstring

ID of the file record (materials[].id). Absent for links and embeds.

materialstring

Same as materialId.

resourceIdstring

ID of the stored file or, for a test (resourceType 20), the test form UUID.

resourceTypestring

Type of the material. Live sessions use presentation, video and PDF only; on-demand lessons may also use link, embed, image, document, spreadsheet, zip, audio, rich text, recorded video and test. Allowed: 1=Presentation, 5=PDF, 6=Video, 7=Link, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Embed (iframe), 20=Test.

viewTypestring

Placement of the material. Allowed: 0=Session content, 1=Handout, 2=Assessment (tests), 4=Instruction (assignment lessons).

sessionMaterialIndexstring

Zero-based position of the material in the session.

topicstring

Display name of the material: the file name or the link title.

linkTitlestring

Title of a link (resourceType 7) or embed (resourceType 15).

linkAddressstring

URL of a link material (resourceType 7).

embedCodestring

Iframe HTML of an embed material (resourceType 15).

isDeletedstring

true when the file was deleted from the library.

timestring

Time attached, in epoch milliseconds.

materialJSON Object

File record of sessionMaterial. Absent for links and embeds.

Hide Sub-Attributes
idstring

ID of the file record.

namestring

File name of the material.

materialTypestring

Type of the file. Allowed: 1=Presentation, 5=PDF, 6=Video, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Subtitle.

sizestring

File size in bytes.

statusstring

Processing status. Allowed: -1=Scheduled, 0=Processing, 1=Uploaded, 2=Failed, 3=Converting, 4=Ready, 5=No preview.

renderingServicestring

Internal rendering service code.

storageServicestring

Internal storage service code.

sessionMaterialsJSON Array

Attachments of the session. Returned after an add, a reorder or a new text material.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
sessionMaterialIdstring

ID of the attachment (sessionMaterialId).

idstring

Same as sessionMaterialId.

sessionIdstring

ID of the lesson or live session.

sessionstring

Same as sessionId.

materialIdstring

ID of the file record (materials[].id). Absent for links and embeds.

materialstring

Same as materialId.

resourceIdstring

ID of the stored file or, for a test (resourceType 20), the test form UUID.

resourceTypestring

Type of the material. Live sessions use presentation, video and PDF only; on-demand lessons may also use link, embed, image, document, spreadsheet, zip, audio, rich text, recorded video and test. Allowed: 1=Presentation, 5=PDF, 6=Video, 7=Link, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Embed (iframe), 20=Test.

viewTypestring

Placement of the material. Allowed: 0=Session content, 1=Handout, 2=Assessment (tests), 4=Instruction (assignment lessons).

sessionMaterialIndexstring

Zero-based position of the material in the session.

topicstring

Display name of the material: the file name or the link title.

linkTitlestring

Title of a link (resourceType 7) or embed (resourceType 15).

linkAddressstring

URL of a link material (resourceType 7).

embedCodestring

Iframe HTML of an embed material (resourceType 15).

isDeletedstring

true when the file was deleted from the library.

timestring

Time attached, in epoch milliseconds.

materialsJSON Array

File records of the file-based entries.

Hide Sub-Attributes
JSON Object
Show Sub-Attributes
idstring

ID of the file record.

namestring

File name of the material.

materialTypestring

Type of the file. Allowed: 1=Presentation, 5=PDF, 6=Video, 8=Recorded video, 9=Image, 10=Rich text, 11=Document, 12=Spreadsheet, 13=ZIP, 14=Audio, 15=Subtitle.

sizestring

File size in bytes.

statusstring

Processing status. Allowed: -1=Scheduled, 0=Processing, 1=Uploaded, 2=Failed, 3=Converting, 4=Ready, 5=No preview.

renderingServicestring

Internal rendering service code.

storageServicestring

Internal storage service code.

errorJSON Object

Error details.

Hide Sub-Attributes
codestring

Deprecated numeric error code (for example ST_202). Prefer codeStr; omitted from doc samples.

codeStrstring

Error code name (ShowtimeErrorCode / err_code_str), for example MISSING_PARAMETER.

messagestring

Error message.

Possible Error Codes

HTTP CodeError CodeDescription
500ST_102

UNAUTHORISED_ACCESS - The sessionMaterialId is not in this academy, or the user is not an academy owner or admin, the primary trainer, or a course admin or trainer. Fix the ID or role; do not retry unchanged.

ST_366

LINK_NOT_ALLOWED - linkAddress is not an allowed embeddable link for session content. Send a URL from an allowed provider. Do not retry unchanged.

ST_79

INVALID_SESSION - The session of this material does not exist. Do not retry unchanged.

ST_401

SESSION_DELETED - The session of this material was deleted. Do not retry unchanged.

Response Example

Response after changing a link.

Response after changing a link.

Response after moving a material.

200
200
400
500
Copied!
  {
    "sessionMaterial": {
      "sessionMaterialId": "3000000000111",
      "id": "3000000000111",
      "linkTitle": "Updated Reference",
      "topic": "Updated Reference",
      "linkAddress": "https://www.example.com/updated-article"
    }
  }
                
  {
    "sessionMaterials": [
      {
        "sessionMaterialId": "3000000000111",
        "id": "3000000000111",
        "sessionId": "3000000000040",
        "session": "3000000000040",
        "resourceType": "7",
        "viewType": "0",
        "sessionMaterialIndex": "0",
        "topic": "Reference Article",
        "linkTitle": "Reference Article",
        "linkAddress": "https://www.example.com/article",
        "time": "1782727715600"
      },
      {
        "sessionMaterialId": "3000000000110",
        "id": "3000000000110",
        "sessionId": "3000000000040",
        "session": "3000000000040",
        "materialId": "3000000000120",
        "material": "3000000000120",
        "resourceType": "5",
        "viewType": "0",
        "sessionMaterialIndex": "1",
        "topic": "Module 1 Slides.pdf",
        "time": "1782727715513"
      }
    ],
    "materials": [
      {
        "id": "3000000000120",
        "name": "Module 1 Slides.pdf",
        "materialType": "5",
        "size": "204800",
        "status": "4"
      }
    ]
  }
                
  {
    "error": {
      "code": "string",
      "codeStr": "string",
      "message": "string"
    }
  }
                
500 Request failed; see the error code.
▼ Show full