api-samples icon indicating copy to clipboard operation
api-samples copied to clipboard

API commentThreads (insert) is not working on client, but works from official code samples

Open CayoM opened this issue 4 years ago • 13 comments

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 avatar Aug 10 '20 11:08 CayoM

@CayoM had you successfully insert comment through commentThread APIs? I'm also facing issues while inserting comment using JAVA

BhoomiKhan avatar Oct 04 '20 11:10 BhoomiKhan

Same Issue Here, my body part is

body=dict( snippet=dict( channelId=channelid, videoId=videoid, topLevelComment=dict( snippet=dict( textOriginal=comment ) ) ) )

dhnesh12 avatar Nov 25 '20 17:11 dhnesh12

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.

WaelMz avatar Sep 07 '21 14:09 WaelMz

Same problem

nmzgnv avatar Feb 02 '22 05:02 nmzgnv

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: @.***>

Arroyoale89 avatar Feb 02 '22 14:02 Arroyoale89

same problem. Works fine locally but refuses to work on remote server. Any answers?

cozybeatz avatar Mar 26 '22 22:03 cozybeatz

Also getting this issue on remote but not on local. Also seems to be intermittent and works every so often.

GeorgeWillis avatar Mar 29 '22 11:03 GeorgeWillis

Anyone found a fix for this?

GeorgeWillis avatar May 18 '22 14:05 GeorgeWillis

Same here, works locally and on API playground, but not on production server

abetwothree avatar Aug 10 '22 22:08 abetwothree

seems to be intermittent for me as well (on remote server)

khalilsarwari avatar Aug 15 '22 23:08 khalilsarwari

Not worked in digital ocean but worked in other server is there anyone can help me ?

Akash-Asodariya avatar Aug 30 '22 12:08 Akash-Asodariya

@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.

abetwothree avatar Sep 01 '22 04:09 abetwothree

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'}]">

josephlim75 avatar Nov 26 '22 19:11 josephlim75