+ Start a Discussion

make httprequest in batch apex

I am pretty new to apex and have never used batch apex.  I have read about it but don't quite understand it.  I have the need to write some code that will make http call outs.  My problem is that I am not sure of the exact number of call outs and I believe the govenor limit is 10.  My code for 1 call out looks like this:

global void runCallOuts{
    HttpRequest req = new HttpRequest();
    Http http = new Http();
    HTTPResponse res = http.send(req);
    JSONParser parser = JSON.createParser(res.getBody());
    while (parser.nextToken() != null) {
        if ((parser.getCurrentToken() == JSONToken.FIELD_NAME)){
            String fieldName = parser.getText();
            if(fieldname == 'id') {

 What I need to do is be able to run that piece of code for each of a specific sObject that meets the requirements.  I then want to set that to run every day at 5pm or some other specific time.  Thanks for the help.  

What is actual requirement for many call outs ? Just wanted to know if you really don't have any other option ...!!

I don't have an actual number of callouts.  It could be as many as 1000