Comments (7)
@renan-taranto HAL is now implemented in V2.
from api-platform.
In fact HATEOAS is supported out of the box by API Platform. By default, all APIs are compliant with JSON-LD and Hydra (W3C recommandations about Linked Data/HATEOAS).
Adding support for other HATEOAS formats such as HAL or SIREN should be really easy in the dev-master
version thanks to Content Negotiation: https://github.com/api-platform/doc/blob/master/api-bundle/content-negotiation.md
If someone start to work on supporting such formats, I'll be pleased to merge it upstream.
from api-platform.
I wonder how to add link elements (that indicates related possible actions) to the representation of a resource using api-platform. And how to dinamically add/remove these links like is shown in this example http://restcookbook.com/Basics/hateoas/.
Could you give me some hints or maybe an example?
from api-platform.
A few weeks ago I've seen a symfony bundle that can add linked data to entities by using only annotations.
For example to publish a blog post. The /publish
or /unpublish
links could be added as a Relation with specific expressions like only add the /publish
link if the isPublished()
method returns false
. And only if the requested user has the ADMIN
role.
I've just found the related bundle: https://github.com/willdurand/BazingaHateoasBundle
I think this can be usefull, but might not be the best solution to integrate these links/actions.
from api-platform.
Thank you very much leroy0211. I'm just learning, so for now I will use FOSRest, JSMSerializer and BazingaHateoas until I find a way to do that with API Platform.
from api-platform.
@renan-taranto You want HAL support right? You can do it (yourself) with the dev-master version. You need to implement a Symfony Normalizer implementing HAL support like we've done for JSON-LD: https://github.com/dunglas/DunglasApiBundle/blob/master/JsonLd/Serializer/ItemNormalizer.php
from api-platform.
@dunglas I am new to JSON-LD and after some researches on the web I believe that what I want is not supported by it. I will read about the Symfony Normalizer and try to implement HAL. Thanks for the great framework man.
from api-platform.
Related Issues (20)
- unable to declare a virtual property in singular HOT 2
- Docker php container can't start when Mercure is enabled HOT 1
- GenId in yaml not working?
- Reference in ApiProperty no longer overwrites default reference HOT 1
- Build in production failed : nuxt not found
- ld-json not encoded by Caddyfile
- Error when adding Redis in Dockerfile HOT 2
- Docs: [codeselector] broken on graphql docs page HOT 1
- could not translate host name
- Problem: The owning side of an association has no "mappedBy" field. HOT 4
- Hydra RFC: Setting the hydra:title property
- [CRITICAL] Admin Page Not Working on Fresh Install HOT 9
- PATCH route with custom uriTemplate ignores state provider
- Json LD response are encoded to HTML chars ?
- compile(): Return value must be of type string, null returned HOT 3
- Docs OpenAPI yaml serializer not working HOT 1
- Disabling Doctrine support clears up Swagger docs HOT 1
- Building API Plaform behind corporate proxy and injected certificate
- Versioning. Did version 3.2.16 changed? HOT 3
- ValidationException returns stack trace instead of a list of violations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from api-platform.