Details
-
Bug
-
Resolution: Fixed
-
None
-
Critical
-
-
Empty show more show less
Description
problem
Currently there are several pitfalls on using the API for users using it the first time.
For example that all data must be packed as data object etc.
Some users are trying to make an ordinary post, with single data fields.
This is currently not supported, but gives error messages like
ZfExtended_Log on xzy.translate5.net: exception 'Zend_Exception' with message 'Creating default object from empty value; File: /webs/xzy.translate5.net/library/ZfExtended/Controllers/UserController.php; Line: 178; errno: 2' in /webs/xzy.translate5.net/library/ZfExtended/Resource/ErrorHandler.php:122
Also provide PHP curl examples, not only bash curl examples.
Another problem are different error structures. For example on PUT a user, an invalid emails has a different error structure as an invalid ID (in the PUT data, not in the URL) for example.
Or what is also a problem: some fields defined as boolean in the documentation sends true|false others 0|1 integers instead. This should be consistent!
solution
This should be captured in general, if there is no data object just give a brief exception so that the user gets the info that he is sending the wrong data.
Also check if the json_decode call in RestController::decodePutData is producing decode errors, currently this results also in the above message.
JSON decode errors can happen for example by not decoding the payload containing a "&" (Ampersand) although the content-type is www-form-encoded which sais that the content should be encoded!
solution v2:
Make the API more flexible:
- if there is no data variable check plain content, is the plain content JSON use that
- If there is no plain content but multiple variables, try to use them as input → will fail if one field is dedicated to use JSON, how to deal that?
- File Uploads: For most API users (probably all) it would be much easier if the file uploads could be provided as string data in the JSON instead as multipart boundary
Attachments
Issue Links
- relates to
-
TRANSLATE-2444 Fix REST API documentation
- Open
-
TRANSLATE-2289 Move API documentation to Swagger and enhance documentation
- Open
-
TRANSLATE-1012 Improve REST API on task creation
- Done
-
TRANSLATE-699 update confluence rest API
- Backlog
-
TRANSLATE-2217 List refactoring and code maintenance needs in translate5
- Selected for dev