post - JsonAPI - send list (array) of objects -
couldn't find example sending list of objects in jsonapi format. example, 1 object:
{ "data": { "type": "filetype", "id": "c33e05b7-8f55-4ee1-8d61-5b5da9110b2f", "attributes": { "created_at": "2017-07-02t09:11:10.005351z", "updated_at": "2017-07-02t09:11:10.005374z", "created_by": "user_id", "url_page": null, "resource_urls": null, "attachment_type_id": "1", "url_type_id": "1", "url_version": null }, "relationships": { "item": { "data": { "type": "items", "id": "f0c2e244-ec02-4a75-bd36-da1f703136e7" } } } } }
how should list (array) of such objects valid jsonapi?
looking documentation, i'd it's this:
{ "data":[ { "type":"filetype", "id":"c33e05b7-8f55-4ee1-8d61-5b5da9110b2f", "attributes":{ "created_at":"2017-07-02t09:11:10.005351z", "updated_at":"2017-07-02t09:11:10.005374z", "created_by":"user_id", "url_page":null, "resource_urls":null, "attachment_type_id":"1", "url_type_id":"1", "url_version":null }, "relationships":{ "item":{ "data":{ "type":"items", "id":"f0c2e244-ec02-4a75-bd36-da1f703136e7" } } } }, { "type":"filetype", "id":"cc06bbb5-b4f8-4351-90f3-01df3f3f2116", "attributes":{ "created_at":"2017-08-02t09:11:10.005351z", "updated_at":"2017-08-02t09:11:10.005374z", "created_by":"user_id", "url_page":null, "resource_urls":null, "attachment_type_id":"1", "url_type_id":"1", "url_version":null }, "relationships":{ "item":{ "data":{ "type":"items", "id":"b0300df2-365e-44b4-bfc4-f3170dca2289" } } } } ] }
Comments
Post a Comment