1

Topic: Inconsistent behaviour of data service

Hi,

I've experienced some inconsistent behaviour of the data service. Given the following surveys:

  • Survey 1 exists

  • Survey 2 is deleted

  • Survey 3 does not exist

Loading survey 1 via the data service works fine.

Loading survey 2 via the data service gives the following results

  • /index.php/services/data/survey/2 - returns the survey as json - no delete flag is set in the result

  • /indicia/index.php/services/data/survey/2?mode=xml  - returns the survey as xml - no delete flag is set in the result

  • /indicia/index.php/services/data/survey/2?view=detail - returns an empty json array

  • /indicia/index.php/services/data/survey/2?view=detail&mode=xml - returns an xml error document with the message: "general_errors.Undefined offset: 0"

Loading survey 3 via the data service gives always this error message "general_errors.Unknown Exception: Attempt to access existing record failed - website_id 1 does not match website for survey id 3"

I would expect for GET Requests for /indicia/index.php/services/data/survey/2 and /indicia/index.php/services/data/survey/3 always the same answer. Either HTTP 404 (not found) which would be the most REST like, or an empty json array / xml document.

Do you use the current behaviour in you code, or am I free to write a patch?

Regards

Daniel

2

Re: Inconsistent behaviour of data service

Hi Daniel
I agree, this should indeed be patched so if you are happy to write it then that would be great.

There is a setting to turn http error codes on and off so I suggest this is respected for greatest compatibility with existing code.

Best wishes
John

John van Breda
Biodiverse IT