REST request returning HTML page
Added by mark schott almost 15 years ago
Hi,
I just installed redmine V. 0.9.1. It is great that REST api's has been introduced in this stable version.
I have made a demo installation, Enable REST web services from Settings.
Then created a dummy project "Project 1", when i tried to access the details of tha project using REST api's and python REST library.
I have found that in response i am getting entire HTML page of the project.
Following is the Python code that i am using.
`
from restful_lib import Connection
base_url = "http://127.0.0.1:3000"
headers={}
conn = Connection(base_url,username="admin", password="admin")
headers['Content-Type']='application/xml'
resp = conn.request_get("projects",args={"id":1},headers=headers)
print resp.keys()
print resp['headers']
print resp['body']
`
THIS IS THE REQUEST THAT I AM GETTING ON WEBrick Server
`
Processing ProjectsController#index (for 127.0.0.1 at 2010-02-02 11:55:02) [GET]
Parameters: {"action"=>"index", "id"=>"1", "controller"=>"projects"}
`
Status that is been RETURNED by SERVER :
` {'status': '304', 'content-length': '2975', 'content-location': 'http://127.0.0.1:3000/projects?id=1', 'set-cookie': '_redmine_session=BAh7BjoPc2Vzc2lvbl9pZCIlMGE0NWI3ZDhmY2M4ZjVmM2NiZDBiOTM3ZTNjODE0Y2U%3D--845bc537c063178ab3b2823a47d8ae0c6ff3318f; path=/; HttpOnly', 'connection': 'Keep-Alive', 'server': 'WEBrick/1.3.1 (Ruby/1.8.7/2010-01-10)', 'x-runtime': '626', 'etag': '"0673df035b6276a5a612792629814fb7"', 'cache-control': 'private, max-age=0, must-revalidate', 'date': 'Tue, 02 Feb 2010 06:25:03 GMT', 'content-type': 'text/html; charset=utf-8'}
`
Replies (4)
RE: REST request returning HTML page - Added by mark schott almost 15 years ago
i have found this one ... but still problem ... any helping hands !!!
RE: REST request returning HTML page - Added by Felix Schäfer almost 15 years ago
#4795 is not the same issue. You have the resource you are trying to access wrong, /projects
doesn't take an argument, you will have to GET /projects/1.xml
for what you are trying, I suppose (/projects(.xml)
is the index
action and will show a list of all projects, regardless of any parameters given, the path for single projects can be obtained from this index and is of the form /projects/$ID.xml
). Please reread Rest_Projects and make sure your paths are correct.
RE: REST request returning HTML page - Added by mark schott almost 15 years ago
I have tried something like this ... still no success ... any clues where i m going wrong... !!!
Processing ApplicationController#GET projects/1.xml to xml (for ::1 at 2010-02-15 19:05:48) [GET]
Parameters: {"format"=>"xml", "action"=>"GET projects/1.xml"}
ActionController::RoutingError (No route matches "/projects/1.xml" with {:method=>:get}):
Thanks in advance..