Author - Affiliated Sub Accounts API

This endpoint controls the affiliation of items with subaccounts.

Interfaces

List affiliated accounts

GET /api/author/course_templates/:course_template_id/sub_accounts
GET /api/author/affiliated_sub_accounts

Response codes

  • 200 OK

Parameters

  • sort String [ name ]

    Query parameter. Applies a sort ot the result list.

Example Request

/api/author/affiliated_sub_accounts?item_id=1&item_type=CourseTemplate

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": false,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}

Share

PUT /api/author/course_templates/:course_template_id/sub_accounts/share
PUT /api/author/affiliated_sub_accounts/share

Response codes

  • 200 OK On successful share
  • 400 Bad Request When item is archived
  • 403 Forbidden
  • 409 Conflict While item is pending affiliation

Parameters

  • item_id Integer Required

    The id of the item being shared

  • item_type String Required

    The type of item being shared

  • domain_id Integer Required

    The id of the domain

Example Request

{
  "item_id": 1,
  "item_type": "CourseTemplate",
  "domain_id": 1
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"item_id":1,"item_type":"CourseTemplate","domain_id":1}' \
  http://<bridge>/api/author/course_templates/:course_template_id/sub_accounts/share
    

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": true,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}

Share Batch

PUT /api/author/affiliated_sub_accounts/share_batch

Response codes

  • 200 OK On successful share of all items
  • 400 Bad Request When an issue occurs with one or more items
  • 403 Forbidden

Parameters

  • affiliations Array Required

    An array of objects to affiliate, each consisting of an item_type, item_id, and domain_id.

Example Request

{
  "affiliations": [
    {
      "item_id": 1,
      "item_type": "CourseTemplate",
      "domain_id": 1
    },
    {
      "item_id": 1,
      "item_type": "LiveCourse",
      "domain_id": 2
    },
    {
      "item_id": 1,
      "item_type": "Task",
      "domain_id": 3
    },
    {
      "item_id": 1,
      "item_type": "Program",
      "domain_id": 4
    }
  ]
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"affiliations":[{"item_id":1,"item_type":"CourseTemplate","domain_id":1},{"item_id":1,"item_type":"LiveCourse","domain_id":2},{"item_id":1,"item_type":"Task","domain_id":3},{"item_id":1,"item_type":"Program","domain_id":4}]}' \
  http://<bridge>/api/author/affiliated_sub_accounts/share_batch
    

Example Response

{
  "affiliations": [
    {
      "item_id": 1,
      "item_type": "CourseTemplate",
      "status": "success",
      "sub_accounts": [
        {
          "id": "1",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    },
    {
      "item_id": 1,
      "item_type": "LiveCourse",
      "status": "success",
      "sub_accounts": [
        {
          "id": "2",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    },
    {
      "item_id": 1,
      "item_type": "Task",
      "status": "error",
      "error_code": "item_outside_root_domain",
      "sub_accounts": [
        {
          "id": "3",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    },
    {
      "item_id": 1,
      "item_type": "Program",
      "status": "success",
      "sub_accounts": [
        {
          "id": "4",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    }
  ]
}

Share Tags

PUT /api/author/affiliated_sub_accounts/share_tags

Response codes

  • 200 OK On successful share
  • 400 Bad Request When item is archived
  • 403 Forbidden
  • 409 Conflict While item is pending affiliation

Parameters

  • item_id Integer Required

    The id of the item being shared

  • item_type String Required

    The type of item being shared

  • domain_id Integer Required

    The id of the domain

Example Request

{
  "item_id": 1,
  "item_type": "CourseTemplate",
  "domain_id": 1
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"item_id":1,"item_type":"CourseTemplate","domain_id":1}' \
  http://<bridge>/api/author/affiliated_sub_accounts/share_tags
    

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": true,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}

Share Group Relevance

PUT /api/author/affiliated_sub_accounts/share_group_relevance

Response codes

  • 200 OK On successful share
  • 400 Bad Request When item is archived
  • 403 Forbidden
  • 409 Conflict While item is pending affiliation

Parameters

  • item_id Integer Required

    The id of the item whose group relevance is being shared

  • item_type String Required

    The type of item whose group relevance is being shared

  • domain_id Integer Required

    The id of the domain

Example Request

{
  "item_id": 1,
  "item_type": "CourseTemplate",
  "domain_id": 1
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"item_id":1,"item_type":"CourseTemplate","domain_id":1}' \
  http://<bridge>/api/author/affiliated_sub_accounts/share_group_relevance
    

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": true,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}

Revoke

PUT /api/author/course_templates/:course_template_id/sub_accounts/revoke
PUT /api/author/affiliated_sub_accounts/revoke

Response codes

  • 200 OK On successful revoke
  • 400 Bad Request When item is archived
  • 403 Forbidden
  • 409 Conflict While item is pending affiliation

Parameters

  • item_id Integer Required

    The id of the item being revoked

  • item_type String Required

    The type of item being revoked

  • domain_id Integer Required

    The id of the domain

Example Request

{
  "item_id": 1,
  "item_type": "CourseTemplate",
  "domain_id": 1
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"item_id":1,"item_type":"CourseTemplate","domain_id":1}' \
  http://<bridge>/api/author/course_templates/:course_template_id/sub_accounts/revoke
    

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": false,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}

Revoke Batch

PUT /api/author/affiliated_sub_accounts/revoke_batch

Response codes

  • 200 OK On successful share of all items
  • 400 Bad Request When an issue occurs with one or more items
  • 403 Forbidden

Parameters

  • affiliations Array Required

    An array of objects to affiliate, each consisting of an item_type, item_id, and domain_id.

Example Request

{
  "affiliations": [
    {
      "item_id": 1,
      "item_type": "CourseTemplate",
      "domain_id": 1
    },
    {
      "item_id": 1,
      "item_type": "LiveCourse",
      "domain_id": 2
    },
    {
      "item_id": 1,
      "item_type": "Task",
      "domain_id": 3
    },
    {
      "item_id": 1,
      "item_type": "Program",
      "domain_id": 4
    }
  ]
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"affiliations":[{"item_id":1,"item_type":"CourseTemplate","domain_id":1},{"item_id":1,"item_type":"LiveCourse","domain_id":2},{"item_id":1,"item_type":"Task","domain_id":3},{"item_id":1,"item_type":"Program","domain_id":4}]}' \
  http://<bridge>/api/author/affiliated_sub_accounts/revoke_batch
    

Example Response

{
  "affiliations": [
    {
      "item_id": 1,
      "item_type": "CourseTemplate",
      "status": "success",
      "sub_accounts": [
        {
          "id": "1",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    },
    {
      "item_id": 1,
      "item_type": "LiveCourse",
      "status": "success",
      "sub_accounts": [
        {
          "id": "2",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    },
    {
      "item_id": 1,
      "item_type": "Task",
      "status": "error",
      "error_code": "item_outside_root_domain",
      "sub_accounts": [
        {
          "id": "3",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    },
    {
      "item_id": 1,
      "item_type": "Program",
      "status": "success",
      "sub_accounts": [
        {
          "id": "4",
          "name": "SubAccount",
          "affiliated": true,
          "has_enrollments": false,
          "has_foreign_sources": false,
          "user_count": 1
        }
      ]
    }
  ]
}

Revoke Tags

PUT /api/author/affiliated_sub_accounts/revoke_tags

Response codes

  • 200 OK On successful revoke
  • 400 Bad Request When item is archived
  • 403 Forbidden
  • 409 Conflict While item is pending affiliation

Parameters

  • item_id Integer Required

    The id of the item being revoked

  • item_type String Required

    The type of item being revoked

  • domain_id Integer Required

    The id of the domain

Example Request

{
  "item_id": 1,
  "item_type": "CourseTemplate",
  "domain_id": 1
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"item_id":1,"item_type":"CourseTemplate","domain_id":1}' \
  http://<bridge>/api/author/affiliated_sub_accounts/revoke_tags
    

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": false,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}

Revoke Group Relevance

PUT /api/author/affiliated_sub_accounts/revoke_group_relevance

Response codes

  • 200 OK On successful revoke
  • 400 Bad Request When item is archived
  • 403 Forbidden
  • 409 Conflict While item is pending affiliation

Parameters

  • item_id Integer Required

    The id of the item being revoked

  • item_type String Required

    The type of item being revoked

  • domain_id Integer Required

    The id of the domain

Example Request

{
  "item_id": 1,
  "item_type": "CourseTemplate",
  "domain_id": 1
}
curl \
  -X PUT \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -d '{"item_id":1,"item_type":"CourseTemplate","domain_id":1}' \
  http://<bridge>/api/author/affiliated_sub_accounts/revoke_group_relevance
    

Example Response

{
  "meta": {},
  "sub_accounts": [
    {
      "id": "1",
      "name": "SubAccount",
      "affiliated": false,
      "has_enrollments": false,
      "has_foreign_sources": false,
      "user_count": 1
    }
  ]
}