# Classroom - Guardians - [API documentation](#api-documentation) - [Definitions](#definitions) - [Create guardian invitations](#create-guardian-invitations) - [Delete guardian invitations](#delete-guardian-invitations) - [Display guardian invitations](#display-guardian-invitations) - [Delete guardians](#delete-guardians) - [Synchronize guardians](#synchronize-guardians) - [Display guardians, indented keys and values](#display-guardians-indented-keys-and-values) - [Display guardians, CSV format](#display-guardians-csv-format) ## API documentation * https://developers.google.com/classroom/reference/rest/v1/userProfiles.guardianInvitations * https://developers.google.com/classroom/reference/rest/v1/userProfiles.guardians ## Definitions ``` ::= (.)+ ::= @ ::= id: ::= || ::= "(,)*" ::= | | | | See: https://github.com/taers232c/GAMADV-XTD3/wiki/Collections-of-Items ::= || ::= ::= "(,)*" ::= | | | | See: https://github.com/taers232c/GAMADV-XTD3/wiki/Collections-of-Items ::= complete|pending ::= "(,)*" ``` ## Create guardian invitations ### Selected students, new style ``` gam create|add guardian|guardianinvite|inviteguardian ``` ### Selected students, old style ``` gam create guardian|guardianinvite|inviteguardian ``` ## Delete guardian invitations ### Selected students, new style ``` gam cancel guardianinvitation|guardianinvitations gam delete guardian|guardians invitations gam clear guardian|guardians invitations ``` ### Selected students, old style ``` gam cancel guardianinvitation|guardianinvitations gam delete guardian|guardians invitations ``` ## Display guardian invitations ### All students ``` gam show guardian|guardians invitations [states ] [invitedguardian ] [showstudentemails] [formatjson] gam print guardian|guardians [todrive *] invitations [states ] [invitedguardian ] [showstudentemails] [formatjson [quotechar ]] ``` The Classroom API does not return the student email address, use the `showstudentemails` option to get the student email address. This requires an additional API call per student. ### Selected students, new style ``` gam show guardian|guardians invitations [states ] [invitedguardian ] [formatjson] gam print guardian|guardians [todrive *] invitations [states ] [invitedguardian ] [formatjson [quotechar ]] ``` ### Selected students, old style ``` gam show guardian|guardians invitations [showstudentemails] [states ] [invitedguardian ] [student ] [] [formatjson] gam print guardian|guardians [todrive *] invitations [showstudentemails] [states ] [invitedguardian ] [student ] [] [formatjson [quotechar ]] ``` By default, Gam displays informations for all guardian invitations; you can limit the display with the following options. * `states ` - Display guardian invitations with the specified state * `invitedguardian ` - Display guardians invitations with `` ## Delete guardians ### Selected students, new style ``` gam delete guardian|guardians [accepted|invitations|all] gam clear guardian|guardians [accepted|invitations|all] ``` * `accepted` - Delete accepted invitations * `invitations` - Delete pending invitations * `all` - Delete accepted and pending invitations ### Selected students, old style ``` gam delete guardian|guardians ``` ## Synchronize guardians Gam deletes any pending guardian invitations and accepted guardians that are not in `` and sends invitations to the members in `` that don't have a pending invitation or have not accepted. ``` gam sync guardian|guardians ``` ### Example Your school SIS produces a CSV file, StudentGuardians.csv, each evening with two columns: Student,Guardian. There is no indication as to what changes have been made from the night before. The following command will perform the necessary changes. ``` gam csvkmd users StudentGuardians.csv keyfield Student datafield Guardian sync guardians csvdata Guardian ``` ## Display guardians, indented keys and values ### All students ``` gam show guardian|guardians [accepted|invitations|all] [states ] [invitedguardian ] [showstudentemails] [formatjson] ``` ### Selected students, new style ``` gam show guardian|guardians [accepted|invitations|all] [states ] [invitedguardian ] [formatjson] ``` ### Selected students, old style ``` gam show guardian|guardians [accepted|invitations|all] [invitedguardian ] [states ] [invitedguardian ] [student ] [] [showstudentemails] [formatjson] ``` Use these options to control what information is displayed: * `accepted` - Display accepted guardians; this is the default * `invitations` - Display invitations * `states ` - Filter the invitations by state * `all` - Display accepted guardians and pending invitations * `states ` - Filter the invitations by state By default, Gam displays informations for all guardians; you can limit the display with the following option: * `invitedguardian ` - Display guardians with ``. The Classroom API does not return the student email address, use the `showstudentemails` option to get the student email address. This requires an additional API call per student. By default, Gam displays the information as an indented list of keys and values. * `formatjson` - Display the fields in JSON format. ## Display guardians, CSV format ### All students ``` gam print guardian|guardians [todrive *] [accepted|invitations|all] [states ] [invitedguardian ] [showstudentemails] [formatjson [quotechar ]] ``` ### Selected students, new style ``` gam print guardian|guardians [todrive *] [accepted|invitations|all] [states ] [invitedguardian ] [formatjson [quotechar ]] ``` ### Selected students, old style ``` gam print guardian|guardians [todrive *] [accepted|invitations|all] [states ] [invitedguardian ] [student ] [] [showstudentemails] [formatjson [quotechar ]] ``` Use these options to control what information is displayed: * `accepted` - Display accepted guardians; this is the default * `invitations` - Display invitations * `states ` - Filter the invitations by state * `all` - Display accepted guardians and pending invitations * `states ` - Filter the invitations by state By default, Gam displays informations for all guardians; you can limit the display with the following options. * `invitedguardian ` - Display guardians with ``. The Classroom API does not return the student email address, use the `showstudentemails` option to get the student email address. This requires an additional API call per student. By default, Gam displays the information as columns of fields; the following option causes the output to be in JSON format, * `formatjson` - Display the fields in JSON format. By default, when writing CSV files, Gam uses a quote character of double quote `"`. The quote character is used to enclose columns that contain the quote character itself, the column delimiter (comma by default) and new-line characters. Any quote characters within the column are doubled. When using the `formatjson` option, double quotes are used extensively in the data resulting in hard to read/process output. The `quotechar ` option allows you to choose an alternate quote character, single quote for instance, that makes for readable/processable output. `quotechar` defaults to `gam.cfg/csv_output_quote_char`. When uploading CSV files to Google, double quote `"` should be used.