Google APi Bad Request - google-api

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.

Related

404 Property not found key / visibility when using patch request Google Drive api v2

I am using Google Drive API (v2) and used to make successful patch requests as explained here:
https://developers.google.com/drive/v2/reference/properties/patch
in order to add a new metadata property (myNewPr) into my documents.
However, recently (maybe 1-2 days) I started to receive 404 error messages:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Property not found: key = myNewPr and visibility = PRIVATE",
"locationType": "other",
"location": "property"
}
],
"code": 404,
"message": "Property not found: key = myNewPr and visibility = PRIVATE"
}
}
Any ideas ? When I am testing by using insert (https://developers.google.com/drive/v2/reference/properties/insert) it seems to work.

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'])

Getting 403() error while using google Youtube 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

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>

Google calendar api 3 invalid credentials error

I'm trying to access calendar details but I seem to get a invalid credentials error.
I access the following url: "https://www.googleapis.com/calendar/v3/calendars/{google_id}/events"
like this :
DefaultHttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url_);
get.addHeader("Authorization","OAuth" + auth_token);
try {
HttpResponse response = client.execute(get);
What extra headers should I put there? I'm accessing it from an android application. If it matters I got my auth_token by an activity started with AccountManager.newChooseAccountIntent().
I'm getting the following json:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
There should be a space between OAuth and the token in your header.

Resources