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

How to Convert HAL JSON to OpenAPI JSON for JavaScript Client API Generation

We have a Spring Data Rest project producing HAL JSON. We would like to automatically produce a JavaScript Client API based on the HAL JSON. We can very simply convert OpenAPI JSON to a JS Client API using OpenAPITools/openapi-generator, but we have…
KevinB
  • 1,102
  • 2
  • 8
  • 19
1
vote
3 answers

How to return JSON without wrapper from Spring ResponseEntity?

Controller returns ResponseEntity @GetMapping("/users/{id}") public ResponseEntity getUserById{} User resource is extended from RestResource public class UserResource extends ResourceSupport {} When I call the rest API, I get { …
erotsppa
  • 14,248
  • 33
  • 123
  • 181
1
vote
1 answer

HAL links with singular noun instead of plural noun when following rel-links

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 ProjectRepository extends JpaRepository {} public…
gillesB
  • 1,061
  • 1
  • 14
  • 30
1
vote
1 answer

How to use Hal+Json with AWS AppSync

My backend resturns json using the media type hal+json(rest api). The problem here is that velocity resolver of AWS AppSync returns: Lexical error, Encountered: \"_\" (95), after:\".\" at unset[line 8, column 28]" Because the media type node…
1
vote
1 answer

REST. Comparing two JSON representations

I have a tag system: Tag id name children tags so they could be nested (max depth 3) for example: Food Restaurant Fast food Chinese food Medicine Hospitals Pharmacy Entertainment Extreme Skiing Skating Family And I have some…
You Care
  • 488
  • 4
  • 20
1
vote
0 answers

Wordpress REST API using Content-Type: application/json versus Content-Type: application/json+hal

I've built some custom routes using the Wordpress REST API (native), and would like to use HAL to reduce the number of server requests. Does HAL do this (is my premise correct)? My current header Content-Type is "application/json". Further, when…
fardarter
  • 86
  • 7
1
vote
1 answer

Android/Retrofit HAL JSON support

I'm using Retrofit in my Android project to handle REST web service calls. Now I need to add support HAL JSON to be able to implement dynamic adding items to my list (load more on scrool). HalJson: http://stateless.co/hal_specification.html Does…
user1209216
  • 7,404
  • 12
  • 60
  • 123
1
vote
0 answers

Using custom serializer in Ember with hal json from Apigility

So I'm in the process of building out the front end of our site, and long story short, the location of our API call is through apigility. I'm fairly new to Ember, so I've been having to piece of a lot of info together on the best way to make this…
ELepolt
  • 373
  • 2
  • 4
  • 16
1
vote
1 answer

Android parse HAL+JSON

I have a problem parsing a HAL+JSON Object in android. This is my code: package com.example.philipp.productshopproject; import android.os.AsyncTask; import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import…
1
vote
1 answer

HAL Specification - Should self link contain query parameter?

Following the HAL specification should the self link contain the query parameter or is it ok to link to the first page? Thanks Follows an example: Request: my-service/movies/123/subtitles?page=3 Actual JSON response: { "count": 20, "pagingSize":…
Gabe
  • 5,997
  • 5
  • 46
  • 92
1
vote
0 answers

unable to follow link of hyperlink based api on client side using traverson.js

i am new to using hyperlink based api, to accessing the api and it links i am using traverson.js and traverson-hal.js in my client side application. the problem is when ever i make a call and pass the link to be follow in follow() it gives error msg…
Ashish Patel
  • 921
  • 1
  • 10
  • 26
1
vote
1 answer

HAL - RESTful response with links only

How should a response for a set of links be in order to comply with REST principles (HATEOAS) and HAL (specification, Internet-draft)? Is it alright to have no attributes on the first level of the JSON body and have just the _links section with the…
Gabe
  • 5,997
  • 5
  • 46
  • 92
1
vote
1 answer

HAL+JSON representation for links with the same rel

The HAL specification says: Note: If you're unsure whether the link should be singular, assume it will be multiple. If you pick singular and find you need to change it, you will need to create a new link relation or face breaking existing …
Vivin Paliath
  • 94,126
  • 40
  • 223
  • 295
1
vote
1 answer

Bookmark AngularJS frontend (direct access) - Spring Data Rest backend

I've started to implement a web-front end to manipulate a RESTful service served by Spring Data Rest over a traditional relational DB. This is done with AngularJS and the angular-hal library that I found fits very well the HATEOAS philosophy and…
JR Utily
  • 1,792
  • 1
  • 23
  • 38
1
vote
0 answers

Dropwizard + Halbuilder looking for message body writer

I'm using dropwizard to build a Restful service. I'm using halbuilder to create json+hal media type. My resource is returning a representation with a few links on a get request. It works perfectly fine on my dev environment but when I deploy my…
Nima M
  • 718
  • 10
  • 18