Resolving search engine friendly URLs

Edit on GitHub

This endpoint allows resolving Search Engine Friendly (SEF) URLs into a resource URL in Glue API.

For SEO purposes, Spryker automatically generates SEF URLs for products and categories. The URLs are returned as a url attribute in responses related to abstract products and product categories. For examples of such responses, see:

In your development, the endpoints can help you to:

  • Significantly boost the SEO presence of your product store.
  • Increase the search engine ranking of your online store.

To facilitate their usage, Spryker Glue provides an endpoint that allows resolving an SEO-friendly URL, for example, http://mysprykershop.com/en/canon-powershot-n-35, into a URL of the relevant product resource in Glue API, for example, https://glue.mysprykershop.com/abstract-products/035. This capability is provided by the URLs API.

Installation

For detailed information about the modules that provide the API functionality and related installation instructions, see Install the Spryker Сore Glue API.

Resolve a SEF URL into a Glue API URL

To resolve a SEF URL into a Glue API URL, send the request:


GET /url-resolver?url={{SEF URL}}


PATH PARAMETER DESCRIPTION
{{SEF URL}} SEF URL you want to resolve. You can get it when:

Request

HEADER KEY HEADER VALUE REQUIRED DESCRIPTION
Accept-Language de Specifies the locale.
Request sample Usage
GET https://glue.mysprykershop.com/url-resolver?url=/de/acer-aspire-s7-134 Resolve the following URL of a product: https://mysprykershop.com/de/acer-aspire-s7-134.
GET https://glue.mysprykershop.com/url-resolver?url=/en/computer Resolve the following URL of a category node: https://mysprykershop.com/en/computer.
GET https://glue.mysprykershop.com/url-resolver?url=/de/ruecknahmegarantie Resolve the following URL of a CMS page https://mysprykershop.com/de/ruecknahmegarantie.
GET https://glue.mysprykershop.com/url-resolver?url=/en/merchant/budget-cameras Resolve the following URL of a merchant page: https://mysprykershop.com/en/merchant/budget-cameras.

Response

Response sample: resolve a product URL
{
    "data": [
        {
            "type": "url-resolver",
            "id": null,
            "attributes": {
                "entityType": "abstract-products",
                "entityId": "134"
            },
            "links": {
                "self": "https://glue.mysprykershop.com/url-resolver?url=/de/acer-aspire-s7-134"
            }
        }
    ],
    "links": {
        "self": "https://glue.mysprykershop.com/url-resolver?url=/de/acer-aspire-s7-134"
    }
}
Response sample: resolve a URL of a category node
{
    "data": [
        {
            "type": "url-resolver",
            "id": null,
            "attributes": {
                "entityType": "category-nodes",
                "entityId": "5"
            },
            "links": {
                "self": "https://glue.mysprykershop.com/url-resolver?url=/en/computer"
            }
        }
    ],
    "links": {
        "self": "https://glue.mysprykershop.com/url-resolver?url=/en/computer"
    }
}
Response sample: resolve a URL of a CMS page
{
    "data": [
        {
            "type": "url-resolver",
            "id": null,
            "attributes": {
                "entityType": "cms-pages",
                "entityId": "8d378933-22f9-54c7-b45e-db68f2d5d9a3"
            },
            "links": {
                "self": "https://glue.mysprykershop.com/url-resolver?url=/en/return-policy"
            }
        }
    ],
    "links": {
        "self": "https://glue.mysprykershop.com/url-resolver?url=/en/return-policy"
    }
}
Response sample: resolve a merchant page URL
{
    "data": [
        {
            "type": "url-resolver",
            "id": null,
            "attributes": {
                "entityType": "merchants",
                "entityId": "MER000005"
            },
            "links": {
                "self": "https://glue.mysprykershop.com/url-resolver?url=/en/merchant/budget-cameras"
            }
        }
    ],
    "links": {
        "self": "https://glue.mysprykershop.com/url-resolver?url=/en/merchant/budget-cameras"
    }
}
ATTRIBUTE TYPE DESCRIPTION
entityType String Resource type, like abstract-products or category-nodes, cms-pages or merchants.
entityId String Unique resource identifier.

Using the information from the response and the Glue server name, you can construct the Glue resource URLs. For example:

  • https://glue.mysprykershop.com/abstract-products/134
  • https://glue.mysprykershop.com/category-nodes/5
  • https://glue.mysprykershop.com/cms-pages/8d378933-22f9-54c7-b45e-db68f2d5d9a3
  • https://glue.mysprykershop.com/merchants/MER000005

Possible errors

STATUS REASON
404 The provided URL does not exist.
422 The url parameter is missing.

To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.