I've verified my API server using the HAL-browser, but when I try hyperresource it doesn't search properly on the underlying products collection.
GET /products returns this:
{
"_links": {
"self": {
"href": "/"
},
"curies": [
{
"name": "ht",
"href": "http://localhost:8080:/rels/{rel}",
"templated": true
}
],
"ht:products": {
"href": "/products"
},
"ht:users": {
"href": "/users"
}
},
"welcome": "Welcome to Kiffin's Demo HAL Server.",
"hint_1": "This is the first hint.",
"hint_2": "This is the second hint.",
"hint_3": "This is the third hint.",
"hint_4": "This is the fourth hint.",
"hint_5": "This is the last hint."
}
GET /products returns this:
{
"_links": {
"self": {
"href": "/products"
},
"curies": [
{
"name": "ht",
"href": "http://localhost:8080:/rels/{rel}",
"templated": true
}
],
"ht:product": [
{
"href": "/products/1",
"id": 1,
"name": "bathtub",
"category": "animal",
"price": 4510
},
{
"href": "/products/2",
"id": 2,
"name": "dragon",
"category": "book",
"price": 9617
},
...
]
}
}
GET /products/2 returns this:
{
"_links": {
"self": {
"href": "/products/2"
},
"curies": [
{
"name": "ht",
"href": "http://localhost:8080:/rels/{rel}",
"templated": true
}
]
},
"name": "dragon",
"category": "book",
"price": 9617
}
So far so good. However, following the documentation verbatim, here's what I see:
api.get => GET /
api.products => GET /
api.products(id: 2) => GET /products
I have the following questions:
- What am I doing wrong (if anything)?
- How can I display the product w/attributes?
- How do I iterate through the products and displaying the attributes of each one?
I've verified my API server using the HAL-browser, but when I try
hyperresourceit doesn't search properly on the underlying products collection.GET /productsreturns this:{ "_links": { "self": { "href": "/" }, "curies": [ { "name": "ht", "href": "http://localhost:8080:/rels/{rel}", "templated": true } ], "ht:products": { "href": "/products" }, "ht:users": { "href": "/users" } }, "welcome": "Welcome to Kiffin's Demo HAL Server.", "hint_1": "This is the first hint.", "hint_2": "This is the second hint.", "hint_3": "This is the third hint.", "hint_4": "This is the fourth hint.", "hint_5": "This is the last hint." }GET /productsreturns this:{ "_links": { "self": { "href": "/products" }, "curies": [ { "name": "ht", "href": "http://localhost:8080:/rels/{rel}", "templated": true } ], "ht:product": [ { "href": "/products/1", "id": 1, "name": "bathtub", "category": "animal", "price": 4510 }, { "href": "/products/2", "id": 2, "name": "dragon", "category": "book", "price": 9617 }, ... ] } }GET /products/2returns this:{ "_links": { "self": { "href": "/products/2" }, "curies": [ { "name": "ht", "href": "http://localhost:8080:/rels/{rel}", "templated": true } ] }, "name": "dragon", "category": "book", "price": 9617 }So far so good. However, following the documentation verbatim, here's what I see:
I have the following questions: