Discussion:
[Contacts API] can't delete PHOTO
(too old to reply)
D2
2009-04-14 12:42:53 UTC
Permalink
HTTP - HEADER

"Host: www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"


URL : http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc085c?v=2

I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from "rel#photo".

when i proccess this, I get http_response 200. But image remains as it
is.

Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Julian (Google)
2009-04-15 13:23:18 UTC
Permalink
Hi,

You could try to do a HTTP DELETE like the following sample, using the
Contact Photo Link and any ETag (or an specific one if necessary):

DELETE http://www.google.com/m8/feeds/photos/media/user%40domain.com/1
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2


-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
URL :  http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc...
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from "rel#photo".
when i proccess this, I get http_response 200. But image remains as it
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Devang Parekh
2009-04-15 13:49:46 UTC
Permalink
hi julian...
Thanks for reply but there is no change. Image is still there.


$url = http://www.google.com/m8/feeds/photos/media/user%40domain.com
/44e1ab3c8d376df3?v=2

$header[] = "Authorization: AuthSub token=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$header[] = "X-HTTP-Method-Override: DELETE";
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);


This is my actual code. Reply soon plz..
Post by Julian (Google)
Hi,
You could try to do a HTTP DELETE like the following sample, using the
DELETE http://www.google.com/m8/feeds/photos/media/user%40domain.com/1
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2
-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc...
Post by D2
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from "rel#photo".
when i proccess this, I get http_response 200. But image remains as it
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Julian (Google)
2009-04-15 14:56:02 UTC
Permalink
Hi,

This should work for ClientLogin, change Authorization: AuthSub
token="yourAuthToken" if you want to use AuthSub.

<?php

$url = "http://www.google.com/m8/feeds/photos/media/user%40domain.com/
1"; # 1 is a CONTACT-ID
$authToken = "DQ...";

$header[] = "Authorization: GoogleLogin auth=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

$output = curl_exec($ch);
$info = curl_getinfo($ch);

print_r( $info ); # you should get a http_code 200

?>

--Julian
Post by Devang Parekh
hi julian...
Thanks for reply but there is no change. Image is still there.
$url =http://www.google.com/m8/feeds/photos/media/user%40domain.com/44e1ab3...
$header[] = "Authorization: AuthSub token=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$header[] = "X-HTTP-Method-Override: DELETE";
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
This is my actual code. Reply soon plz..
Post by Julian (Google)
Hi,
You could try to do a HTTP DELETE like the following sample, using the
DELETEhttp://www.google.com/m8/feeds/photos/media/user%40domain.com/1
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2
-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc...
Post by D2
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from "rel#photo".
when i proccess this, I get http_response 200. But image remains as it
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Devang Parekh
2009-04-15 15:24:48 UTC
Permalink
hi julian, I try as you suggest but now http_code is 401. can i use my
authSubToken as GoogleLogin authToken?? means i am using token that never
expires & you are suggesting token i.e. available by providing userName &
p/w. Can this be a reason for 401??
Post by Julian (Google)
Hi,
This should work for ClientLogin, change Authorization: AuthSub
token="yourAuthToken" if you want to use AuthSub.
<?php
$url = "http://www.google.com/m8/feeds/photos/media/user%40domain.com/
1"; # 1 is a CONTACT-ID
$authToken = "DQ...";
$header[] = "Authorization: GoogleLogin auth=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
print_r( $info ); # you should get a http_code 200
?>
--Julian
Post by Devang Parekh
hi julian...
Thanks for reply but there is no change. Image is still there.
$url =
http://www.google.com/m8/feeds/photos/media/user%40domain.com/44e1ab3...
Post by Devang Parekh
$header[] = "Authorization: AuthSub token=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$header[] = "X-HTTP-Method-Override: DELETE";
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
This is my actual code. Reply soon plz..
Post by Julian (Google)
Hi,
You could try to do a HTTP DELETE like the following sample, using the
DELETEhttp://www.google.com/m8/feeds/photos/media/user%40domain.com/1
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2
-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc.
..
Post by Devang Parekh
Post by Julian (Google)
Post by D2
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from "rel#photo".
when i proccess this, I get http_response 200. But image remains as
it
Post by Devang Parekh
Post by Julian (Google)
Post by D2
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Julian (Google)
2009-04-15 16:29:39 UTC
Permalink
Hi,

You cannot use the AuthSub Token for Client Login.

For AuthSub, make sure you have the scope and the hd parameter setup
correctly. The scope should be: http://www.google.com/m8/feeds/contacts/
and the hd parameter should be your domain if it is different than
gmail.com. You can find more information:
http://code.google.com/apis/accounts/docs/AuthSub.html#AuthSub

--Julian
Post by Devang Parekh
hi julian, I try as you suggest but now http_code is 401. can i use my
authSubToken as GoogleLogin authToken?? means i am using token that never
expires & you are suggesting token i.e. available by providing userName &
p/w. Can this be a reason for 401??
Post by Julian (Google)
Hi,
This should work for ClientLogin, change Authorization: AuthSub
token="yourAuthToken" if you want to use AuthSub.
<?php
$url = "http://www.google.com/m8/feeds/photos/media/user%40domain.com/
1"; # 1 is a CONTACT-ID
$authToken = "DQ...";
$header[] = "Authorization: GoogleLogin auth=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
print_r( $info ); # you should get a http_code 200
?>
--Julian
Post by Devang Parekh
hi julian...
Thanks for reply but there is no change. Image is still there.
$url =
http://www.google.com/m8/feeds/photos/media/user%40domain.com/44e1ab3...
Post by Devang Parekh
$header[] = "Authorization: AuthSub token=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$header[] = "X-HTTP-Method-Override: DELETE";
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
This is my actual code. Reply soon plz..
Post by Julian (Google)
Hi,
You could try to do a HTTP DELETE like the following sample, using the
DELETEhttp://www.google.com/m8/feeds/photos/media/user%40domain.com/1
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2
-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc.
..
Post by Devang Parekh
Post by Julian (Google)
Post by D2
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from "rel#photo".
when i proccess this, I get http_response 200. But image remains as
it
Post by Devang Parekh
Post by Julian (Google)
Post by D2
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Devang Parekh
2009-04-16 09:43:17 UTC
Permalink
hi julian..
I am seeing only ClientLogin token in every example of delete contact's
photo. Can't this possible with authSubToken??& bye the way. I just try Zend
GData framework to check photo deletion. But no effect of it also.
StatusCode 200 & image remains as it is. below is my code. here i have ussed
clientLogin token.

require_once '../Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata');
$client = Zend_Gdata_ClientLogin::getHttpClient("***@gmail.com","password",
"cp");
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('
http://www.google.com/m8/feeds/contacts/default/full');
$query->setMaxResults(100);
$feed = $gdata->getFeed($query);
$token = $client->getClientLoginToken();
foreach ($feed as $entry)
{
foreach($entry->link as $link)
{
if(ereg("rel#edit-photo",$link->rel))
{
$client->setUri($link->href);
$client->setHeaders( array("Content-type: image/*","Authorization:
GoogleLogin auth=".$token,"X-HTTP-Method-Override: DELETE") );
$http_response = $client->request('POST');

}
}
}

What is wrong in this code i am not getting. if i use same code to delete
Contact (by edit URL) then it works, but doesn't affect the contact's photo.
Post by Julian (Google)
Hi,
You cannot use the AuthSub Token for Client Login.
For AuthSub, make sure you have the scope and the hd parameter setup
correctly. The scope should be: http://www.google.com/m8/feeds/contacts/
and the hd parameter should be your domain if it is different than
http://code.google.com/apis/accounts/docs/AuthSub.html#AuthSub
--Julian
Post by Devang Parekh
hi julian, I try as you suggest but now http_code is 401. can i use my
authSubToken as GoogleLogin authToken?? means i am using token that never
expires & you are suggesting token i.e. available by providing userName &
p/w. Can this be a reason for 401??
Post by Julian (Google)
Hi,
This should work for ClientLogin, change Authorization: AuthSub
token="yourAuthToken" if you want to use AuthSub.
<?php
$url = "http://www.google.com/m8/feeds/photos/media/user%40domain.com/
1"; # 1 is a CONTACT-ID
$authToken = "DQ...";
$header[] = "Authorization: GoogleLogin auth=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
print_r( $info ); # you should get a http_code 200
?>
--Julian
Post by Devang Parekh
hi julian...
Thanks for reply but there is no change. Image is still there.
$url =
http://www.google.com/m8/feeds/photos/media/user%40domain.com/44e1ab3.
..
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
$header[] = "Authorization: AuthSub token=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$header[] = "X-HTTP-Method-Override: DELETE";
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
This is my actual code. Reply soon plz..
Post by Julian (Google)
Hi,
You could try to do a HTTP DELETE like the following sample, using
the
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
Post by Julian (Google)
DELETEhttp://
www.google.com/m8/feeds/photos/media/user%40domain.com/1
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
Post by Julian (Google)
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2
-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc.
Post by Devang Parekh
Post by Julian (Google)
..
Post by Devang Parekh
Post by Julian (Google)
Post by D2
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from
"rel#photo".
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
Post by Julian (Google)
Post by D2
when i proccess this, I get http_response 200. But image remains
as
Post by Devang Parekh
Post by Julian (Google)
it
Post by Devang Parekh
Post by Julian (Google)
Post by D2
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---
Devang Parekh
2009-04-17 09:32:19 UTC
Permalink
Hey Julian,
Reply me.
Post by Devang Parekh
hi julian..
I am seeing only ClientLogin token in every example of delete contact's
photo. Can't this possible with authSubToken??& bye the way. I just try
Zend GData framework to check photo deletion. But no effect of it also.
StatusCode 200 & image remains as it is. below is my code. here i have ussed
clientLogin token.
require_once '../Loader.php';
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Query');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata');
"cp");
$gdata = new Zend_Gdata($client);
$query = new Zend_Gdata_Query('
http://www.google.com/m8/feeds/contacts/default/full');
$query->setMaxResults(100);
$feed = $gdata->getFeed($query);
$token = $client->getClientLoginToken();
foreach ($feed as $entry)
{
foreach($entry->link as $link)
{
if(ereg("rel#edit-photo",$link->rel))
{
$client->setUri($link->href);
GoogleLogin auth=".$token,"X-HTTP-Method-Override: DELETE") );
$http_response = $client->request('POST');
}
}
}
What is wrong in this code i am not getting. if i use same code to delete
Contact (by edit URL) then it works, but doesn't affect the contact's photo.
Post by Julian (Google)
Hi,
You cannot use the AuthSub Token for Client Login.
For AuthSub, make sure you have the scope and the hd parameter setup
correctly. The scope should be: http://www.google.com/m8/feeds/contacts/
and the hd parameter should be your domain if it is different than
http://code.google.com/apis/accounts/docs/AuthSub.html#AuthSub
--Julian
Post by Devang Parekh
hi julian, I try as you suggest but now http_code is 401. can i use my
authSubToken as GoogleLogin authToken?? means i am using token that
never
Post by Devang Parekh
expires & you are suggesting token i.e. available by providing userName
&
Post by Devang Parekh
p/w. Can this be a reason for 401??
Post by Julian (Google)
Hi,
This should work for ClientLogin, change Authorization: AuthSub
token="yourAuthToken" if you want to use AuthSub.
<?php
$url = "
http://www.google.com/m8/feeds/photos/media/user%40domain.com/
Post by Devang Parekh
Post by Julian (Google)
1"; # 1 is a CONTACT-ID
$authToken = "DQ...";
$header[] = "Authorization: GoogleLogin auth=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"DELETE");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
print_r( $info ); # you should get a http_code 200
?>
--Julian
Post by Devang Parekh
hi julian...
Thanks for reply but there is no change. Image is still there.
$url =
http://www.google.com/m8/feeds/photos/media/user%40domain.com/44e1ab3.
..
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
$header[] = "Authorization: AuthSub token=".$authToken;
$header[] = "Content-type: application/x-www-form-urlencoded";
$header[] = "If-Match: *";
$header[] = "GData-Version: 2";
$header[] = "X-HTTP-Method-Override: DELETE";
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, true);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
$response = curl_exec($ch);
This is my actual code. Reply soon plz..
Post by Julian (Google)
Hi,
You could try to do a HTTP DELETE like the following sample, using
the
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
Post by Julian (Google)
DELETEhttp://
www.google.com/m8/feeds/photos/media/user%40domain.com/1
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
Post by Julian (Google)
Authorization: GoogleLogin auth=DQ...
If-Match: *
Content-Type: application/x-www-form-urlencoded
GData-Version: 2
-Julian
Post by D2
HTTP - HEADER
"Host:www.google.com"
"MIME-Version: 1.0"
"Accept: text/plain"
"Content-type: image/*"
"Authorization: AuthSub token=AUTH-TOKEN"
"X-HTTP-Method-Override: DELETE"
"Cache-Control: no-cache"
"If-Match: E-TAG"
"GData-Version: 2"
"Connection: close"
http://www.google.com/m8/feeds/photos/media/EMAIL-ADDRESS/f6bf7740bdc.
Post by Devang Parekh
Post by Julian (Google)
..
Post by Devang Parekh
Post by Julian (Google)
Post by D2
I want to delete photo for a perticular Contact. Above is my
http_header to delete photo. & url is same as i get from
"rel#photo".
Post by Devang Parekh
Post by Julian (Google)
Post by Devang Parekh
Post by Julian (Google)
Post by D2
when i proccess this, I get http_response 200. But image remains
as
Post by Devang Parekh
Post by Julian (Google)
it
Post by Devang Parekh
Post by Julian (Google)
Post by D2
is.
Anything wrong in this code?? please reply soon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Google Contacts API" group.
To post to this group, send email to google-contacts-***@googlegroups.com
To unsubscribe from this group, send email to google-contacts-api+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Continue reading on narkive:
Loading...