Skip to content
Last update: March 26, 2024

Overview

The main function of the Experience API (xAPI) module is to serve as a middle layer connecting clients and enterprise services using the GraphQL protocol.

It is closely associated with a particular user or touchpoint experience and ensures quick and dependable access. Additionally, it serves as an implementation of the back end for front end (BFF) design pattern.

Source code

Latest release

GraphQL core ideas

GraphQL is a new API standard that provides a more efficient, powerful and flexible alternative to REST. When the concept of REST was developed, client applications were relatively simple, and the development pace wasn't nearly where it is today. However, the API landscape has radically changed over the last couple of years. In response to these evolving demands, GraphQL has emerged as a more adaptable solution. With GraphQL, each client can request precisely the data it needs, allowing for more tailored responses. In contrast, REST APIs often provide fixed sets of data, potentially leading to over-fetching or under-fetching of information.

graphQL-Rest

With GraphQL, clients can optimize their data queries, reducing network load, improving performance, and addressing the more complex and specific data requirements of modern applications. Client customize the endpoints using schema, which provides a description of how the data is structured and contains. Here is an part from Virto Commerce schema:

schema

Info

Another concept to know is a Variable. Is is placeholder that allows clients to pass values as arguments to a query or mutation without hard-coding those values directly into the query. Variables are defined in the query or mutation. They are then referenced in the query using the dollar sign ($). This feature makes GraphQL queries more reusable and flexible, as clients can change variable values when making requests.

Our insrtuction provides Virto Commerce related guidelines.

Readmore Extensive GraphQL guide

Sample queries
Query Sample query Sample return
Total amount of items in B2B-store total count query total count return
Names of all products in B2B-store names query names return
Names, codes, ids of products in B2B-store codes-ids-query codes-ids-return
Show first 2 products from the list first-products first-products

Key —Āoncepts

  • Utilize GraphQL protocol for precise and flexible data retrieval control from the API.
  • Achieve fast and dependable indexed search through integration with:
  • Maintain autonomy by exclusively relying on the index data source, separate from the rest of the VC data infrastructure.
  • Capture tracing and performance metrics for request monitoring.

Key features

The xAPI project provides the following major features: