Cannot delete course Google Classroom API - google-apis-explorer

I'm trying to delete a course using the "TRY THIS API" option in https://developers.google.com/classroom/reference/rest/v1/courses/delete I get the error:
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}

Care should be taken when removing a teacher's account, because, as explained in the official documentation:
Before you remove a teacher's account, confirm that the teacher’s classes are no longer in use by students or co-teachers. Removing a teacher account without transferring ownership limits some class functionality.
Because of this, trying to remove a course owned by a deleted user results in a 500 error, as reported in Issue Tracker.
In normal conditions, as a G Suite admin, you should be able to transfer ownership of the class, but since the class functionality is limited, you might not be able to add a new teacher to transfer ownership to. Because of this, the FAILED_PRECONDITION error you are getting might be due to the course being in a non-modifiable state (here you can see the possible reasons behind FAILED_PRECONDITION).
Reference:
Issue Tracker: 500 Internal Server Error when trying to delete courses created by users that have been deleted
Before you remove a teacher account
Transfer ownership of the class
Request Errors: FAILED_PRECONDITION

Related

Error on using Derivatives API on trial account

Problem
We created an app under an active trial account.
We added this app to the BIM 360.
We use this app properties to access model derivatives.
We get authorization error while accessing the model manifest.
{ "developerMessage":"You are not allowed to use this API because your Forge trial is expired.", "moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/", "errorCode": "ERR-004”}
We call next method
https://developer.api.autodesk.com/modelderivative/v2/designdata/URN/manifest
Why we get message about "trial is expired" if it's not?
Possible reason
Something went wrong during the trial account creation.
If you go to forge.autodesk.com > Forge Account Details > Cloud Credit Balance > Active Trials, you will see progress indicator and no details.
Workaround
Create or use another one account and check Active Trials page. If you can see "days left" and "credits used" info, then everything must be ok.

Error Inserting event on Google Calendar (GSUITE): Read timed out

We have an error trying to insert an event on a Google Calendar affecting diferents GSUITE basic accounts.
We are using a ServiceAccount to create the credential for the connection, and this is working fine, we can read, insert or delete events on each Calendar account.
The problem started from two days ago when the code reach this point, it doesnt receive a response.
event = service.events().insert(calendarId, event).setSendNotifications(sendNotificationMail).execute()
We have tried to increment the connection and request timeout like this example (unsuccessfully):
https://developers.google.com/api-client-library/java/google-api-java-client/errors
After increment request timeout more than 60sec, we had this response:
503 Service Unavailable
{
"code" : 503,
"errors" : [ {
"domain" : "global",
"message" : "The service is currently unavailable.",
"reason" : "backendError"
} ],
"message" : "The service is currently unavailable.",
"status" : "UNAVAILABLE"
}
We have more than 20 accounts inserting events successfully, and start appearing only in few accounts, but we are afraid that it will expand.
The accounts doesn't have reach any limit of usage(an affected account only inserted 5 events).
If you can help me I would be very grateful.
Thank you
As mentioned above, using a service account for the Calendar API recently leads to errors, especially when sending notifications and creating events with invitees in general
Whilst the corresponding requests usually results in 403 errors and 503 errors are more often due to user errors or temporarily issues, I recommend you to adjust to the current workaround and use service accounts for the Calendar API only in conjunction with impersonation.
That is, enable in the Admin console domain-wide delegation, provide the necessary scope and implement in your code that the serviec account shall act on behalf of a domain user (e.g. the admin). This is the recommended procedure described in the documentaiton for Calendar API.

How to configure permission to assign course in moodle API?

In moodle 3.6 the enrol_manual_enrol_user does not work every time!
{
"exception": "moodle_exception",
"errorcode": "wsusercannotassign",
"message": "You don't have the permission to assign this role (383) to this user (2) in this course(28)."
}
I fell in the same error message.
If someone faced it, the permission to give to your integration user is:
moodle/role:assign
That solve the "wsusercannotassign" problem.
It took me two days to find a way to solve this problem.
In my case the web service user had all required privileges to enroll a user. The confusing thing was that the same web service user was able to create a new moodle user via the API.
After checking all those role specific right ("allow roles assignments", "allow role overrides", "allow role switches") multiple times I found one relevant hint in a tutorial: the user who wants to enroll another user to a course has to be member of this course (?!?).
So I put my web service user to each course I have and gave him in addition the "trainer"-role. And now enrollment works even via the API.

How can I create a Google Classroom as an admin for another teacher using Google App Scripts?

I am trying to create Google Classrooms programmatically for teachers. My code works fine as long as the "owner" is me, but when I use another teacher id, I am not authorized to perform the action. I am an administrator.
I have turned on the proper Advanced Services and have found many examples that are similar but don't have the full info. I believe I have properly set up the various authentication/OAUTH in the developers console.
function testCreate() {
var newClass = Classroom.Courses.create({
"name": 'Test Course',
"section": 'Advisory',
"descriptionHeading": 'This is your advisory group',
"ownerId": [someoneElsesId]
"guardiansEnabled": true
});
If [someoneElsesId] is "me" or my id, the behavior is exactly what I want. I get a provisioned classroom added to my account that I have to ACCEPT or DECLINE, that was created by an administrator.
When I use another user's id, I receive the following error:
API call to classroom.courses.create failed with error: The caller does not have permission
I've also tried to create the classroom as me (succeeds) then add a teacher with script (gets the same error).
It turns out that being an admin isn't good enough. In order to make this work, the script user must be running as a SuperAdmin. After that change was made the code worked properly.

Box Api : Adding User Group as Collaborator return 403 Forbidden

I am trying to add collaborators through Box API, but when I am adding a user group, the api request return status 403: Forbidden.
Here is the request attributes i'm passing:
{"item": { "id": "3907701373", "type": "folder"}, "accessible_by": {"id": "400235","type":"group"}, "role": "viewer"}
And it returns me this error:
Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."
The documentation for Create Collaboration states that:
Errors may occur if the IDs are invalid or if the user does not have permissions to create a collaboration.
Are you able to create a collaboration with a regular user on that folder?
Follow-Up
I think the problem could be due to one, or possibly both, of the following:
Box recently introduced the Group Admin, which has permissions to "add existing users to their groups, create new users that will be assigned to their groups, and assign folder access to their groups." You may need to have those permissions in order to manage group collaborations.
Your may need to enable the Manage an Enterprise scope for your application, under OAuth2 Parameters > Scopes. If (1) above is true then your app most likely requires elevated, enterprise privileges.