Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
queryForColorsGet does not work
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dice-K  
View profile  
 More options Nov 28 2011, 12:26 am
From: Dice-K <kgt.dnisi...@gmail.com>
Date: Sun, 27 Nov 2011 21:26:47 -0800 (PST)
Local: Mon, Nov 28 2011 12:26 am
Subject: queryForColorsGet does not work
        GTLQueryCalendar *query = [GTLQueryCalendar queryForColorsGet];
        [service executeQuery:query completionHandler:^(GTLServiceTicket
*ticket, id object, NSError *error) {
                if (error == nil) {
                        NSLog(@"%@", object);
                }
                else {
                        NSLog(@"%@", error);
                }
        }];

It cause Domain=com.google.GTLJSONRPCErrorDomain Code=403 "The
operation couldn’t be completed. (Daily Limit Exceeded. Please sign
up)"

However, the code below works. Why?

        NSURL *url = [NSURL URLWithString:@"https://www.googleapis.com/
calendar/v3/colors?key=MYKEY"];
        NSURLRequest *request = [NSURLRequest requestWithURL:url];
        GTMHTTPFetcherService *fetcherService = [service fetcherService];
        GTMHTTPFetcher *fetcher = [fetcherService
fetcherWithRequest:request];
        [fetcher beginFetchWithCompletionHandler:^(NSData *data, NSError
*error) {
                if (error == nil) {
                        NSString *str = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
                        NSLog(@"%@", str);
                        [str release];
               }
        }];


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Robbins  
View profile  
 More options Nov 28 2011, 12:46 am
From: Greg Robbins <grobb...@google.com>
Date: Sun, 27 Nov 2011 21:46:46 -0800
Local: Mon, Nov 28 2011 12:46 am
Subject: Re: queryForColorsGet does not work

The error "Daily Limit Exceeded" could indicate that the request is not
being authenticated properly. Does the service have the correct authorizer
object for the signed-in user?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dice-K  
View profile  
 More options Nov 28 2011, 1:23 am
From: Dice-K <kgt.dnisi...@gmail.com>
Date: Sun, 27 Nov 2011 22:23:02 -0800 (PST)
Local: Mon, Nov 28 2011 1:23 am
Subject: Re: queryForColorsGet does not work
I maybe have valid auth key, because  second code below return JSON
object of CalendarColors.
I think that if the service has no authorizer object, second code also
fails. Is it right?

On 11月28日, 午後2:46, Greg Robbins <grobb...@google.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Robbins  
View profile  
 More options Nov 28 2011, 1:30 am
From: Greg Robbins <grobb...@google.com>
Date: Sun, 27 Nov 2011 22:30:05 -0800
Local: Mon, Nov 28 2011 1:30 am
Subject: Re: queryForColorsGet does not work

GTLQueryCalendar does not use the REST URL for making requests.

It is not clear from the source code what request headers are in the server
requests in either case.

Try turning on http logging and comparing the requests and responses,
including headers, that are shown in the logs.

http://code.google.com/p/google-api-objectivec-client/wiki/Introducti...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dice-K  
View profile  
 More options Nov 28 2011, 2:30 am
From: Dice-K <kgt.dnisi...@gmail.com>
Date: Sun, 27 Nov 2011 23:30:08 -0800 (PST)
Local: Mon, Nov 28 2011 2:30 am
Subject: Re: queryForColorsGet does not work
Greg,

Thank you for your advice. My service has auth object but fails.
I can get calendars.list and events.list with same service but colors.
Do I have to add some header properties else?

Dice-K

calendar.colors.get

2011-11-28 07:19:46 +0000
Request: POST https://www.googleapis.com/rpc?prettyPrint=false
Request headers:
  Accept: application/json-rpc
  Authorization: Bearer _snip_
  Cache-Control: no-cache
  Content-Type: application/json-rpc; charset=utf-8
  User-Agent: jp.co.cybernet.CSC.GTLCalendar/1.0 google-api-objc-
client/2.0 iPhone_Simulator/5.0 (gzip)

Request body: (100 bytes)
{
  "method" : "calendar.colors.get",
  "id" : "gtl_3",
  "jsonrpc" : "2.0",
  "apiVersion" : "v3"

}

Response: status 200
Response headers:
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Encoding: gzip
  Content-Type: application/json; charset=UTF-8
  Date: Mon, 28 Nov 2011 07:19:46 GMT
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Pragma: no-cache
  Server: GSE
  Transfer-Encoding: Identity
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block

Response body: (256 bytes)
{
  "id" : "gtl_3",
  "error" : {
    "message" : "Daily Limit Exceeded. Please sign up",
    "code" : 403,
    "data" : [
      {
        "domain" : "usageLimits",
        "reason" : "dailyLimitExceededUnreg",
        "extendedHelp" : "https:\/\/code.google.com\/apis\/console",
        "message" : "Daily Limit Exceeded. Please sign up"
      }
    ]
  }

}

On 11月28日, 午後3:30, Greg Robbins <grobb...@google.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Greg Robbins  
View profile  
 More options Nov 28 2011, 2:37 am
From: Greg Robbins <grobb...@google.com>
Date: Sun, 27 Nov 2011 23:37:59 -0800
Local: Mon, Nov 28 2011 2:37 am
Subject: Re: queryForColorsGet does not work

Check the status and quota settings for the specific project's service
entry at http://code.google.com/apis/console/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Phillip Oster  
View profile  
 More options Jan 3 2012, 8:46 pm
From: David Phillip Oster <davidphillipos...@gmail.com>
Date: Tue, 3 Jan 2012 17:46:46 -0800 (PST)
Local: Tues, Jan 3 2012 8:46 pm
Subject: Re: queryForColorsGet does not work
I've hit this same issue, and you, Dice-K, do appear to have solved
it.

You have to use https://code.google.com/apis/console to get an APIKey
for your project. Then, at runtime, you assign to the APIKey property
of the Calendar Service. Once you do that,

  GTLServiceCalendar *service = [self serviceCalendar];
  [service setAPIKey:kMyAPIKey];
  NSURL *url = [NSURL URLWithString:@"https://www.googleapis.com/
calendar/v3/colors"];
  [self addTicket:[service fetchObjectWithURL:url
                                  objectClass:[GTLCalendarColors
class]
                                     delegate:self

didFinishSelector:@selector(ticket:fetchCalendarColors:error:)]];

will call the callback with the calendar colors. This is kind-of
implied by the documentation that says you use the APIKey when making
requests that don't involve user data, and by the error returned by
the server, which asks you to sign in.

But, it is still confusing that some requests need OAuth signing,
while others require an APIKey.

Once you've got the colors, you can turn a color index into an RGB
triplet (as a NSString) like this:
   [[[colors calendar] additionalPropertyForName:@"18"] foreground]

You can get a list of the legal index names using [[colors calendar]
additionalJSONKeys]

That is, a GTLCalendarColors has a set of string-valued property keys
that represent integers, where the value is a
GTLCalendarColorDefinition, which has two properties, foreground, and
background, each of which is a 6 character hex NSString, with a
leading '#'. that represents an R.G.B. triplet.

The sane thing to do is: write a category on GTLCalendarColors that
takes an integer and either kForeground or kBackground, and returns an
NSColor (or UIColor on iOS) else nil.

On Nov 27 2011, 11:30 pm, Dice-K <kgt.dnisi...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Phillip Oster  
View profile  
 More options Jan 5 2012, 5:24 pm
From: David Phillip Oster <davidphillipos...@gmail.com>
Date: Thu, 5 Jan 2012 14:24:48 -0800 (PST)
Local: Thurs, Jan 5 2012 5:24 pm
Subject: Re: queryForColorsGet does not work

Rather than using fetchObjectWithURL: , this is better and also works (now
that I know about the APIKey):
  GTLServiceCalendar *service = [self serviceCalendar];
  GTLQueryCalendar *query = [GTLQueryCalendar queryForColorsGet]; // <--
this
  [self addTicket:[service executeQuery:query
                                  delegate:self

  didFinishSelector:@selector(ticket:fetchCalendarColors:error:)]];


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »