How to use Directus 7.0

Querying with version 7 of Directus is a bit harder than in verion 6 because the documention is not that good at the moment of writing.

Assumptions
Project: default
Table: car_brand
Url: https://api.thuiskunst.nl/api/

Sample 1.

https://api.thuiskunst.nl/_/items/car_brand

Sample 2.

https://api.thuiskunst.nl/_/items/car_brand?q=Ford

Sample 3.

https://api.thuiskunst.nl/_/items/car_brand?filter[name][eq]=Mitsubishi

Sample 3. (with external objects)

https://api.thuiskunst.nl/_/items/car_brand?filter[name][eq]=Ford&fields=name,%20logo.data.*

This only shows the name field from collection car_brand with the data field from the logo relation

Result:

{
  "data": [
    {
      "name": "Ford",
      "logo": {
        "data": {
          "full_url": "https://api.thuiskunst.nl/uploads/_/originals/duesenberg.jpg",
          "url": "https://api.thuiskunst.nl/uploads/_/originals/duesenberg.jpg",
          "thumbnails": [
            {
              "url": "https://api.thuiskunst.nl/thumbnail/_/200/200/crop/good/duesenberg.jpg",
              "relative_url": "/thumbnail/_/200/200/crop/good/duesenberg.jpg",
              "dimension": "200x200",
              "width": 200,
              "height": 200
            }
          ],
          "embed": null
        }
      }
    }
  ]
}
Last update: Tue, 13 Sep 2022 14:32:15