Last active
May 27, 2017 05:48
-
-
Save ariesmcrae/39f77fa7aa748acb50b114a6257da776 to your computer and use it in GitHub Desktop.
curl api.mycompany.com/v1/summaries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// curl api.mycompany.com/v1/summaries | |
[ | |
{ | |
"key":"Summary_2016_09_05_20_52_48", | |
"value":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_48.xls", | |
"links":[ | |
{ | |
"rel":"self", | |
"href":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_48" | |
} | |
] | |
}, | |
{ | |
"key":"Summary_2016_09_05_20_52_49", | |
"value":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_49.xls", | |
"links":[ | |
{ | |
"rel":"self", | |
"href":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_49" | |
} | |
] | |
} | |
] | |
// Question: So what happens when the client invokes the HATEOAS link 'href":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_48' ? | |
// Answer: It should return more detailed info about the file. | |
// eg. Return detailed info about employee 1: curl api.mycompany.com/v1/employees/1 | |
{ | |
"employeeId":"1", | |
"firstName":"Tim", | |
"surname":"Smith", | |
"department":"Human Resource", | |
"firstLineManager":"Betty Williams", | |
"links":[ | |
{ | |
"rel":"self", | |
"href":"http://api.mycompany.com/v1/employees/1" | |
} | |
] | |
} | |
// curl api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_48 | |
{ | |
"key":"Summary_2016_09_05_20_52_48", | |
"value":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_48.xls", | |
"fileSize":"109K", | |
"format":"Microsoft Excel 2010", | |
"links":[ | |
{ | |
"rel":"self", | |
"href":"http://api.mycompany.com/v1/summaries/Summary_2016_09_05_20_52_48" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment