I am aware that there are multiple questions essentially asking the same thing, but part of the problem I've identified is a lack of detail in the questions, so I'm going to try here, since I think I've exhausted all possibilities.
In the newer Google Classroom, there is a Classwork Tab/Page. This is new, and replaced an older "About" page. In this page, as a regular web user, you can create various materials, including one simply called "Material." This is done by clicking the create button and choosing "Material".
These materials contain any combination of title, description, and attached files/links.
However, when using the API, while I can access any OTHER type of Classwork via:
Classroom.Courses.CourseWork, no attempts to find these items (or create them via the API) has been successful. I've successfully created Assignments (a variant of CourseWork using:
Classroom.Courses.CourseWork.create({
"creatorUserId":'me',
"state":'draft',
"courseId":cid,
"title":'test item',
"workType":"ASSIGNMENT",
"materials": [],
}, 'myClassCode');
}
The enum for workType according to the API only contains:
I've tried omitting the workType (receive error saying I need to include it), using various guesses like MATERIAL, NONE, ABOUT, and null (all receive errors for invalid types).
I can query the list of CourseWork and find all of my entries that are questions or assignments but have found no access to the other items, which are current and active in the Classwork page for the class.
It's possible that this simply isn't accessible via the API, but I'd like to confirm. Any advice would be appreciated.
I am running as SuperUser and everything else seems to be working fine.
You are right, at the moment it is not possible to create course materials through Google Classroom API.
Indeed, there is a feature request for it already:
https://issuetracker.google.com/issues/127591179
I suggest you to give it a star to increase visibility and get updates on the implementation status of the feature.
Here is code that I have been using
/------------------------------Create Coursework Material-----------------------------------
function createCourseworkMaterial (id, cTitle, cDescription, topicId) {
var courseArgs = {
"title": cTitle,
"description": cDescription,
"state" : "DRAFT",
"topicId": topicId
};
try{
Classroom.Courses.CourseWorkMaterials.create(courseArgs,id);
}catch(e){
console.error('Classroom.Courses.CourseWorkMaterial.create() yielded an error: ' + e);
}
}
Related
I have a google form with some questions like:
This field is set as required. The problem is that I cannot see the results of this field in the corresponding spreadsheet:
I have a trigger to run a function (from the spreadsheet code editor) when an answer is sent from the form:
And this is the function triggered:
function copyFormContents(e) {
Logger.log(JSON.stringify(e))
}
And this is what I see in the log:
{
"authMode": "FULL",
"namedValues": {
"My Question": [
"",
"Another answer"
]
},
/ ******* /
}
As you can see, My Question appears with two entries, and sometimes empty. I have tried by switching the question to required and not, but this keeps happening. What am I doing wrong? Please help
According to Victor M Herasme Perez it looks like the problem was solved by creating a new form and linking a new sheet to save the responses given the fact that deleting some questions was the actual root cause of the sheet showing incct data.
This is actually a common behavior that has appeared multiple times in different forums like in Google's community.
There is no official documentation about this specific issue even though it is something expected as you can see in the explanation from the product expert in Google's community post.
As a recommendation I think it would be best to add this behavior to Google's issue tracker for evaluation.
I am unable to change grades using the Google Classroom API. When I run the code below, lines 2 and 3 run fine. However, line 4 fails with the following message: #ProjectPermissionDenied The Developer Console project is not permitted to make this request.
1) var studentSubmission = {'assignedGrade':'1'};
2) var studentSubmissions = Classroom.Courses.CourseWork.StudentSubmissions.list(courseId, courseWorkId, {userId:'studentEmail#apps.matsuk12.us'});
3) var studentAssignmentId = studentSubmissions['studentSubmissions'][0].id;
4) Classroom.Courses.CourseWork.StudentSubmissions.patch(studentSubmission, courseId, courseWorkId, studentAssignmentId,{'updateMask':'assignedGrade'});
When I go to Project Properties and look at the scopes, here is what I see:
https://www.googleapis.com/auth/classroom.courses
https://www.googleapis.com/auth/classroom.coursework.students
https://www.googleapis.com/auth/classroom.profile.emails
https://www.googleapis.com/auth/classroom.profile.photos
https://www.googleapis.com/auth/classroom.rosters
https://www.googleapis.com/auth/spreadsheets
I am trying to access my own Google Classroom using a container bound script (spreadsheet). Seems like if I have access to the assignments, I should have access to add a grade. Not sure why I can't add the grade. Is there anything I can do to get this code working? The end goal is to be able to grade assignments using a form (not a google form) and have the score automatically pushed to Google Classroom.
I saw a related post that mentions a solution, but it is not clear how to implement it: Permission denied using Classroom.Courses.CourseWork.StudentSubmissions.list(4140802199, 4801051201);
I also see a related bug report here: https://issuetracker.google.com/issues/67748271 (I'm not sure though if this really is a bug, or if this is just how the Google Classroom API works, or if I'm just doing something wrong)
From the posts you linked someone posted this code:
function createCoursework (id) {
Classroom.Courses.CourseWork
.create(id, {
// doesn't work but triggers permissions correctly "courseId": id, "title": 'foo', "description": 'desc', });
}
Essentially you need to put this code somewhere in your projects code. Then, using the, Run menu, execute that function. It won't do anything, but it will initialize the authorization request from google; by means of a popup. After that you should be good to delete that function and use that scope.
I got problem with shopify API and with data it provides. When i try to get list of all meta-fields with my app I end up with invalid data that tell all meta-fields are owned by shop (owner_id, owner_resource in JSON result). In shop I work with there is over 2000 meta-fields, created mostly by installed apps, that most certainly belong directly to resources like page, blog or product and most of them are most certain not associated directly with shop.
What is more strange when i use chrome plugins or free shopify app to edit meta-fields, that in data i recieve present as associated with shop, they are displayed as belonging to particular aspects of shop as it should be. Adding or deleting meta-field does not reflect on the data or count of meta-fields I get in way explained below.
So what I do first is getting count of metafields with following request, to later know how split data requests into pages.
/admin/metafields/count.json
then to get complete set of data i make series of requests like this
/admin/metafields.json?limit=200&page=1
...
As result i get (example data)
{ "id": 2488777, "namespace": "content_value", "key": "[default]3883205", "value": "There are no items in your cart. ", "value_type": "string", "description": "", "owner_id": 2174481, "created_at": "2014-12-30T20:23:56+01:00", "updated_at": "2014-12-30T20:33:56+01:00", "owner_resource": "shop" }
So my question is what wrong I do here making these requests and why i get invalid data, or it is maybe another "shopify thing" to get such behaviour. Can someone direct me how to get full valid list of meta-fields with rightfully associated owners? Is there any caching involved with metafields that could cause lack of update?
When you make a call to /admin/metafields.json without any query parameters then you will see the metafields that belong to the shop.
You can retrieve metafields that belong to another resource by making an authenticated GET request to a URL like this one: /admin/orders/3250063171/metafields.json
An alternate format for the URL is this: /admin/metafields.json?metafield[owner_id]=3250063171&metafield[owner_resource]=order
I have two projects linked to one clientID. Project "A" is in sandbox, the "B" one is confirmed. I was calling feed with this type of URL
https://api.instagram.com/v1/users/[userID]/media/recent/?client_id=[clientID]&count=20&access_token=[mySecretToken]
The problem is, that with this type of URL I can retrieve data only for project A. For confirmed project B I always get an error
{"meta": {"error_type": "APINotFoundError", "code": 400, "error_message": "this user does not exist"}}
I'm following the documentation ( https://www.instagram.com/developer/endpoints/users/#get_users_media_recent ) but this absolutely doesn't work outside the sandbox!
In another part of documentation I have found this:
For example, if you query the /users/{user-id}/ endpoint and the {user-id} is a sandbox user, then you will get the normal API response; but if the {user-id} is not a sandbox user, you will get a APINotFound error.
That's really useful information, but I really can' find a way, how can I retrieve data from confirmed (live, reviewed) project.
Can plz anyone help how can I do it?
In Box API v1, it was possible to request creation of a shared link for a file or folder, without caring about what kind of sharing was required. In fact, it was not possible to ask for a particular type of share - you just used the public_share method and passed in the target type (file/folder) and target ID, and optionally a share password. In an Enterprise Account, for instance, this might result in the maximum access level being "company" or "collaborators", if public links are disallowed.
With Box API v2, according to the docs here, you need to specify an access parameter that has to be "open", "company", or "collaborators".
The problem is, using the wrong type may cause the share to fail. For instance, in a folder/account that only allows collaborators, I get a 400 error if I ask for a "open" share.
What I really want is to get exactly the same result as if the user clicked the "Share" link in the Box web site. Which is, it should enable sharing for the file but default the level appropriately.
Is there a way to do this with v2, without the admin having to tell us their "preferred" access level for shared links we create? I'm using the Java SDK, like this:
BoxItemRequestObject req = BoxItemRequestObject.createSharedLinkRequestObject(BoxSharedLinkRequestObject.createSharedLinkRequestObject("open"));
BoxItem item = itemsManager.createSharedLink(<ID>, req, BoxResourceType.FILE);
Thanks,
Ben Gilbert
Smartsheet.com
Just set the access to the empty set {}
So your request would look like this:
{"shared_link": {}}
I figured out how to make this work. I need to set access to null when creating the BoxSharedLinkRequestObject, like this:**
BoxItemRequestObject req = BoxItemRequestObject.createSharedLinkRequestObject(BoxSharedLinkRequestObject.createSharedLinkRequestObject(null));
This doesn't produce quite the same JSON as was recommended (shared_link: {}), but it does produce JSON that is apparently equivalent: shared_link: { access: null }. I couldn't figure out any way to produce an empty shared_link object using the SDK -- I either had to have a null shared_link (which didn't work at all) or some value for the access field.