500 Internal Server Error when trying to delete certain courses - google-classroom

Example:
Courses.Get successfully gets the course like this:
Request
GET https://classroom.googleapis.com/v1/courses/1053592526?key={YOUR_API_KEY}
Response
200
- HIDE HEADERS -
cache-control: private
content-encoding: gzip
content-length: 232
content-type: application/json; charset=UTF-8
date: Wed, 27 Apr 2016 11:45:29 GMT
server: ESF
vary: Origin, X-Origin, Referer
{
"id": "1053592526",
"name": "Test course 18",
"ownerId": "118150671162893595524",
"creationTime": "2016-03-11T12:49:19.459Z",
"updateTime": "2016-03-11T12:49:18.734Z",
"enrollmentCode": "aaiauvf",
"courseState": "ACTIVE",
"alternateLink": "http://classroom.google.com/c/MTA1MzU5MjUyNlpa"
}
Deleting it however gives the following:
Request
DELETE https://classroom.googleapis.com/v1/courses/1053592526?key={YOUR_API_KEY}
Response
500
- HIDE HEADERS -
cache-control: private
content-encoding: gzip
content-length: 104
content-type: application/json; charset=UTF-8
date: Wed, 27 Apr 2016 11:47:21 GMT
server: ESF
vary: Origin, X-Origin, Referer
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
Result is the same through code or through the web interface at https://developers.google.com/classroom/reference/rest/v1/courses/delete?authuser=0#try-it
This seems to happen if the user behind the OwnerId no longer exists. It only happens to some old courses that have been lying around for some time, and the owner have been deleted long ago. I also tried adding a teacher to the course, but the result is still the same. I did also try to create a new course with an ownerId referencing an existing user, deleting the user and finally deleting the course. Works.
There are 20 something courses on the domain that this happens for. I was able to delete another 50 something courses where the owning users still existed.
So, is this a bug that we can have fixed? And if not, how do I get rid of the courses?

It looks like this is a bug. Can you please file an issue for it?

Related

Email rejected by the Gmail API because of To header

I'm trying to send a simple email via the Gmail API that's failing because of the RFC822-compliant To: undisclosed-recipients:; header. Sending with a regular address in the To header works fine. The RFC822 message is created by PHPMailer and recovered using preSend() and getSentMIMEMessage().
What am I doing wrong?
The message
Date: Tue, 21 Sep 2021 09:13:17 +0000
From: Rec1 <fictive1#gmail.com>
Cc: "Rec2 (fictive2#gmail.com)" <fictive2#gmail.com>
Bcc: fictive3#gmail.com
Message-ID: <vysFE9wLykAQc73VcxjiTfjPaZQJ5ge7jXqWbNeg#vps>
X-Mailer: PHPMailer 6.5.1 (https://github.com/PHPMailer/PHPMailer)
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="b1_vysFE9wLykAQc73VcxjiTfjPaZQJ5ge7jXqWbNeg"
Content-Transfer-Encoding: 8bit
To: undisclosed-recipients:;
Subject: test
This is a multi-part message in MIME format.
--b1_vysFE9wLykAQc73VcxjiTfjPaZQJ5ge7jXqWbNeg
Content-Type: text/plain; charset=us-ascii
body
--b1_vysFE9wLykAQc73VcxjiTfjPaZQJ5ge7jXqWbNeg
Content-Type: text/html; charset=us-ascii
<div dir="ltr">body</div>
--b1_vysFE9wLykAQc73VcxjiTfjPaZQJ5ge7jXqWbNeg--
The answer
{
"error": {
"code": 400,
"message": "Invalid To header",
"errors": [
{
"message": "Invalid To header",
"domain": "global",
"reason": "invalidArgument"
}
],
"status": "INVALID_ARGUMENT"
}
}
Try manually adding undisclosed-recipients:; then add bcc.
$mail->AddAddress("undisclosed-recipients:;");
$mail->AddBCC("username#domain.com");
Worked on this post:
Sending mail with Phpmailer, BCC only, hiding TO header field
You have different issues but it might also solve the issue regarding invalid to header if set manually.

Comment on a post using linkedin api returns 403 Although i have all permissions required

i am trying to comment on a post using SocailActions Api
i am using the following permissions w_organization_social r_organization_social w_member_social
and i am logged in as a an admin of the page that i am trying to comment on its behalf
my request is :
POST https://api.linkedin.com/v2/socialActions/urn%3Ali%3Ashare%3AXXXXXXXXXX/comments HTTP/1.1
Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXX
Host: api.linkedin.com
cache-control: no-cache,
X-Restli-Protocol-Version: 2.0.0
Accept: application/json
Content-Type: application/json
Content-Length: 136
{
"actor":"urn:li:organization:23741470",
"object" :"urn:Al:share:6664163994204549120",
"message":{
"text":"tessst"
}
}
and i am getting 403
{
"serviceErrorCode": 100,
"message": "Field Value validation failed in REQUEST_BODY: Data Processing Exception while processing fields [/actor]",
"status": 403
}
the same thing happened when i tried to use the ugcPost Api to post an new comment
any ideas what might cause this ?
i was able to solve this finally, i remove all header property except the content type and content length then it worked

APIGILITY + Doctrine: cannot find entities = "No result was found for query although at least one row was expected"

I have a service, doctrine related, completely created by Apigility, with no modifications what so ever. The code was never modified, it works just as Apigility created it.
When requesting a collection:
myapi.local/path
{
"count": 25,
"total": 13562,
"collectionTotal": 13562,
"_links":
{ ... more stuff here
},
"_embedded":
{
"path":
[
{
"pathid": 1,
"dev": 51729,
"inode": "2",
"path": "/disk1",
"online": true,
"fileid": "0",
"_links":
{
"self":
{
"href": "http://imageadministration.local/path/1"
}
}
},
... and so on
When requesting that very same entity myapi.local/path/1:
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Not Found",
"status": 404,
"detail": "Entity was not found"
}
Response headers:
Status Code: 404 Not Found
Access-Control-Allow-Headers: Authorization, Origin, Content-Type, Accept
Access-Control-Allow-Methods: PUT, GET, POST, PATCH, DELETE
Connection: Keep-Alive
Content-Type: application/problem+json
Date: Fri, 08 Apr 2016 08:40:35 GMT
Keep-Alive: timeout=5, max=100
Server: Apache/2.4.10 (Debian)
Transfer-Encoding: chunked
X-Powered-By: PHP/5.6.17
access-control-allow-origin: *
Debuging the code step by step, I could find a "No result was found for query although at least one row was expected". This message is inside a Doctrine object and never gets back to the user. No PHP erros, no exceptions, nothing. Indeed, the registry can be found in the DB with a simple select.
The error message itself is explained in other posts, but since this service is 100% created by Apigility and the exception ocurs inside the Doctrine module and there is not a single line of code of my own, I don´t even know where to start. Entity has no relations and it was automatically created by Doctrine via orm-module.
Any direction will be much appreciated, czr.
SOLVED: it happened to be a very strange encoding error with üäö. when removed, it went back to normal. Unfortunately is still don´t know why.

How to validate response with dredd?

I'm trying to check my api implementation with my documentation written in blueprint. I've expected that dredd will fail when json returned from server will be different than specified in documentation. To check this I've copied dredd-example. First I've run dredd with original apib file to make sure that all is green. Then I've modified response in documentation and expected dredd to show me some red... But it doesn't.... it looks like tool is only checking response headers but not the response body. Here is output from console:
pass: GET /machines duration: 18ms
request:
host: localhost
port: 3000
path: /machines
method: GET
headers:
User-Agent: Dredd/0.2.1 (Darwin 13.0.0; x64)
expected:
headers:
Content-Type: application/json
body:
[
{
"_id": "52341870ed55224b15ff07ef",
"type": "bulldozer",
"name": "willyxxxxxx" #HERE IS WHERE I CHANGED RESPONSE IN DOCUMENTATION
}
]
status: 200
actual:
headers:
x-powered-by: Express
content-type: application/json
content-length: 95
date: Thu, 20 Mar 2014 08:22:40 GMT
connection: keep-alive
body:
[
{
"_id": "532aa5507dcdfff362931799",
"type": "bulldozer",
"name": "willy"
}
]
status: 200
Can I check response body using dredd? And how can I do this?
In JSON bodies Dredd is checking only for keys not for values. When you change key in the expected JSON body document, it will definitely fails.

Blogger API suddenly giving Insufficient Permission error

I've been publishing posts to Blogger blogs for a while now with the v3 API. Suddenly, this morning I'm getting 403 "Insufficient Permission" errors when I try to insert posts. To make sure it wasn't something in my code, I tried inserting a post with the API Explorer. I authorized the request with the provided scope (https://www.googleapis.com/auth/blogger) and tried to insert the following post resource:
{
"kind": "blogger#post",
"blog": {
"id": "xxxxxxxx"
},
"title": "Test Post",
"content": "This is a test post"
}
And when I tried to execute the request, I got the following error:
403 Forbidden
- Hide headers -
cache-control: private, max-age=0
content-encoding: gzip
content-length: 136
content-type: application/json; charset=UTF-8
date: Wed, 11 Sep 2013 18:18:21 GMT
expires: Wed, 11 Sep 2013 18:18:21 GMT
server: GSE
www-authenticate: Bearer realm="https://www.google.com/accounts/AuthSubRequest", error=insufficient_scope, scope="https://www.googleapis.com/auth/blogger"
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientPermissions",
"message": "Insufficient Permission"
}
],
"code": 403,
"message": "Insufficient Permission"
}
}
Anyone know why this is suddenly not working today? Thanks!
Looks like this was a Blogger issue. The problem has been resolved on their side and my app works fine again.
I have this problem as well, to be honest I am glad that I am not the only one having this problem! This error also occurs if you try to do things via the Oauth playground, for me it was getting a list of the users blogs.

Resources