AnsweredAssumed Answered

action=list and action=delete return 301 error

Question asked by Peter Lee on Apr 28, 2015

First, I will admit to not being an expert and just beginning to play with perl and the API.


Using code from Parag Baxi's fetch, I have written a perl program that pulls a list of scans from the server, lets the user choose one, runs a series of reports automatically, and then downloads the generated reports.


I'd then like to delete the reports off the server, so I call /api/2.0/fo/report/?action=delete&id=XXXXX, similar to the calls for the previous activities.  Unfortunately, I get this returned from the server:

HTTP/1.1 301 Moved Permanently

Date: Tue, 28 Apr 2015 16:38:41 GMT

Server: qweb


Transfer-Encoding: chunked

Content-Type: text/html; charset=iso-8859-1




<TITLE>301 Moved Permanently</TITLE>


<H1>Moved Permanently</H1>

The document has moved <A HREF="">here</A>.<P>



So I thought maybe I'd just try to list the reports, in case for whatever reason it assigned a new ID (not that I expected this, but stranger things have happened).  So I call /api/2.0/fo/report/?action=list, and get the same 301 error.


What am I missing?  Any help is appreciated, and as I said, I am in no way a perl or HTML expert, so don't be afraid to talk down to me.  Thanks!


So by adding a curl->setopt(CURLOPT_FOLLOWLOCATION, 1) I was able to get the action=list to work.  However the action=delete still gives an error.  This time the error is "missing required parameter".  I read elsewhere that when curl redirects it changes to 'GET' automatically, and delete needs 'POST'.  I've already set (CURLOPT_POST, 1), anyone know if there is something else I need to do?  I haven't been able to find anything.  Thanks.


Near as I can tell, the server is not forwarded my request correctly.  Possibly because of safe_mode or open_basedir being set.  Anyone else have a similar issue or know a client-side work around?