api-samples
api-samples copied to clipboard
API commentThreads (insert) is not working on client, but works from official code samples
Hi,
no matter what i do, im not able to use the commentThreads API for inserting a new comment on a Video... im always getting this error
An HTTP error 400 occurred:
b'{\n "error": {\n "code": 400,\n "message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the request\'s input is invalid. Check the structure of the \\u003ccode\\u003ecommentThread\\u003c/code\\u003e resource in the request body to ensure that it is valid.",\n "errors": [\n {\n "message": "The API server failed to successfully process the request. While this can be a
transient error, it usually indicates that the request\'s input is invalid. Check the structure of the \\u003ccode\\u003ecommentThread\\u003c/code\\u003e resource in the request body to ensure that it is valid.",\n "domain": "youtube.commentThread",\n "reason": "processingFailure",\n "location": "body",\n "locationType": "other"\n }\n ]\n }\n}\n'
The code used was in python and here is a snippet:
def comment_on_video(youtube, video_id, text):
try:
request = youtube.commentThreads().insert(
part="snippet",
body={
"snippet": {
"videoId": video_id,
"topLevelComment": {
"snippet": {
"textOriginal": text
}
}
}
}
)
comment = request.execute()
return comment
except (HttpError) as e:
print (f"An HTTP error {e.resp.status} occurred:\n{e.content}")
using this same body into https://developers.google.com/youtube/v3/code_samples/code_snippets i get a 200 response.
This makes me think that at least there are no issues with the account or quotas, since every other APIs are working from my client and this one specifically still works but from google code_snippets to try it out.
i have no clue what is happening... if it was a transient error as stated in the error message, i wouldn't be able to call it from google developers code samples.
Can someone please provide help?
Many thanks
@CayoM had you successfully insert comment through commentThread APIs? I'm also facing issues while inserting comment using JAVA
Same Issue Here, my body part is
body=dict( snippet=dict( channelId=channelid, videoId=videoid, topLevelComment=dict( snippet=dict( textOriginal=comment ) ) ) )
same issue here is there any logical reason for this error ?
code : 400 message : The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the request's input is invalid. Check the structure of the <code>commentThread</code> resource in the request body to ensure that it is valid.
Same problem
On Feb 1, 2022 9:23 PM, Nickolay Mozganov @.***> wrote: Same problem
—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.Message ID: @.***>
same problem. Works fine locally but refuses to work on remote server. Any answers?
Also getting this issue on remote but not on local. Also seems to be intermittent and works every so often.
Anyone found a fix for this?
Same here, works locally and on API playground, but not on production server
seems to be intermittent for me as well (on remote server)
Not worked in digital ocean but worked in other server is there anyone can help me ?
@Akash-Asodariya I'm on an EC2 on AWS and it didn't work for me. I'm also usig Cloudfront and a balancer as well.
not working for me either. The same I tried when running from developers.google.com
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://youtube.googleapis.com/youtube/v3/commentThreads?part=snippet&alt=json returned "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the request's input is invalid. Check the structure of the <code>commentThread</code> resource in the request body to ensure that it is valid.". Details: "[{'message': "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the request's input is invalid. Check the structure of the <code>commentThread</code> resource in the request body to ensure that it is valid.", 'domain': 'youtube.commentThread', 'reason': 'processingFailure', 'location': 'body', 'locationType': 'other'}]">