go - Youtube Content ID API always return Not Found -
my account connected cms can't see youtube content id in api library. however, see in enabled apis!! (it appeared after try "authorize requests using oauth 2.0" in youtube content id api reference doc). can test api in reference doc , shows data cms. when call api program, response this:
{ "error": { "errors": [ { "domain": "global", "reason": "notfound", "message": "not found" } ], "code": 404, "message": "not found" } }
this implementation using go:
func testyoutubeapi(w http.responsewriter, r *http.request) { data, err := ioutil.readfile("./google-service-key.json") if err != nil { log.fatal(err) } config, err := google.jwtconfigfromjson(data, "https://www.googleapis.com/auth/youtubepartner", "https://www.googleapis.com/auth/youtube.force-ssl", "https://www.googleapis.com/auth/youtube") if err != nil { log.fatal(err) } client := config.client(oauth2.nocontext) request, _ := http.newrequest("get", "https://www.googleapis.com/youtube/partner/v1/assetsearch", nil) request.header.add("accept", "application/json") query := request.url.query() query.add("createdafter","2015-01-29t23:00:00z") query.add("key", "xxx") request.url.rawquery = query.encode() response, err := client.do(request) if err != nil { fmt.fprintln(w, err) } else { responsebody, _ := ioutil.readall(response.body) fmt.println(response.status) fmt.fprintln(w, string(responsebody)) } }
other apis (youtube data api) work fine code. however, can't expected result youtube content id api.
anyone got experience in please me. thank you.
i found answer!
because used google service account interact google api. seems create new user account. have grant permission on youtube cms adding service account client email youtube cms. finally, can access youtube cms using api.