You need to sign in to do that
Don't have an account?
Patrick Mayer 4
Using a login json to grab info
Http httpProtocol1 = new Http(); Http httpProtocol2 = new Http(); // Create HTTP request to send. HttpRequest request1 = new HttpRequest(); HttpRequest request2 = new HttpRequest(); // Set the endpoint URL. String endpoint1 = 'https://website.com/Login.json?user=patrick@website.com&pass=Secret'; String endpoint2 = 'https://website.com/LoginRequiredInfo.json'; request1.setEndPoint(endpoint1); request2.setEndPoint(endpoint2); // Set the HTTP verb to GET. request1.setMethod('GET'); request2.setMethod('GET'); // Send the HTTP request and get the response. // The response is in JSON format. HttpResponse response1 = httpProtocol1.send(request1); HttpResponse response2 = httpProtocol2.send(request2); System.debug(response2.getBody());
Code is included for clarification, but essentially I am trying use the first json that creates a cookie that gives admin status to the second so that the info can be read. It works if I enter the 2 URLs in succession into a browser.
I am wondering if anyone has done anything like this and gotten it to work.
All Answers