Questions tagged [hal-json]

HAL - Hypertext Application Language is a format you can use in your API that gives you a simple way of linking. It has two variants, JSON and XML.

HAL provides a set of conventions for expressing hyperlinks to, and embeddedness of, related resources - the rest of a HAL document is just plain old JSON or XML.

Instead of using linkless JSON/XML, or spending time developing a custom media type, you can just use HAL and focus on defining and documenting the link relations that direct your clients through your API.

HAL is a bit like HTML for machines, in that it is generic and designed to drive many different types of application. The difference is that HTML has features for presenting a graphical hypermedia interface to a ‘human actor’, whereas HAL is intended for presenting a machine hypertext interface to ‘automated actors’.

67 questions
1
vote
0 answers

How to return a single item from a query with spring data REST

How can we make spring-data-rest return a single resource for a query, instead of an embedded list? This would make navigation much more intuitive for the client. e.g. t.follow("search", "byNameAndType", "identity", "mainContact") instead…
dan carter
  • 4,158
  • 1
  • 33
  • 34
1
vote
1 answer

spring-data-rest HAL base urls in api management platform

So i have a spring-data-rest app hosted in heroku: hotel-app.herokuapp.com but i want to expose it in an api management platform like mashape. curl --get --include "https://greekscholar-test-v1.p.mashape.com/" \ -H "X-Mashape-Key:…
0
votes
1 answer

How do I use JavaScript Traverson HAL $all meta selector?

Per the JavaScript Traverson HAL documentation For embedded arrays you can additionally use the meta selector $all, which operates on embedded documents: If you pass ht:post[$all] to the follow method, you receive the complete array of posts, not…
James
  • 2,876
  • 18
  • 72
  • 116
0
votes
2 answers

Sub-resource creation url

Lets assume we have some main-resource and a related sub-resource with 1-n relation; User of the API can: list main-resources so GET /main-resources endpoint. list sub-resources so GET /sub-resources endpoint. list sub-resources of a main-resource…
Yakup Türkan
  • 576
  • 2
  • 6
  • 21
0
votes
0 answers

HATEOAS Optional Steps for Resource

Lets say we have 2 resources with relation such as: Creative Organization Each creation attempt can start with: Creation of an Organization Creation of a Creative But if user already has an Organization, can skip the creation of Organization and…
Yakup Türkan
  • 576
  • 2
  • 6
  • 21
0
votes
2 answers

Should using Traverson for consuming Spring HATEOAS HAL response result in duplicate invocations of the service?

I have a REST endpoint (like http://myapi.rest.com/someEndpoint?offset=40&limit=20) that vends out HAL JSON response like the following { "_embedded": { "listOfObjects": [ { "att1":"value1", …
Seagull
  • 2,219
  • 6
  • 25
  • 33
0
votes
1 answer

JSON HAL - specify different formats for links

I know that you can indicate a "type" with a HAL link, like so: { _links: { self: { href: "http://example.site/api/orders/1", hreflang: "en_US", type: "application/hal+json" } } } But I'd…
Mr Mikkél
  • 2,577
  • 4
  • 34
  • 52
0
votes
1 answer

Codable HAL JSON types

Does anyone have a process to manage HAL type JSON data? The problem I'm running into is that all data requests will return a container that embeds it's actual type into an "_embedded" key. I'm struggling with figuring out how to decode out of this…
0
votes
2 answers

Missing paging arguments in generated HAL self link

I am using Spring Boot (2.1.1) to automatically create an HAL REST API of my JpaRepository interfaces. For most cases these interfaces are empty, for example: public interface LevelRepository extends JpaRepository {} When I open my…
gillesB
  • 1,061
  • 1
  • 14
  • 30
0
votes
0 answers

How to consume Spring Data Rest API response with Retrofit 2 when relationship is empty?

I am developing Android application and backend is being written using Spring Rest Data. Scenario: Let's say I want to list user's favorite products. I need to call GET /v1/users/4/favoriteProducts providing access token in headers. If user has…
clzola
  • 1,925
  • 3
  • 30
  • 49
0
votes
1 answer

Using HAL-browser with spring-hateoas WITHOUT spring-data-rest

We're starting a new project, and we're looking into using spring-hateoas / hypermedia. The HAL browser also looks interesting, so we wanted to check it out. However, the HAL browser seems bundled to spring-data-rest, which we don't want to use (for…
runeaen
  • 461
  • 5
  • 22
0
votes
1 answer

Deal with application/hal+json format in wcf

I set up a configured URL endpoint (using wcf and POST method) to be trigged when something happens at my client side. it works well when the content type, for the request, is set to application/json, but it doesn't when it is set to…
R.You
  • 565
  • 3
  • 15
0
votes
2 answers

How to enable Json pretty print on Apigility ApiProblem response?

I would like to know how to set ApiProblem response to pretty print Json by default.
0
votes
1 answer

What's the correct way to present paged resources with HAL?

This sounds like a rookie question, but I'm wondering what's the best way to present paged resources with HAL format? Right now I'm using Spring HATEOAS API to convert Page object into resource PagedResourcesAssembler#toResource(Page,…
Derek
  • 1,085
  • 2
  • 20
  • 36
0
votes
1 answer

What is better between one link versus an array of links?

Option 1: Return as many links as there are resources. { "teamName": "Steelers" "links": { "players": [ { "href": "http://api.com/players/1" }, { "href": "http://api.com/players/2" }, …
user3408654
  • 301
  • 1
  • 13