         logger.info 'job on Jenkins',
           index: index
           job: element
-        if element.name.startsWith(config.jobPrefix)
+        if element.name.startsWith(templatePrefix)
           jobsFound.push new JenkinsJob(element.name, element.url)
     callback(jobsFound)
 
-# callback for API '/api/create-jobs/:id'
+# callback for API '/api/create-jobs'
 exports.create_jobs = (req, res) ->
   logger.info 'main#create_jobs',
     body: req.body

  if _.isNull(jenkinsUrl) || _.isUndefined(jenkinsUrl)
    jenkinsUrl = config.defaultJenkinsUrl

  get_template_jobs jenkinsUrl, (jobsFound) ->
    logger.info 'jobs found =>',
      jobs: jobsFound

    _.each jobsFound, (element, index, list) ->
      copy_job_from_template(req.body.jobPrefix, element.name, jenkinsUrl)

  res.send 200

      statusCode: response.statusCode

# get all jobs that start with config.expectedJobPrefix
# param: jenkinsUrl => the base url to the jenkins server
# param: templatePrefix => the prefix for the templates to search for on the server
# param: callback(jobsFound)
get_template_jobs = (jenkinsUrl, templatePrefix, callback) ->
  urlParams = '/api/json'
  requestUrl = url.resolve(jenkinsUrl, urlParams)
  logger.info 'main#get_template_jobs',
