function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jashjash 

nextPageURL 400 bad request error

I'm trying to get feed items through paging, but the next page always returns a 400 bad request error...  the flow seems pretty basic, not sure what's wrong with the subsequent request but any help\ideas are appreciated. Thanks, Joan

INITIAL REQUEST:
    https://na6.salesforce.com/services/data/v29.0/chatter/feeds/record/0F9800000000266CAA/feed-items

EXCERPT FROM RESPONSE:
"nextPageUrl" : "/services/data/v29.0/chatter/feeds/record/0F9800000000266CAA/feed-items?page=2014-02-06T04%3A52%3A11Z%2C0D580000013UegyCAC"

REQUEST FOR NEXT PAGE RETURNS 400 ERROR:
    https://na6.salesforce.com/services/data/v29.0/chatter/feeds/record/0F9800000000266CAA/feed-items?page=2014-02-06T04%3A52%3A11Z%2C0D580000013UegyCAC
BeckBeck
Hi Joan,

The flow seems correct -- it's surprising that you're getting a 400 response from the request for the next page.  Can you share the full error message?

Thanks,
Beck
jashjash
Hi Beck -

Thanks for taking a look.
The error is just "The remote server returned an error: (400) Bad Request."  I'm just doing an HttpWebRequest (GET)

Joan
BeckBeck
Are you able to find the raw error response?  Something like this:
[ {
  "errorCode" : "ILLEGAL_QUERY_PARAMETER_VALUE",
  "message" : "Illegal value for blah blah blah"
} ]
jashjash
Here's the raw error:

errorCode=INVALID_PAGING_OPTION
message=Page value malformed: 2014-02-06T04%3A52%3A11Z%2C0D580000013UegyCAC

Thanks for your help!
BeckBeck
Thanks for the raw error.  It looks like there's a problem with parsing the page value, but I can't see what it might be -- are you doing any handling/processing of the value from nextPageUrl?  Or perhaps it's being modified unintentionally?

Are you hitting this error for all kinds of record feeds, or just for groups?  Does it happen with every group or just this one?
jashjash
Resolved!  Thanks Beck for pointing me in the right direction.  This may only apply to those using .Net, but the page parameter was inadvertantly being double-encoded because it was returned from the HttpWebRequest as encoded and then our own libraries also encoded it before submitting.  Also for those using .Net, the only way I could figure out how see the native error was via Fiddler, (Headers > JSON).  
BeckBeck
I'm so glad I was able to help, Joan.  Thanks for sharing the resolution and tips for other .Net developers!