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
3
votes
1 answer

How to create a field_collection_item using the RESTful Web Services API in DRUPAL 8

I have installed RESTful Web Services on my Drupal 8 site, I activated the field_collection_item resource (/field_collection_item/{field_collection_item}) with all the methods available (GET, POST, etc with authentication:basic_auth, cookie and…
3
votes
1 answer

Spring-Hateoas Client using Traverson

I want to consume my rest-service by Spring-Hateoas by Traverson, but I come to the following issue I didn't find anything in web. I am using Spring-Boot 1.1.10.RELEASE. My Client Call looks like follows: ... final Traverson traverson = new…
Michael Hegner
  • 5,555
  • 9
  • 38
  • 64
3
votes
4 answers

SPRING-DATA-REST Backend with AngularJS frontend

Is there any frontend application sample that consumes RESTful services of Spring-data-rest backend which is written with angularJS.
Atıfcan Ergin
  • 138
  • 1
  • 14
3
votes
1 answer

No self href in embedded HAL resource collection

I use the self href from my HAL resources on the client side to find the right path for the CRUD operations. In single(ton) resources this is working fine (see the address resource below, the _links containing the self href is included in the…
Wilt
  • 41,477
  • 12
  • 152
  • 203
2
votes
1 answer

Map HATEOAS links to actual API links

I'm trying to implement a HATEOAS Rest Client using Spring Boot. Right now, I'm stuck in a point where I need to convert HATEOAS into an actual API URI. If I post a new object of type Customer like: { "name": "Frank", "address":…
Alberto Castaño
  • 186
  • 5
  • 16
2
votes
2 answers

Angular - convert HAL to JSON

The following service extracts category objects from a REST service which returns them in HAL format. Now I try to convert that response into JSON. For that I searched and tried different solutions, e.g. chariotsolutions or so. Some are based on…
Mfried
  • 57
  • 2
  • 9
2
votes
1 answer

Hal+json viewer in Firefox

The Firefox JSON Viewer shows up whenever the type is "application/json", but prompts for file download when given "application/hal+json". This used to be avoidable by just using the JSON View extension - but that is not currently supported in…
Finlay Smith
  • 251
  • 1
  • 10
2
votes
1 answer

Can a link in a hal/json element return a 404?

Im implementing a hal/json api. The root object (soldier) has a related object (sword), that is mapped under /soldier/{object_id}/sword { "id": 12345, "name": "Sir SmokeALot", "_links": { "self": { "href":…
cari
  • 2,251
  • 2
  • 18
  • 27
2
votes
0 answers

Angular, content type is not being sent with $http Part 2

With respect to a previous question, I'm still facing an issue where Content-Type doesn't seem to be sent to the preflight request, with OPTIONS enabled on the server, AND the data being populated as a json object. I've been bouncing between a HAL…
AlxVallejo
  • 3,066
  • 6
  • 50
  • 74
2
votes
0 answers

Spring HAL creating associated sub resource

Please check question POSTing a @OneToMany sub-resource association in Spring Data REST Now the common sense says to me to create a new comment, I should be able to make a POST to for example http://localhost/posts/1/comments. And at the same time,…
aycanadal
  • 1,106
  • 2
  • 15
  • 42
2
votes
1 answer

Resttemplate - how to post object with HAL representation?

When attempting to post to a Spring-Data-Rest web service via RestTemplate, the JSON representation of my domain object is being converted to a full blown JSON object that isn't in HAL representation. My assumption here is that I need to register…
Vlad
  • 51
  • 6
2
votes
1 answer

HAL JSON - is it allowed by the standard to have multiple levels of embeds?

I was wondering if it is allowed to have more _embed elements inside _embed elements in JSON, or if the idea is to only have one level? See example of normal HAL: { "_links": { "self": { "href": "/orders" }, "curies": [{ "name": "ea",…
Piddien
  • 1,436
  • 4
  • 18
  • 38
1
vote
1 answer

How do I configure Spring Data REST to return links with templated ID such as users/{id}

Suppose I have Spring Data repository for a User entity. Then, Spring Data REST produces the following HAL JSON at its base path: { "_links": { "users": { "href": "http://localhost:8080/users" } } } I also want my clients to know…
James
  • 2,876
  • 18
  • 72
  • 116
1
vote
0 answers

How to specify mandatory and optional links in OpenAPI for schemas in HAL format?

When writing schemas for request or response objects in OpenAPI, I would like to specify which link relations are to expect (mandatory or optional). However, using HATEOAS links are stored in a list in RepresentationModel, and I wouldn't want to…
Landei
  • 54,104
  • 13
  • 100
  • 195
1
vote
1 answer

Parametarized links in HAL json

Assuming I have an endpoint GET /api/foos/{id} which has optional parameters: includes, query, type should I create a link for each of the 'usecases' or can I include it as a single link? Should it look more like this: "_links":{ "self": {…
fiji3300
  • 103
  • 7