Giter Club home page Giter Club logo

Comments (7)

Simperfit avatar Simperfit commented on May 10, 2024 1

@renan-taranto HAL is now implemented in V2.

from api-platform.

dunglas avatar dunglas commented on May 10, 2024

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.

renan-taranto avatar renan-taranto commented on May 10, 2024

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.

leroy0211 avatar leroy0211 commented on May 10, 2024

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.

renan-taranto avatar renan-taranto commented on May 10, 2024

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.

dunglas avatar dunglas commented on May 10, 2024

@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.

renan-taranto avatar renan-taranto commented on May 10, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.