mirror of
https://github.com/adidas/api-guidelines.git
synced 2025-10-25 15:19:19 +00:00
Changes related to Apiary and Mashery. Also related to LRTs cases and mentions to SwaggerHub.
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
# HAL
|
||||
|
||||
The [`application/hal+json`](http://stateless.co/hal_specification.html) \(HAL\) **MUST** be used as the representation format of a resource.
|
||||
The Hypertext Application Language [`application/hal+json`](http://stateless.co/hal_specification.html) \(HAL\) **MUST** be used as the representation format of a resource.
|
||||
|
||||
## Introduction to HAL
|
||||
|
||||
> _HAL is a simple format that gives a consistent and easy way to hyperlink between resources in your API._
|
||||
|
||||
The HAL format is strictly coupled to [HATEOAS](https://en.wikipedia.org/wiki/HATEOAS). The main target of HATEOAS is to decouple the API Consumer from the paths used ion the API. The API Client uses the links generated by our API instead of building them from the documentation. This is less eror-prone for the API Consumer and it can allow making changes in the API without affecting the API Consumer code.
|
||||
|
||||
This document is an informal introduction to the HAL media type. For more details see [HAL - Hypertext Application Language Specification](http://stateless.co/hal_specification.html).
|
||||
|
||||
## HAL Document Object Model
|
||||
|
||||
HAL document follow the object model defined in JSON-schema [here](https://supermodel.io/adidas/api/HAL).
|
||||
HAL document follow the object model defined in JSON-schema [here](https://supermodel.io/adidas/api/HAL).
|
||||
|
||||
IANA created a list explaining the standard relationships for REST. Do not forget to have a look [here](http://www.iana.org/assignments/link-relations/link-relations.xhtml) to find the role of each type of relation.
|
||||
|
||||
YAML code snippets are provided for [OpenAPI Specification 2.0/Swagger](https://github.com/adidas/api-guidelines/tree/4a033eb0cf8ec582102c09c1eb5ba1fa8a5597d9/rest-api-guidelines/functionality/message/HAL-snippet.yaml) and [OpenAPI Specification 3.x](https://github.com/adidas/api-guidelines/tree/4a033eb0cf8ec582102c09c1eb5ba1fa8a5597d9/rest-api-guidelines/functionality/message/HAL-snippet-full-OpenApi3.yaml).
|
||||
|
||||
@@ -119,9 +123,18 @@ Some APIs using HAL:
|
||||
|
||||
Refer to the [extensive list of libraries that work with HAL](https://github.com/mikekelly/hal_specification/wiki/Libraries).
|
||||
|
||||
For working with HAL and Node.js using [HALson npm package](https://www.npmjs.com/package/halson) is suggested.
|
||||
### Java
|
||||
|
||||
### Spring Framework
|
||||
#### Spring Framework
|
||||
|
||||
Spring framework supports HAL out of the box. More info can be found in [Spring Documentation](https://spring.io/guides/gs/rest-hateoas/) and [examples](https://github.com/spring-guides/gs-rest-hateoas).
|
||||
|
||||
#### Quarkus Framework
|
||||
|
||||
Quarkus framework supports HAL out of the box. More info can be found in [Quarkus Documentation](https://quarkus.io/guides/rest-data-panache).
|
||||
|
||||
### NodeJS
|
||||
|
||||
For working with HAL and Node.js using [HALson npm package](https://www.npmjs.com/package/halson) is suggested.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user