Getting 403() error while using google Youtube API - youtube-data-api

I am gating this Error when i use Youtube API
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions.",
"extendedHelp": "https://console.developers.google.com/apis/credentials?project=************"
}
],
"code": 403,
"message": "The request did not specify any referer. Please ensure that the client is sending referer or use the API Console to remove the referer restrictions."
}
}
and 403() error it's showing in console

Related

Get the full list of my own YouTube channel's subscriber

I am trying to get the full list of my own channel's subscribers, but this does not work.
https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=[API_KEY]
I am following the official documentation https://developers.google.com/youtube/v3/docs/subscriptions/list
But get this error
{
"error": {
"code": 401,
"message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
"errors": [
{
"message": "The request uses the \u003ccode\u003emine\u003c/code\u003e parameter but is not properly authorized.",
"domain": "youtube.parameter",
"reason": "authorizationRequired",
"location": "mine",
"locationType": "parameter"
}
]
}
}
Currently you are only using an api key which will only give you access to public data, using mine is private user data and will require authorization.
This can be seen in the documentation page for
Subscriptions: list States
This means that you must be authorized using Oauth2 to access the subscriptions for this channel. You will then have an access token that you can send as an authorization header bearer token.
GET https://youtube.googleapis.com/youtube/v3/subscriptions?part=snippet&mine=true&key=[YOUR_API_KEY] HTTP/1.1
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Accept: application/json

Google APi Bad Request

i try to implement Passes service of Google Api in our website but we always have error 400 problem
we follow this documentation
Giftcardclass: insert
i use postman for test
POST https://www.googleapis.com/walletobjects/v1/giftCardClass
Request body
{
"kind":"walletobjects#loyaltyObject",
"id":"test2.test",
"classId":"test.test",
"version":12,
"state":"active",
"issuername":"dsadasdasdas",
"barcode":{
"kind":"walletobjects#barcode",
"type":"ean13",
"value":"aaaa",
"alternateText":"aaaa"
}
}
jSon response
{ "error": {
"errors": [
{
"domain": "global",
"reason": "invalidArgument",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request" }
}
from the documentation seems that only id,issuerstate and reviewStatus are required.
Looks like your ids are formatted wrongly, it should be issuer_id.unique_id. See https://developers.google.com/pay/passes/rest/v1/giftcardclass#GiftCardClass.FIELDS.id for reference.

WEB_HOOK channel unavailable when trying to retrieve Google calendar events

I'm trying to use Push notifications for Google Calendar
Callback endpoint is hosted on Heroku. appname.herokuapp.com is verified in Search Console and added to Google Console APIs & Services Allowed domains list.
Request
POST /calendar/v3/calendars/CALENDAR_ID/events/watch HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer TOKEN
Content-Type: application/json
{
"id":"1",
"type": "web_hook",
"address":"https://APPNAME.herokuapp.com/change"
}
Response
400 Bad Request
{
"error": {
"errors": [
{
"domain": "push",
"reason": "channelUnknown",
"message": "WEB_HOOK channel unavailable for:
{address=https://APPNAME.herokuapp.com/change}"
}
],
"code": 400,
"message": "WEB_HOOK channel unavailable for: {address=https://APPNAME.herokuapp.com/change}"
}
}
What
WEB_HOOK channel unavailable
error means?
EDIT: same result with a top level domain which certificate's Subject matches exactly the domain name.
It appears that this was a temporary issue and is now fixed according to Google. (I also tested and seems to be working for me, now.)

youtube.liveChatMessages.list API Explorer

I try list messages from LiveChat of YouTube. Request:
GET https://www.googleapis.com/youtube/v3/liveChat/messages?liveChatId=Qfad59EnhUA&part=snippet&key={YOUR_API_KEY}
Response:
404 Not Found
{
"error": {
"errors": [
{
"domain": "youtube.liveChat",
"reason": "liveChatNotFound",
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests <code>liveChatId</code> parameter to ensure that it is correct."
}
],
"code": 404,
"message": "The live chat that you are trying to retrieve cannot be found. Check the value of the requests <code>liveChatId</code> parameter to ensure that it is correct."
}
}
Pages https://www.youtube.com/live_chat?is_popout=1&v=Qfad59EnhUA and
https://www.youtube.com/watch?v=Qfad59EnhUA exist.
What's wrong?
i decide this problem. liveChatId can be get from broadcast for python:
print '%s' % (broadcast['snippet']['liveChatId'])

google enterprise license manager api - Unauthorized operation for the given domain

The LicenseAssignments.get api returns 200 OK
Request:
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/sku/Google-Apps-For-Business/user/<email>
Response:
200 OK
- Show headers -
{
"kind": "licensing#licenseAssignment",
"selfLink": "https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/sku/Google-Apps-For-Business/user/<email>",
"userId": "<email>",
"productId": "Google-Apps",
"skuId": "Google-Apps-For-Business"
}
However LicenseAssignments.listForProduct returns "403 Forbidden"
Request:
GET https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=my_customer
Response:
403 Forbidden
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Unauthorized operation for the given domain."
}
],
"code": 403,
"message": "Unauthorized operation for the given domain."
}
}
Any idea why I get 403 forbidden for the second request?
This issue got resolved when I used 'domain name' (e.g. something.com) as 'customerId'. This is different from the usual behavior of other Google APIs where 'customerId' is 'my_customer'.
https://www.googleapis.com/apps/licensing/v1/product/Google-Apps/users?customerId=<domain name>

Resources