How to track user activity data on google docs - google-api

I wonder if it is possible to track user activity data on google docs. My goal is to know what changes the users did (e.g., adding a new paragraph) and when. At the end, I want to visualize the changes made by each user on a document per each day. I could not find a google drive api method. I found Drive Activity API, but not sure if this is what I am looking.
As a backup plan, I am thinking to include the google doc inside an iframe within my web application to store the key strokes. I appreciate any suggestions.

I believe what you are lookging for is revisions.list I am not sure how much of the information you are looking for is actually returned but it does return some information about the changes that where made.
{
"kind": "drive#revisionList",
"nextPageToken": string,
"revisions": [
revisions Resource
]
}
revision
{
"kind": "drive#revision",
"id": string,
"mimeType": string,
"modifiedTime": datetime,
"keepForever": boolean,
"published": boolean,
"publishAuto": boolean,
"publishedOutsideDomain": boolean,
"lastModifyingUser": {
"kind": "drive#user",
"displayName": string,
"photoLink": string,
"me": boolean,
"permissionId": string,
"emailAddress": string
},
"originalFilename": string,
"md5Checksum": string,
"size": long,
"exportLinks": {
(key): string
}
}

Related

Filter events when watch files or drive

I have several questions about google drive events.
The most painful is about filtering events when watching file/drive. Can we do this?
And the thing that makes be confused. When we watch resource we have to provide request body. It looks like this (from doc)
{
"kind": "api#channel",
"id": string,
"resourceId": string,
"resourceUri": string,
"token": string,
"expiration": long,
"type": string,
"address": string,
"payload": boolean,
"params": {
(key): string
}
}
But what do payload and params do? How to use them? I have no idea...

Can I create extended properties in Google People API and Task API?

I have added an extended property to a Google calendar entry and been able to read it back successfully. The format of the json is like this:
"extendedProperties": {
"private": {
"MyPropertyName": "yes"
}
},
I want to do the same thing to created Task entries and contact entries (via the People API). With the People API, trying to create the entry results in http 400. With the Task API, it accepts the json, but the property is not returned when I retrieve the task.
Is it possible to do what I want with the current versions of the People and Task API?
In People API extended properties are called ClientData
The json structure of the resouce is:
{
"metadata": {
object (FieldMetadata)
},
"key": string,
"value": string
}
with FieldMetadata:
{
"primary": boolean,
"sourcePrimary": boolean,
"verified": boolean,
"source": {
object (Source)
}
}

Getting "subject" value of course by API Google Classroom

How can I get or update the "subject" value for a course in the API? I did not find any information on this in the documentation
https://developers.google.com/classroom/reference/rest/v1/courses/get?authuser=1
EDIT
There is a separate subject field when you are filling out a course as R1KO pointed out.
However, as can be seen by the full response of the courses object below, there is no such field in the API.
I have called further endpoints to see if it was buried somewhere else but I cannot find it. Looking on the Issue Tracker however, revealed this Feature Request:
Add Subject to Course
https://issuetracker.google.com/156289085
So it seems like the best thing you can do at this time is to go and click on the ☆ button in that feature to let Google know that you want this feature.
The 'subject' is the 'name' in the API
This is the whole courses object:
{
"id": string,
"name": string,
"section": string,
"descriptionHeading": string,
"description": string,
"room": string,
"ownerId": string,
"creationTime": string,
"updateTime": string,
"enrollmentCode": string,
"courseState": enum (CourseState),
"alternateLink": string,
"teacherGroupEmail": string,
"courseGroupEmail": string,
"teacherFolder": {
object (DriveFolder)
},
"courseMaterialSets": [
{
object (CourseMaterialSet)
}
],
"guardiansEnabled": boolean,
"calendarId": string
}
The description of the name field is as follows:
Name of the course. For example, "10th Grade Biology". The name is required. It must be between 1 and 750 characters and a valid UTF-8 string.
https://developers.google.com/classroom/reference/rest/v1/courses
You can get this with the GET request:
https://developers.google.com/classroom/reference/rest/v1/courses/get
To get all the fields listed above, make sure to include * as the fields parameter.
Update with the UPDATE or PATCH:
https://developers.google.com/classroom/reference/rest/v1/courses/update
https://developers.google.com/classroom/reference/rest/v1/courses/patch

Get the list of action items from Google Drive API

Hi, everyone.
I have been trying to use Google Drive API for getting a list with the action items assigned in all files (docs or spreadsheets) in my company's domain using Spring Boot and the google-api-services-drive, but I have faced some issues:
Looks like there is nothing about action items on the API.
Comments are the closest I could get, but they don't include action item information. They only have the emails of people who were mentioned.
Documentation looks broad and not precise. For instance, here they say files resources include an indexableText property, but it is not present on the response.
As explained in Term for followup, looking for actionitems you can apply a query for getting the files with action items. Why is the fullText field not available in the response, or some other equivalent attribute to see the actual content and use it as a workaround to get the action items?
I just need to know who was assigned to the action item from the comment.
Any ideas?
Retrieve the action items with Comments: list specifying fields as comments/replies/action
I agree with you that it is not straightfoward, but there is a way to retrieve the full comment content including action items.
Use Files:list specifying q as fullText contains 'followup:actionitems', just as in the post you mentioned
For each of the retrieve items, use the fileId for the method Comments: list
For better understadning specify first the fields for Comments:list as * - this will return you the complete reponse looking as following:
{
"kind": "drive#commentList",
"comments": [
{
"kind": "drive#comment",
"id": "AAAAGlyxwAg",
"createdTime": "2020-06-08T09:04:34.907Z",
"modifiedTime": "2020-06-08T09:05:07.279Z",
"author": {
"kind": "drive#user",
"displayName": "XXX",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": true
},
"htmlContent": "+\u003ca href=\"mailto:YYY#YYY.com\" data-rawHref=\"mailto:YYY#YYY.com\" target=\"_blank\"\u003eYYY#YYY.com\u003c/a\u003e Could you please check the spelling?",
"content": "+YYY#YYY.com Could you please check the spelling?",
"deleted": false,
"resolved": true,
"quotedFileContent": {
"mimeType": "text/html",
"value": "Hello"
},
"anchor": "kix.94ksxclyqix",
"replies": [
{
"kind": "drive#reply",
"id": "AAAAGlyxwAo",
"createdTime": "2020-06-08T09:05:02.999Z",
"modifiedTime": "2020-06-08T09:05:02.999Z",
"author": {
"kind": "drive#user",
"displayName": "YYY",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": false
},
"htmlContent": "Will do!",
"content": "Will do!",
"deleted": false
},
{
"kind": "drive#reply",
"id": "AAAAGlyxwAs",
"createdTime": "2020-06-08T09:05:07.279Z",
"modifiedTime": "2020-06-08T09:05:07.279Z",
"author": {
"kind": "drive#user",
"displayName": "YYY",
"photoLink": "//ssl.gstatic.com/s2/profiles/images/silhouette96.png",
"me": false
},
"deleted": false,
"action": "resolve"
}
]
}
]
}
This response contains the following information:
The quoted file content (the text to which the comment refers)
The content of the initial comment and the replies
The user to whom the comment was assigned
The reply of the user including his user name
And finally, the action taked by the user
Now, if you are not interested in all fields but only in the action, you can see that action is a resources nested in comments/replies
To query for action, replace the * in fields with comments/replies/action
as for your question about indexableText, the documentation specifies that it is a property of contentHints and
contentHints
Additional information about the content of the file.
These fields are never populated in responses.
A way to make indexableText "useful" is e.g. apply it in queries like
Files:list with q : fullText contains 'indexableText'
The good new are that if you not happy with the way how actions are retrieved now and can think of a better method to implement it, you can file a Feature request on Google's Public Issue Tracker. If enough users show interest in the feature, Google might implement it in the future.

Ability to CRUD Topic attribute in Google::Apis::ClassroomV1::CourseWork class?

I was wondering if there is a way via the Ruby API doc to modify a Topic for the following class:
Google::Apis::ClassroomV1::CourseWork
Topics were introduced in August 2016 as far as I can tell as a way for teachers to organize their stream:
https://support.google.com/edu/classroom/answer/6149237?hl=en
Does anyone know of a way? I'm okay with making a REST call as well if necessary.
Thanks!
Looking at the JSON response https://developers.google.com/classroom/reference/rest/v1/courses.courseWork.
It doesnt look like they have added the functionality to update a Topic through courses.CourseWork
JSON representation
{
"courseId": string,
"id": string,
"title": string,
"description": string,
"materials": [
{
object(Material)
}
],
"state": enum(CourseWorkState),
"alternateLink": string,
"creationTime": string,
"updateTime": string,
"dueDate": {
object(Date)
},
"dueTime": {
object(TimeOfDay)
},
"maxPoints": number,
"workType": enum(CourseWorkType),
"associatedWithDeveloper": boolean,
"submissionModificationMode": enum(SubmissionModificationMode),
// Union field details can be only one of the following:
"assignment": {
object(Assignment)
},
"multipleChoiceQuestion": {
object(MultipleChoiceQuestion)
},
// End of list of possible types for union field details.
}

Resources