quru / qis

Dynamic image server for web and print
https://quruimageserver.com
GNU Affero General Public License v3.0
90 stars 7 forks source link

API inconsistencies #10

Closed fozcode closed 5 years ago

fozcode commented 5 years ago

I don't think that any of these changes will break compatibility (you only get HTML errors for calls that are broken anyway).

fozcode commented 5 years ago

The file admin functions returns different fields than the file details function

The serialized image object is already consistent in:

There are inconsistencies though in the return value of image objects from:

The combined image object would be:

{
    "id": 524,
    "title": "my sample image",
    "description": "description of my sample image",
    "folder": {
      "id": 3,
      "name": "/test_images",
      "parent_id": 1,
      "path": "/test_images",
      "status": 1
    },
    "folder_id": 3,
    "width": 1600,
    "height": 1200,
    "src": "test_images/myimage.jpg",
    "filename": "myimage.jpg",
    "url": "https://images.example.com/image?src=test_images/myimage.jpg",
    "supported": true,
    "status": 1,
    "download": true
}

Where filename, url, supported and download are calculated fields.

For many scenarios the inclusion of the folder object is appropriate, but for some (list and upload) it is unnecessary because the folder is already known and will be the same for all images. As this task is about standardising the return value though, it seems best to me to keep it everywhere.