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
NareshNaresh 

302- Object Moved error in HTTP services

Hi All,
I am using HttpRequest and HttpResponse method to make an external call in Apex. But in HttpResponse I am not getting the proper result. I am getting the "Status=Object Moved" and "StatusCode=302". I understand this is because of "response.redirect" on the requested page. For this, I again get theURL for the redirected page and made a new request by setting the new EndPoint. But this time I am getting the "Session time out error".
This is because  both request has different session. Any idea how we can made multiple request with same session?


Thanks,
NG
MikeGoelzerMikeGoelzer
What endpoint are you trying to talk to? The duration of the remote session is really up to the remote site, not something you as client would control. Does the same code compiled locally using gjc work correctly?
AcMEGXAcMEGX

Hi Naresh,

 

I know this is an old thread. I stumbled upon it looking for solutions to my own APEX problem.

 

Have you tried capturing the response headers and using that for the new redirect URL?

 

You can pass the session for the second request.

 

Regards.

G