# Google Classroom API . courses . aliases

## Instance Methods

Creates an alias to a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create the alias. * `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the alias already exists.

Deletes an alias of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to remove the alias. * `NOT_FOUND` if the alias does not exist.

Lists the aliases of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the course. * `NOT_FOUND` if the course does not exist.

Retrieves the next page of results.

### Method Details

`create(courseId, body, x__xgafv=None)`

    Creates an alias to a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to create the alias. * `NOT_FOUND` if the course does not exist. * `ALREADY_EXISTS` if the alias already exists.

    Args:
      courseId: string, The identifier of the course to alias. This may either be the Classroom-assigned identifier or an [alias][google.classroom.v1.CourseAlias]. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # Alternative identifier for a course. An alias uniquely identifies a course. It will be unique within one of the following scopes: * domain: A domain-scoped alias is visible to all users within the alias creator's domain and may only be created by a domain admin. A domain-scoped alias is often used when a course has an identifier external to Classroom. * project: A project-scoped alias is visible to any request from an application using the Developer Console Project ID that created the alias and may be created by any project. A project-scoped alias is often used when an application has alternative identifiers. A random value can also be used to avoid duplicate courses in the event of transmission failures, as retrying a request will return ALREADY_EXISTS if a previous one has succeeded.
        "alias": "A String", # Alias string. The format of the string indicated the desired alias scoping. * "d:" indicates a domain-scoped alias. Example: d:math_101 * "p:" indicates a project-scoped alias. Example: p:abc123 This field has a maximum length of 256 characters.
      }

      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # Alternative identifier for a course. An alias uniquely identifies a course. It will be unique within one of the following scopes: * domain: A domain-scoped alias is visible to all users within the alias creator's domain and may only be created by a domain admin. A domain-scoped alias is often used when a course has an identifier external to Classroom. * project: A project-scoped alias is visible to any request from an application using the Developer Console Project ID that created the alias and may be created by any project. A project-scoped alias is often used when an application has alternative identifiers. A random value can also be used to avoid duplicate courses in the event of transmission failures, as retrying a request will return ALREADY_EXISTS if a previous one has succeeded.
          "alias": "A String", # Alias string. The format of the string indicated the desired alias scoping. * "d:" indicates a domain-scoped alias. Example: d:math_101 * "p:" indicates a project-scoped alias. Example: p:abc123 This field has a maximum length of 256 characters.
        }

`delete(courseId, alias, x__xgafv=None)`

    Deletes an alias of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to remove the alias. * `NOT_FOUND` if the alias does not exist.

    Args:
      courseId: string, The identifier of the course whose alias should be deleted. This may either be the Classroom-assigned identifier or an [alias][google.classroom.v1.CourseAlias]. (required)
      alias: string, The alias to delete. This may not be the Classroom-assigned identifier. (required)
      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.
      }

`list(courseId, pageSize=None, x__xgafv=None, pageToken=None)`

    Lists the aliases of a course. This method returns the following error codes: * `PERMISSION_DENIED` if the requesting user is not permitted to access the course. * `NOT_FOUND` if the course does not exist.

    Args:
      courseId: string, The identifier of the course. This may either be the Classroom-assigned identifier or an [alias][google.classroom.v1.CourseAlias]. (required)
      pageSize: integer, Maximum number of items to return. Zero or unspecified indicates that the server may assign a maximum. The server may return fewer than the specified number of results.
      x__xgafv: string, V1 error format.
      pageToken: string, [nextPageToken][google.classroom.v1.ListCourseAliasesResponse.next_page_token] value returned from a previous [list][google.classroom.v1.Courses.ListCourseAliases] call, indicating that the subsequent page of results should be returned. The [list][google.classroom.v1.Courses.ListCourseAliases] request must be identical to the one which resulted in this token.

    Returns:
      An object of the form:

        { # Response when listing course aliases.
        "nextPageToken": "A String", # Token identifying the next page of results to return. If empty, no further results are available.
        "aliases": [ # The course aliases.
          { # Alternative identifier for a course. An alias uniquely identifies a course. It will be unique within one of the following scopes: * domain: A domain-scoped alias is visible to all users within the alias creator's domain and may only be created by a domain admin. A domain-scoped alias is often used when a course has an identifier external to Classroom. * project: A project-scoped alias is visible to any request from an application using the Developer Console Project ID that created the alias and may be created by any project. A project-scoped alias is often used when an application has alternative identifiers. A random value can also be used to avoid duplicate courses in the event of transmission failures, as retrying a request will return ALREADY_EXISTS if a previous one has succeeded.
              "alias": "A String", # Alias string. The format of the string indicated the desired alias scoping. * "d:" indicates a domain-scoped alias. Example: d:math_101 * "p:" indicates a project-scoped alias. Example: p:abc123 This field has a maximum length of 256 characters.
            },
        ],
      }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.