diff --git a/app/views/api/playground.html.erb b/app/views/api/playground.html.erb
index 3941402..9edbea7 100644
--- a/app/views/api/playground.html.erb
+++ b/app/views/api/playground.html.erb
@@ -1,6 +1,8 @@
API Playground
@@ -33,4 +35,4 @@ end.flatten.compact.sort{|a,b|
-
+<%= javascript_include_tag 'api-playground' %>
diff --git a/lib/noosfero/api/api.rb b/lib/noosfero/api/api.rb
index 477ccc9..39fba05 100644
--- a/lib/noosfero/api/api.rb
+++ b/lib/noosfero/api/api.rb
@@ -32,7 +32,7 @@ module Noosfero
after { set_session_cookie }
version 'v1'
- prefix "api"
+ prefix [ENV['RAILS_RELATIVE_URL_ROOT'], "api"].compact.join('/')
format :json
content_type :txt, "text/plain"
diff --git a/public/javascripts/api-playground.js b/public/javascripts/api-playground.js
index 1199237..ddffd7d 100644
--- a/public/javascripts/api-playground.js
+++ b/public/javascripts/api-playground.js
@@ -24,7 +24,7 @@ var playground = {
selEndpoint: function() {
var endpoint = this.getEndpoint();
jQuery('#api-form .api-param').remove();
- if ( endpoint.path == '/api/v1/login' ) {
+ if ( endpoint.path == prefix+'/v1/login' ) {
this.addFormParam('login');
this.addFormParam('password');
}
@@ -51,7 +51,7 @@ var playground = {
for (var i=1; i