HTTP 400 when marking some entries are read

15 views
Skip to first unread message

Edwin Khodabakchian

unread,
Oct 16, 2010, 11:26:38 PM10/16/10
to Friends of the Unofficial Google Reader API, te...@devhd.com
Hello,

We sometimes see an 400 response code to the HTTP POST request used to
mark an entry as read. I am not able to reproduce this. I was
wondering if anyone might have insight into what could cause the
server to return 400. I also noticed that edit-tag supports an async
and pos parameter and was wondering what does are and if we are using
them in a wrong way.

Thank you!



Ref: here is the overview of the code which generates the HTTP post -
just in case someone seems something we are doing wrong

var gEntryId = anEntry.getGoogleId()
var feedId = anEntry.getFeedId();

var request = {
s : feedId,
T : commandToken,
i : gEntryId,
async : true,
pos : 0
};

if( atag != null )
request.a = devhd.utils.TermUtils.formatTerm( atag, userId );

if( rtag != null )
request.r = devhd.utils.TermUtils.formatTerm( rtag, userId );

// mark the entry as read on the server
POST( "http://www.google.com/reader/api/0/edit-tag?client=feedly",
devhd.forms.webForm( request ),
onSuccess,
onError,
{
"Authorization":"GoogleLogin auth=" + auth
}
);

Mihai Parparita

unread,
Oct 18, 2010, 2:08:08 PM10/18/10
to foug...@googlegroups.com, te...@devhd.com
On Sat, Oct 16, 2010 at 8:26 PM, Edwin Khodabakchian
<edwin.kho...@gmail.com> wrote:
> Hello,
>
> We sometimes see an 400 response code to the HTTP POST request used to
> mark an entry as read. I am not able to reproduce this. I was
> wondering if anyone might have insight into what could cause the
> server to return 400.

Can you include a full dump of the a request and response, including
HTTP headers? One possibility is that the action token (T parameter)
is stale. This is indicated by a X-Reader-Google-Bad-Token header in
the response.

> I also noticed that edit-tag supports an async
> and pos parameter and was wondering what does are and if we are using
> them in a wrong way.

If "async" is true, then the request will return immediately, instead
of waiting for the operation to be fully committed to our backend. If
you don't app

"pos" is used to indicate the position of the item in the list of
items that the user is reading. We use it to measure quality when
using "magic" ranking (we'd expect/like users to click on items that
appear first). You can just omit it if you don't have a well-defined
display order.

Mihai

Satscape

unread,
Nov 7, 2010, 1:28:51 PM11/7/10
to Friends of the Unofficial Google Reader API

Hi, the PHP code I'm using gives error 400 when marking an item read,
do you know if this code is correct, other methods in the PHP class I
found work fine, but not the mark read method, heres the code:

public function markAsRead($itemId) {
$data = sprintf(
'i=%1$s&T=%2$s&a=%3$s&ac=edit',
$itemId, $this->_token,'user/-/state/com.google/read'
);

$path = '/reader/api/0/edit-tag?client=twizzlescape';
$host = 'www.google.com';

$response = $this->_httpPost($host, $path, $data);
if($response == null) return false;
echo $response;
return true;
}

I get error 400 from the server with:
Your client has issued a malformed or illegal request.

Any help would be very grateful,
Scott

Satscape

unread,
Nov 8, 2010, 6:14:52 AM11/8/10
to Friends of the Unofficial Google Reader API

*FacePalm*

Sorry, I can confirm the above code works fine. On closer examination
of what was being posted to the server, the i parameter ($itemId) was
not being passed into the function, due to a typo.

Cheers,
Scott
Reply all
Reply to author
Forward
0 new messages