Handling redirect in Vlocity Integration Procedure having response code of 307 – User friendly Tech help
Problem:-Clients api was having redirect policy on the server but its not handled by Vlocity integration procedure(IP), thus its failing with 307 response code
n
Solution:-
n
- n
- Error:- 307 Temporary Redirect
- Inside IP create “Remote Action” to refer the Apex class and apex method, which handles the redirect 307 error.
- Note:- This is not handled by default in IP inside vlocityn
//change this to implement vlocity_openInterface nglobal class CC_RedirectDemoController {n global static void getSession(){n Http http = new Http();n HttpRequest req = new HttpRequest();n HttpResponse res = new HttpResponse();n // do your initial http call heren req.setMethod('POST');n req.setHeader('Content-Type', 'application/json');n req.setHeader('key', 'value');n req.setEndpoint('URL to hit initially');n req.setBody('body input data if available');n system.debug('request ='+req);n res = http.send(req);n system.debug('response ='+res);n // redirection checkingn boolean redirect = false;n if(res.getStatusCode() >=300 && res.getStatusCode() =300 && res.getStatusCode()
n
n
n