diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-07-04 11:31:38 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-07-04 12:10:44 +0200 |
commit | 9bdf0973b337cbf73287422cc5fdceabc8703e61 (patch) | |
tree | fb02b08b50a33e39229e4d0cfddec15b36852942 /doc | |
parent | 0ce11c1416c0bce491952410e791f7ca6cfad2dd (diff) |
API: Fix return type of empty values in file/history
If the array is not casted to a object, json_encode will encode it as
[] if empty, but {} if it contains data. Always return an object by
casting the array to an object if it is empty.
Fixes #15
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api.md | 1 | ||||
-rw-r--r-- | doc/api/file.md | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/doc/api.md b/doc/api.md index 50b45ca6f..cbdc5bbb9 100644 --- a/doc/api.md +++ b/doc/api.md @@ -147,6 +147,7 @@ These are the most common errors that can be returned by any API call. | Version | Endpoint | Note | | ------- | -------- | ---- | +| 2.1.1 | file/history | Empty objects (values of `items` and `multipaste_items`) are now always returned as {}. Before they were returned as [] | | 2.1.0 | file/history | Add ''item.thumbnail'' | | 2.0.0 | file/history | Add ''multipaste_item.date'' | | 2.0.0 | file/history | Remove private fields in response | diff --git a/doc/api/file.md b/doc/api/file.md index 74120450b..c461caf01 100644 --- a/doc/api/file.md +++ b/doc/api/file.md @@ -125,8 +125,8 @@ multipaste_item = { // Success response responseSuccess.data = { - "items": [item.id: item, ...], - "multipaste_items": [multipaste_item.url_id: multipaste_item, ...], + "items": {item.id: item, ...}, + "multipaste_items": {multipaste_item.url_id: multipaste_item, ...}, "total_size": int, // total size of all files (excluding duplicates) } ``` @@ -187,6 +187,7 @@ Example: | ------- | ------ | | 2.0.0 | Add ''multipaste_item.date''. Remove ''multipaste_item.{multipaste_id,user_id}''. | | 2.1.0 | Add ''item.thumbnail'' | +| 2.1.1 | Empty objects (values of `items` and `multipaste_items`) are now always returned as {}. Before they were returned as [] | ## file/delete |