Skip to content
Last update: October 2, 2024

Get Started

This section explains how to prepare your environment for testing xAPI.

Prerequisites

  • VC platform 3.0 or higher.
  • The platform is configured to use ElasticSearch engine.
    appsettings.json
    "Search": {
        "Provider": "ElasticSearch",
        "Scope": "default",
        "ElasticSearch": {
            "Server": "localhost:9200",
            "User": "elastic",
            "Key": "",
            "EnableHttpCompression": ""
        },
        "OrderFullTextSearchEnabled": true
    }
    

Presettings

To start using xAPI:

  1. Open the Platform and go to Settings.
  2. Select Catalog.
  3. Select Search.
  4. Enable Store serialized catalog objects in index option:

    Catalog-enabled

  5. Rebuild index.

Test environment

Note

If the xAPI module is not installed out-of-the-box, you can install it on the platform version 3.0 or higher by following this guide. Then restart the Platform.

Open GraphQL UI playground in the browser by navigating to http://{platform url}/ui/playground, and run some sample queries.

query {
  product(
    storeId: "B2B-store"
    id: "cc81104c-8528-490b-a7a8-d1fb53ca164b"
    cultureName: "en-US"
    currencyCode: "USD"
  ) {
    id
    name
    descriptions {
      content
    }
  }
}
{
  "data": {
    "product": {
      "id": "cc81104c-8528-490b-a7a8-d1fb53ca164b",
      "name": "Affligem Blond 6x75cl Bottle",
      "descriptions": [
        {
          "content": "qwetest123"
        }
      ]
    }
  }
}
query {
  products(
    query: "test"
    storeId: "B2B-store"
    currencyCode: "USD"
    cultureName: "en-US"
  ) {
    items {
      id
      name
      seoInfo {
        metaDescription
      }
    }
  }
}
{
  "data": {
    "products": {
      "items": [
        {
          "id": "05a51f40-c26d-47d4-a0c5-c13ab8f644d9",
          "name": "TEST stock < min",
          "seoInfo": {
            "metaDescription": ""
          }
        },
        {
          "id": "cb05e425-ced1-41bb-a28a-a1d592551bbf",
          "name": "TEST min  < max < stock",
          "seoInfo": {
            "metaDescription": ""
          }
        },
        {
          "id": "b0be673b-61bc-4912-b207-f4c3336f86e7",
          "name": "TEST min < stock < max",
          "seoInfo": {
            "metaDescription": ""
          }
        },
        // more items...
          }
        }
      ]
    }
  }
}

Authorization and token usage

Some GraphQL queries and mutations require additional authorization. To test the query or mutation without authorization errors:

  1. Open the Virto Commerce API Docs (v1) in your browser.
  2. Authorize as an administrator or manager.

    Auth

  3. Expand VirtoCommerce platform/POST/connect/token section to fill in the required fields with appropriate credentials, then click Execute.

    token

  4. Copy the token that appears in the field below:

    token

Providing token in Playground is decribed in the Playground section.

Providing token in Postman is described in Postman section.