Pearson
Always Learning

This API is one of several for retrieving posts in a thread; this view is a flattened list of all responses. It is also used to create a new top-level post, and deleting an existing post.

By default, all posts and replies in the thread are returned with no hierarchy and no parent identifiers from which to create a hierarchy. However, you can use the depth query string parameter (see below) to specify only a certain level of posts to return. You can combine a query string of ?depth=1 (to return only top-level posts) with the Replies to a Post API to traverse a thread.

This API has certain restrictions and behaviors depending on the user role (in OAuth 2) or depending on where the response exists in the thread. GET requests on this API only returns all posts a topic (by default), however POST requests on this API will create only a top-level post. DELETE requests on this API will work for any response ID regardless of where that post is in the hierarchy. To get or create posts that are replies to other posts, review the Replies to a Post API.



Supported Roles and Authentication Protocols

Type Supported Values
Authentication Protocols OAuth 1.0a, OAuth 2.0
Note: OAuth 1 does not support POSTrequests.
Valid for Roles (OAuth 2): Professor, Teaching Assistant, Student, Administrator
Note: Students cannot use DELETE requests.

API Request

API Endpoints

HTTP Verbs and URIs

GET /courses/{courseId}/threadeddiscussions/{contentItemId}/topics/{topicId}/responses{.format}
  • Retrieves a flattened list of all posts in a topic.
  • Can be filtered to the top-level posts only by using the depth query string parameter.
  • To retrieve children responses, use Replies to a Post.
GET /courses/{courseId}/threadeddiscussions/{contentItemId}/topics/{topicId}/responses/{postId}{.format}
  • Retrieves detail of a single thread post. The post can be from any level of the thread (doesn't have to be top-level).
POST /courses/{courseId}/threadeddiscussions/{contentItemId}/topics/{topicId}/responses{.format}
  • Create a new post at the top-level of the topic.
  • To create a reply to a post, use Replies to a Post.

DELETE /courses/{courseId}/threadeddiscussions/{contentItemId}/topics/{topicId}/responses/{postId}{.format}
  • Retrieves a single topic.
  • This API will work for any thread post, regardless of where it is in the response hierarchy.
  • Only valid for Professor, Teaching Assistant, and Administrator OAuth 2 Access Tokens.

Parameters

Parameter Description Valid Values
{courseId} LearningStudio Course ID or relevant course overload.
  • Numeric ID issued by LearningStudio
  • ccn={callNumber}
{contentItemId} LearningStudio Content Item ID of the threaded discussion. Numeric ID issued by LearningStudio
{topicId} LearningStudio Topic ID. Numeric ID issued by LearningStudio
{postId} LearningStudio Thread Post ID. Numeric ID issued by LearningStudio
{.format} Desired format of response data. See Response Formats. .json , .xml , or Blank

Query String Parameters

Query Parameter Name Description Valid Values
depth Use this parameter to only include the responses up to an including a certain level. For example, set this to 1 to include only the top-level posts. Any integer value
useSourceDomain Include a full URL for any linked resources in content (such as images stored in LearningStudio). true if specifying this parameter, otherwise false or don't include this parameter.

Request Body

For GET and DELETE Requests

None.

For POST Requests

{
  "response":{
    "title":"{postTitle}",
    "description":"{responseBody}"
  }
}

Property Descriptions

Name Description Valid Values
{postTitle} Title of the Post. String of characters.
{responseBody} Body of the response. String of characters. This may contain HTML.

API Response

Response Headers

This API returns the standard HTTP Status Codes used by the LearningStudio APIs. There are no special headers returned by the API.

When deleting a post, the API will return a status code of 204 - No Content with no response body.

Response Body

Format

{
  "responses":[{
    "id":{postId},
    "title":"{responseTitle}",
    "description":"{responseBody}",
    "author":{
       "links":[{
         "href":"{authorHref}",
         "rel":"self"
       },{
         "href":"{userHref}",
         "rel":"related"
       }]
    },
    "postedDate":"{postedDate}",
    "links": [{
        "href": "{attachmentsHref}",
        "rel": "https://api.learningstudio.com/courses/threadedDiscussions/topics/responses/attachments"
      }]
  }]
}

Property Descriptions

Name Description
{postId} LearningStudio Thread Post ID.
{responseTitle} Post title.
{responseBody} Body of the title. Note, this may contain HTML.
{authorHref} A link to retrieve the name and email address of the user that created the post.
{userHref} A link to retrieve the user detail object for the user that created the post.
{postedDate} Date and time response was posted.
{attachmentsHref} Link to the attachments for a post.

Example: Get Top-Level Responses in a Topic

Request

Endpoint

GET /courses/123456/threadeddiscussions/10012345678/topics/800055/responses?depth=1

Response

Body

{
  "responses":[{
    "id":8000150500,
    "title":"Hello from Professor Goodjoy",
    "description":"This is the prof's first response<br />",
    "author":{
      "links":[{
        "href":"https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150500/responseAuthor",
        "rel":"self"
      },{
        "href":"https://api.learningstudio.com/users/1111111",
        "rel":"related"
      }]},
    "postedDate":"2010-02-09T15:29:55.88",
    "links": [{
        "href": "https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150500/attachments",
        "rel": "https://api.learningstudio.com/courses/threadedDiscussions/topics/responses/attachments"
      }]
  },{
    "id":8000150505,
    "title":"The First Student Post",
    "description":"This is the student's first response<br />",
    "author":{
        "links":[{
        "href":"https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150505/responseAuthor",
        "rel":"self"
      },{
        "href":"https://api.learningstudio.com/users/2222222",
        "rel":"related"
      }]},
    "postedDate":"2010-02-10T17:03:34.18",
    "links": [{
        "href": "https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150505/attachments",
        "rel": "https://api.learningstudio.com/courses/threadedDiscussions/topics/responses/attachments"
      }]
  }]
}

Example: Get Top-Level Responses in a Topic for a CMS course using useSourceDomain

Request

Endpoint

GET /courses/123456/threadeddiscussions/10012345678/topics/800055/responses?depth=1&amp;useSourceDomain=true

Response

Body

{
  "responses":[{
    "id":8000150500,
    "title":"Hello from Professor Goodjoy",
    "description":"This is the prof's first response<br /><img src="https://api.learningstudio.com/courses/123456/files/img1.jpg?cmsContentId=2372beff-33fe-4533-a47e-cc003fa22e35" alt="test" title="test" />",
    "author":{
      "links":[{
        "href":"https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150500/responseAuthor",
        "rel":"self"
      },{
        "href":"https://api.learningstudio.com/users/1111111",
        "rel":"related"
      }]},
    "postedDate":"2010-02-09T15:29:55.88",
    "links": [{
        "href": "https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150500/attachments",
        "rel": "https://api.learningstudio.com/courses/threadedDiscussions/topics/responses/attachments"
      }]
  },{
    "id":8000150505,
    "title":"The First Student Post",
    "description":"This is the student's first response<br />",
    "author":{
        "links":[{
        "href":"https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150505/responseAuthor",
        "rel":"self"
      },{
        "href":"https://api.learningstudio.com/users/2222222",
        "rel":"related"
      }]},
    "postedDate":"2010-02-10T17:03:34.18",
    "links": [{
        "href": "https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150505/attachments",
        "rel": "https://api.learningstudio.com/courses/threadedDiscussions/topics/responses/attachments"
      }]
  }]
}

Example: Create a New Top Level Post

Request

Endpoint

POST /courses/123456/threadeddiscussions/10012345678/topics/800055/responses

Body

{
  "response":{
    "title":"This is my first post",
    "description":"I'm <b>so</b> excited for this class."
  }
}

Response

Body

{
  "responses":[{
    "id":8000150510,
    "title":"This is my first post",
    "description":"I'm <b>so</b> excited for this class.",
    "author":{
      "links":[{
        "href":"https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150510/responseAuthor",
        "rel":"self"
      },{
        "href":"https://api.learningstudio.com/users/3333333",
        "rel":"related"
      }]},
    "postedDate":"2010-02-09T15:29:55.88",
    "links": [{
        "href": "https://api.learningstudio.com/courses/123456/threads/10012345678/topics/800055/responses/8000150510/attachments",
        "rel": "https://api.learningstudio.com/courses/threadedDiscussions/topics/responses/attachments"
      }]
  }]
}
3438 reads
Always Learning
Pearson