Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6769067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:08:57+00:00 2026-05-26T15:08:57+00:00

When I make an request to the api for getting events from a specific

  • 0

When I make an request to the api for getting events from a specific calender sometimes it get an 302 redirect. The weird things is that this only happens sometimes, often 1 out of 5.

in found this: http://code.google.com/p/googlecl/issues/detail?id=167 apparently it has something to do with http and https.

I’m using oauth with this scope; ‘scope’ => ‘https://www.google.com/calendar/feeds/’ and the website I’m testing on is http and I’m using https api url just like described here: http://code.google.com/apis/calendar/data/2.0/reference.html

This is the response I get:

HttpResponse Object
(
    [body] => 

Moved Temporarily


Moved Temporarily

The document has moved here. [headers] => Array ( [Expires] => Thu, 27 Oct 2011 10:10:02 GMT [Date] => Thu, 27 Oct 2011 10:10:02 GMT [Set-Cookie] => S=calendar=Vi6DcnO0BrcmQr-qJAQj7A;Expires=Fri, 26-Oct-2012 10:10:02 GMT;Secure [Location] => https://www.google.com/calendar/feeds/6okn9orqcq5kgd2ktssvq675k8%40group.calendar.google.com/private/full?alt=jsonc&oauth_consumer_key=paintballboerderij.nl&oauth_nonce=631ebbb152d8f07466fb3f529973b0ce&oauth_signature=VGIfdFlHFOob/TUAO1ArVeeRQ9U%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1319710200&oauth_token=1/EGOUox6t9u1yOZpRXG7FHFfGwP6bRLTZgUjs6dWSTVk&oauth_version=1.0&start-max=2011-11-19T23:59:59&start-min=2011-11-13T00:00:00&gsessionid=Vi6DcnO0BrcmQr-qJAQj7A [Content-Type] => text/html; charset=UTF-8 [Cache-Control] => private, max-age=0 [X-Content-Type-Options] => nosniff [X-Frame-Options] => SAMEORIGIN [X-XSS-Protection] => 1; mode=block [Server] => GSE [Connection] => close ) [cookies] => Array ( [S] => Array ( [value] => calendar=Vi6DcnO0BrcmQr-qJAQj7A [expires] => Fri, 26-Oct-2012 10:10:02 GMT [secure] => 1 ) ) [httpVersion] => HTTP/1.1 [code] => 302 [reasonPhrase] => Moved Temporarily [raw] => HTTP/1.1 302 Moved Temporarily Expires: Thu, 27 Oct 2011 10:10:02 GMT Date: Thu, 27 Oct 2011 10:10:02 GMT Set-Cookie: S=calendar=Vi6DcnO0BrcmQr-qJAQj7A;Expires=Fri, 26-Oct-2012 10:10:02 GMT;Secure Location: https://www.google.com/calendar/feeds/6okn9orqcq5kgd2ktssvq675k8%40group.calendar.google.com/private/full?alt=jsonc&oauth_consumer_key=p***&oauth_nonce=631ebbb152d8f07466fb3f529973b0ce&oauth_signature=VGIfdFlHFOob/TUAO1ArVeeRQ9U%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1319710200&oauth_token=1/EGOUox6t9u1yOZpRXG7FHFfGwP6bRLTZgUjs6dWSTVk&oauth_version=1.0&start-max=2011-11-19T23:59:59&start-min=2011-11-13T00:00:00&gsessionid=Vi6DcnO0BrcmQr-qJAQj7A Content-Type: text/html; charset=UTF-8 Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Connection: close Moved Temporarily

Moved Temporarily

The document has moved here. )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:08:58+00:00Added an answer on May 26, 2026 at 3:08 pm

    I finally know how to do it know. I read this section: http://code.google.com/apis/calendar/data/2.0/developers_guide_protocol.html#RetrievingEvents


    When you send that GET request, Calendar may return an HTTP 302 redirect; the redirect URL has a new query parameter, gsessionid, appended to it. (Note that some methods of sending the GET request may not show you the response headers by default; if you receive a blank response, check your HTTP utility’s documentation to find out how to view response headers.) That gsessionid parameter is the way that Calendar keeps track of your session, to improve speed of response. (Some methods of sending the GET request may automatically follow redirects, and in some cases Calendar may not send a redirect at all; in such cases, you don’t need to send the second request described below.)
    So after you’ve sent the GET request, you have to read the HTTP headers of the response to find the URL with the session ID appended; then you need to send another GET request with that new URL. (Note that if you’re using the UNIX command line to send requests, you may have to precede the question mark in the new URL with a backslash to keep your shell from interpreting it.) In response to the second GET request, Calendar returns an HTTP 200 OK status code and a feed containing all the events in your calendar. If there’s only one event in your calendar, then Calendar returns something similar to the following feed. We’ve edited the following example a little to make it a little more readable by humans; in particular, a real Calendar feed contains actual magic-cookie values and entry IDs.


    So when I make a request to the API I check the response header. If the response code = 302 I catch the value of the gsessionid. Then i make exactly the same request like I did the first time but then with the gsessionid parameter key and value attached. Looks like this is working for me.

    For the poeple who want to see my code, im using PHP with the cakephp 2.0 framework and some oauth class:

                    $consumer   = $this->createConsumer();
                        $response   = $consumer->get(
                            $settings['Setting']['access_token_key'], 
                            $settings['Setting']['access_token_secret'], 
                            $find['Calendar']['eventFeedLink'],
                            array(
                                'alt'       => 'jsonc',
                                'start-min' => $_sunday . 'T00:00:00',
                                'start-max' => $_saturday . 'T23:59:59',
                                //'singleevents'    => false
                            )
                        );
    
                        if($response->code == 302 && isset($response->headers['Location']) && !empty($response->headers['Location'])) {
    
                            $url    = $response->headers['Location']; 
                            $vars = explode('&',$url);
                            foreach($vars as $string){
                                 list($is,$what) = explode('=',$string);
    
                                 if($is == "gsessionid") {
                                     $gsessionid    = $what;
                                     break;
                                 }
                            }
    
                            if(isset($gsessionid) && !empty($gsessionid)) {
    
                                $response   = $consumer->get(
                                    $settings['Setting']['access_token_key'], 
                                    $settings['Setting']['access_token_secret'], 
                                    $find['Calendar']['eventFeedLink'],
                                    array(
                                        'alt'           => 'jsonc',
                                        'start-min'     => $_sunday . 'T00:00:00',
                                        'start-max'     => $_saturday . 'T23:59:59',
                                        'gsessionid'    => $gsessionid
                                        //'singleevents'    => false
                                    )
                                );
    
                            }
    
                        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I make a simple CURL request to that Flickr API that does
I'm trying to make an ajax-request to vimeo to get data from an vimeo
My code is using file_get_contents() to make GET requests to an API endpoint. It
I'm using httplib2 to make a request from my server to another web service.
I'm trying to make an HTTP Get request using JQuery, but I get an
I need to make a request to an API which returns json formatted data.
I need to make a request to an API, using REST (POST method) in
I'm trying to get my head around how I can make json request to
I need to make a synchronous request to the last.fm API, but when I
I'm trying to make a php api request to simply make a simple paste

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.