具有不同实体类型的REST资源集合

时间:2013-09-11 13:14:44

标签: rest

REST哲学中指出,如果在同一资源(/ads)集合中有不同的类型,则只列出相同的列。


    {
        "ads": {
            "meta" {
                "count": 1899
            },
            "data" [
                {
                    "type": "tractor",
                    "make": "Ford"
                    "model": "",
                    "moto_hours": "50"
                },
                {
                    "type": "car",
                    "make": "Audi"
                    "model": "A4"
                    "moto_hours": ""
                 }
            ]
        }
    }

但是我有一个问题,也许这样做是有效的吗?


    {
        "ads": {
            "meta" {
                "count": 1899
            },
            "data" [
                {
                    "type": "tractor",
                    "make": "Ford"
                    "moto_hours": "50"
                },
                {
                    "type": "car",
                    "make": "Audi"
                    "model": "A4"
                 }
            ]
        }
    }

0 个答案:

没有答案