1

Re: Problems using report webservice

Hi,
I'm trying to use the report webservice and I'm facing problems:
Working:
Calling "occurrences_by_website.xml" via http-get request.

Not Working:

Calling "occurrences_by_website.xml" via http-post request.
Parameters: report = "occurrences_by_website.xml", reportSource = "local", mode="json", auth_token = "xxx" nonce="yyy"

Response: {"error":"Undefined index:  content","file":"\/opt\/pkgsrc-gcc\/share\/httpd\/htdocs\/indicia\/modules\/indicia_svc_data\/controllers\/services\/report.php","line":153,"trace":[]}

Calling "map_occurrences_for_survey.xml" via http-get or http-post request.
Parameters: report = "map_occurrences_for_survey.xml", reportSource = "local", mode="json", auth_token = "xxx", nonce = "yyy", params="{"survey":2,"searchArea":"POINT(222638.981586547 334111.17140196)"}"

Response-post:
{"error":"Undefined index:  content","file":"\/opt\/pkgsrc-gcc\/share\/httpd\/htdocs\/indicia\/modules\/indicia_svc_data\/controllers\/services\/report.php","line":153,"trace":[]}

Response-get:
{"parameterRequest":{"survey":{"datatype":"lookup","allow_buffer":null,"emptyvalue":"0","display":"Survey","description":"Select the survey to return data for","query":"SELECT id, title as caption FROM surveys","lookup_values":null,"population_call":"direct:survey:id:title"},"searchArea":{"datatype":"geometry","allow_buffer":"true","emptyvalue":null,"display":"Report Search Area","description":null,"query":null,"lookup_values":null,"population_call":null}},"uid":"aa3b0c52a5b8a285b3c0d269e330ada9"}

As I could read from the wiki, I should use post and I can provide parameter with the first call, so that i don't have to use resumeReport, which is also not working for me:
http-get: index.php/services/report/resumeReport?params=%7B%22survey%22%3A2%2C%22searchArea%22%3A%22POINT%28222638.981586547+334111.17140196%29%22%7D&uid=aa3b0c52a5b8a285b3c0d269e330ada9&nonce=1b6972c0e1f487298bdaa44f424c5ac8808294c3&auth_token=a7e4157ebed2b5af7392d82340fc1b8b0009db37

response: {"error":"Trying to resume a report but one or more of params or uid is null","uid":null,"params":[]}

Regards

Daniel

2

Re: Problems using report webservice

Ok, got a bit further calling resumeReport with http-post. Getting the json representation with this call, but I would like to have it in xml. Is mode=xml ignored here?

3

Re: Problems using report webservice

Hi Daniel
Can you try putting the mode in as a GET param - i.e. add it to the URL you are sending the post request to please? I think there is a slight mismatch between the documentation and what actually happens here. I'll try and fix that for the next release though.
Best wishes

John van Breda
Biodiverse IT

4

Re: Problems using report webservice

Hi Daniel
If you look at revision 2833 (http://code.google.com/p/indicia/source/detail?r=2833) you will see I posted a couple of changes to the detection of report settings in the GET or POST data, plus added unit tests which work and you could copy from. The report services can be called with either GET or POST data - POST is required for long parameter support though e.g. mapping against a complex polygon.

John van Breda
Biodiverse IT

5

Re: Problems using report webservice

Hi John,

thanks, this works fine now with just doing a post request with paramters an mode. I get xml back.

Daniel