ÃÛ¶¹ÊÓÆµ

AEM APIs for Structured Content Delivery and Management aem-apis-structured-content-delivery-and-management

ÃÛ¶¹ÊÓÆµ Experience Manager (AEM) as a Cloud Service offers multiple APIs for both structured content delivery from Content Fragments and Content Fragment management. See the individual pages for further details of the specific APIs.

REST vs GraphQL rest-vs-graphql

The API used is a decision for the developers - AEM supports both.

Many comparisons are available online, but a few highlights and benefits of REST include:

  • Simplicity

    • Developers are (often) familiar with HTTP and REST. According to the , a high percentage of developers use REST.

    • With simplicity comes familiarity. With REST there are no organizational questions of who owns the queries and who owns the app, whereas these questions can arise with GraphQL.

    • With familiarity (typically) comes a broad community and tooling landscape. Not an inherent disadvantage of GraphQL, but likely to be broader and deeper for REST.

    • The simpler approach can also make the security implementation easier. With REST, the filtering to determine the content to render all happens in the client app. With GraphQL this happens in a schema-based query between client and server.

  • Flexibility

    • With REST, the developer can GET any resource. With GraphQL they are limited to resources defined within a schema.
  • Caching

    • JSON responses to REST GET requests are inherently cacheable. GraphQL POST requests are not cacheable, unless they are made so; for example, by using AEM Persisted Queries that are stored on the server and requested with REST-like GETrequests.

Benefits of GraphQL include:

  • Efficiency of content delivery

    • Focus

      • With GraphQL client applications can request the exact content that they need for rendering - and no more. This approach prevents content over-delivery, with excessive content payloads, and unnecessary bandwidth consumption.
    • Single endpoint

      • While in REST every API request is an endpoint, in GraphQL there is only one common endpoint, and different content requests are expressed as queries using that common endpoint.
  • Rapid Prototyping

    • With GraphQL this is a one-step process, brought together in the GraphQL query, and can make prototyping easier. REST on the other hand is a 2-step process:

      1. Fetch content with API.
      2. In the JSON response, determine what to use for rendering in the client app.
recommendation-more-help
fbcff2a9-b6fe-4574-b04a-21e75df764ab