@@ -56,35 +56,15 @@ The routes available are:
5656
5757#### Relationships
5858
59- ` /companies/<number>/individuals `
60- ` /companies/<number>/products `
61- ` /companies/<number>/individuals,products `
59+ ` /companies/<number>?included=<individuals>,<products> `
6260
63- ` /companies/<number>/relationships/individuals `
64- ` /companies/<number>/relationships/products `
65- ` /companies/<number>/relationships/individuals,products `
61+ ` individuals/<number>?included=<companies>,<individual-types> `
6662
67- ` individuals/<number>/companies `
68- ` individuals/<number>/individual-types `
69- ` individuals/<number>/companies,individual-types `
63+ ` individual-types/<number>?included=<individuals> `
7064
71- ` individuals/<number>/relationships/companies `
72- ` individuals/<number>/relationships/individual-types `
73- ` individuals/<number>/relationships/companies,individual-types `
65+ ` products/<number>?included=<companies>,<product-types> `
7466
75- ` individual-types/<number>/individuals `
76- ` individual-types/<number>/relationships/individuals `
77-
78- ` products/<number>/companies `
79- ` products/<number>/product-types `
80- ` products/<number>/companies,product-types `
81-
82- ` products/<number>/relationships/companies `
83- ` products/<number>/relationships/product-types `
84- ` products/<number>/relationships/companies,product-types `
85-
86- ` product-types/<number>/products `
87- ` product-types/<number>/relationships/products `
67+ ` product-types/<number>?included=<products> `
8868
8969
9070
@@ -165,13 +145,111 @@ The record always has `id` and `type` present at the top level. `id` is the uniq
165145}
166146```
167147
148+ ` /products/1134?includes=companies,product-types `
149+
150+ ``` json
151+ {
152+ "jsonapi" : {
153+ "version" : " 1.0"
154+ },
155+ "data" : [
156+ {
157+ "type" : " products" ,
158+ "id" : " 1134" ,
159+ "attributes" : {
160+ "typeId" : 890 ,
161+ "name" : " prd-a-5b64af7e70741" ,
162+ "description" : " 5b64af7e7074a" ,
163+ "quantity" : 25 ,
164+ "price" : " 19.99"
165+ },
166+ "links" : {
167+ "self" : " http:\/\/ api.phalcon.ld\/ products\/ 1134"
168+ },
169+ "relationships" : {
170+ "companies" : {
171+ "links" : {
172+ "self" : " http:\/\/ api.phalcon.ld\/ products\/ 1134\/ relationships\/ companies" ,
173+ "related" : " http:\/\/ api.phalcon.ld\/ products\/ 1134\/ companies"
174+ },
175+ "data" : [
176+ {
177+ "type" : " companies" ,
178+ "id" : " 1430"
179+ },
180+ {
181+ "type" : " companies" ,
182+ "id" : " 1431"
183+ }
184+ ]
185+ },
186+ "product-types" : {
187+ "links" : {
188+ "self" : " http:\/\/ api.phalcon.ld\/ products\/ 1134\/ relationships\/ product-types" ,
189+ "related" : " http:\/\/ api.phalcon.ld\/ products\/ 1134\/ product-types"
190+ },
191+ "data" : {
192+ "type" : " product-types" ,
193+ "id" : " 890"
194+ }
195+ }
196+ }
197+ }
198+ ],
199+ "included" : [
200+ {
201+ "type" : " companies" ,
202+ "id" : " 1430" ,
203+ "attributes" : {
204+ "name" : " com-a5b64af7e6c846" ,
205+ "address" : " 5b64af7e6c84f" ,
206+ "city" : " 5b64af7e6c855" ,
207+ "phone" : " 5b64af7e6c85c"
208+ },
209+ "links" : {
210+ "self" : " http:\/\/ api.phalcon.ld\/ companies\/ 1430"
211+ }
212+ },
213+ {
214+ "type" : " companies" ,
215+ "id" : " 1431" ,
216+ "attributes" : {
217+ "name" : " com-b5b64af7e6e3d3" ,
218+ "address" : " 5b64af7e6e3dc" ,
219+ "city" : " 5b64af7e6e3e2" ,
220+ "phone" : " 5b64af7e6e3e9"
221+ },
222+ "links" : {
223+ "self" : " http:\/\/ api.phalcon.ld\/ companies\/ 1431"
224+ }
225+ },
226+ {
227+ "type" : " product-types" ,
228+ "id" : " 890" ,
229+ "attributes" : {
230+ "name" : " prt-a-5b64af7e6f638" ,
231+ "description" : " 5b64af7e6f641"
232+ },
233+ "links" : {
234+ "self" : " http:\/\/ api.phalcon.ld\/ product-types\/ 890"
235+ }
236+ }
237+ ],
238+ "meta" : {
239+ "timestamp" : " 2018-08-03T19:39:42+00:00" ,
240+ "hash" : " 384c6b3772727b1a9532865d2ae2d51c095c0fd9"
241+ }
242+ }
243+ ```
244+
168245For more information regarding responses, please check [ JSON API] ( https://jsonapi.org )
169246
170247### TODO
171248- ~~ Work on companies GET~~
172- - ~~ Work on relationships and data returned ~~
249+ - ~~ Work on included data~~
173250- Write examples of code to send to the client
174251- Create docs endpoint
252+ - Work on relationships
175253- Work on pagination
176254- Work on filters
177255- Work on sorting
0 commit comments