Project

General

Profile

Actions

Feature #325

closed

Retrieve a list of all puppetclasses using the REST Api

Added by Gustavo Soares almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When playing aroung with the rest api I missed the feature to retrieve a list of all puppetclasses with their respective ids.

So, I alter the file app/controllers/puppetclasses_controller.rb to include a method to retrieve a json object with all classes with their ids.

def all
@puppetclasses = Puppetclass.find(:all, :select => "id, name", :order => 'id').to_json
render :json => @puppetclasses
end

Then, in the router.rb file I add:

map.connect "/puppetclasses/all", :controller => 'puppetclasses', :action => 'all'

I am not a big ruby expert, so I don't know if this is the best approach... :)

Actions

Also available in: Atom PDF