Skip to content

Users Keep

Ross Scroggs edited this page Jul 18, 2021 · 21 revisions

Users - Keep

API documentation

Notes

To use these commands you must add the 'Keep API' to your project and update your service account authorization.

gam update project
gam user [email protected] check serviceaccount

The Keep API does not support note labels and colors.

Definitions

<UserGoogleDoc> ::=
        <EmailAddress> <DriveFileIDEntity>|<DriveFileNameEntity>|(<SharedDriveEntity> <SharedDriveFileNameEntity>)

<NotesName> ::= notes/<String>
<NotesNameList> ::= "<NotesName>(,<NotesName)*"
<NotesNameEntity> ::=
        <NotesNameList> | <FileSelector> | <CSVFileSelector> | <CSVkmdSelector> | <CSVDataSelector>

<NotesField> ::=
        attachments|
        body|
        createtime|
        name|
        permissions|
        title|
        trashed|
        trashtime|
        updatetime
<NotesFieldList> ::= "<NotesField>(,<NotesField>)*"

Keep notes have an ID that is referred to by Google as its name; this is the value you will use wherever <NotesName> is required.

Add Note

gam <UserTypeEntity> create note [title <String>]
        ((text <String>)|
         (textfile <FileName> [charset <CharSet>])|
         (gdoc <UserGoogleDoc>)|
         (json [charset <Charset>] <JSONData>)|(json file <FileName> [charset <Charset>]))
	[copyacls]
        [compact|formatjson|nodetails]

Use the text, textfile and gdoc options to specify the note text.

Use the json option to specify the title and text. The title <String> option takes precedence over the json title.

json {"title": "Note Title", "body": {"text": {"text": "Note Text"}}

If you specify options json and copyacls, the note is created and any ACLs from the json data are added to the note.

By default, Gam displays the created note as an indented list of keys and values; the note text is displayed as individual lines.

  • compact - Display the note text with escaped carriage returns as \r and newlines as \n
  • formatjson - Display the note in JSON format
  • nodetails - Display the note name only

Delete Note

gam <UserTypeEntity> delete note <NoteNameEntity>

Dsiplay Notes

Display selected notes

gam <UserTypeEntity> info note <NotesNameEntity>
        [fields <NotesFieldList>]
        [compact|formatjson]

By default, Gam displays the information as an indented list of keys and values; the note text is displayed as individual lines.

  • compact - Display the note text with escaped carriage returns as \r and newlines as \n
  • formatjson - Display the note in JSON format

Display all notes

gam <UserTypeEntity> show notes
        [fields <NotesFieldList>] [filter <String>]
        [compact|formatjson]

By default, Gam displays the information as an indented list of keys and values; the note text is displayed as individual lines.

  • compact - Display the note text with escaped carriage returns as \r and newlines as \n
  • formatjson - Display the note in JSON format
gam <UserTypeEntity> print notes [todrive <ToDriveAttribute>*]
        [fields <NotesFieldList>] [filter <String>]
        [formatjson [quotechar <Character>]]

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 <Character> 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.

Manage Notes permissions

  • The owner of a note can not have it's role changed.
  • The owner of a note can not be deleted.
  • A new owner can not be added to a note.

Add permissions

gam <UserTypeEntity> create noteacl <NotesNameEntity>
        (user|group <EmailAddress>)+
        (json [charset <Charset>] <JSONData>)|(json file <FileName> [charset <Charset>])

Delete permissions

gam <UserTypeEntity> delete noteacl <NotesNameEntity>
        (user|group <EmailAddress>)+
        (json [charset <Charset>] <JSONData>)|(json file <FileName> [charset <Charset>])

Use the user and group`` options to specify email addresses.

Use the json option to specify permissions.

{"permissions": [{"email": "[email protected]", "name": "notes/abc123xyz/permissions/def456uvw", "role": "WRITER", "user": {"email": "[email protected]"}}]}

## Examples
### Copy notes and permissions from one user to another.

gam redirect csv ./notes.csv user [email protected] print notes formatjson quotechar "'" gam csv ./notes.csv quotechar "'" gam user [email protected] create note json "~JSON" copyacls


### Delete all of a user's notes.

gam redirect csv ./notes.csv user [email protected] print notes fields name gam user [email protected] delete notes csvfile notes.csv:name

Update History

Installation

Configuration

Notes and Information

Definitions

Command Processing

Collections

Client Access

Special Service Account Access

Service Account Access

Clone this wiki locally