Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Exploring Your API With New Tools - HAL Browser

How do I link a review to a course via the HAL browser?

I was playing around with the HAL browser and was wondering if this is possible? I can create reviews and I can create courses. But at a first glance I don't seem to be able to link them... Am I missing something? Thx

2 Answers

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

What do you exactly mean, by

I don't seem to be able to link them

Please specify more.

Spring Data REST with HATEOAS, works in a way that everything is done with links.

When you save Course or Review, it automatically creates a link following which one can find that Course/Review

When you POST or PUT Review related to Course, yo have to specify link to Course in Review JSON.

So in General when you want to POST/PUT something with relationship you specify link.

What do you mean by "able to link them" I don't know...

Ok, I try to be more clear. Sorry. When I talk about creating courses or reviews I specifically mean creating a course or a review via the HAL browser. When I do a post request on review I see a form where I can enter rating, description and reviewer. When I do a post on course I see a form where I can enter title and url. But there is nowhere a field to post the review I created earlier... I know if I use tools like Postman where I can create the JSON myself it is not a problem. I am just asking how this could be done in the HAL browser. I am just curious. I couldn't find any example doing this. Thx!

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

That is a nice thing. I also always wanted to customize HAL browser.

It is written in JavaScript. Take a look here

https://github.com/spring-projects/spring-data-rest/tree/master/spring-data-rest-hal-browser

The one above is link to browser used in Spring Data Rest

If you go further you get to "index.html" and "js" folder. That is where all HAL Browser is defined for REST

Original HAL Browser with description of how to customize it is here

https://github.com/mikekelly/hal-browser

I didn't fins any helpful resources about it, so I guess one hast to dig into it himself ...

May be someday when I have enough JavsScript knowledge, I'll try.

Or may be you have? ...

Anyway, by googling I could not found any other people custom implementations of HAL Browser integrated by Spring

May be you can find ...