How to

Get redirects mapping

Retrieve URL and slug (alias) redirects to manage and audit your site's redirection rules.

Retrieve URL and slug (alias) redirects to manage and audit your site's redirection rules. Url redirects are managed in Merchant Center via an import template. Slug (alias) redirects are managed automatically by the system when slugs are changed for entities like products or categories.

Prerequisites

  • Management API key and api user with access.
  • Basic understanding of URLs and slugs in Geins
  • Familiarity with your platform's URL structure

Goal

  • Retrieve all URL redirects
  • Retrieve all slug (alias) redirects
  • Use this data to manage and audit your site's redirection rules

Architecture at a glance

  • Use the Management API to fetch URL and alias redirects → Process and utilize the data as needed

Step-by-step

Fetch URL redirects using Management API

Request example

cURL
curl -L 'https://mgmtapi.geins.io/API/redirect/url/1?currentCheckpoint=2025-01-01&nextCheckpoint=2025-02-01' \
-H 'Accept: application/json' \
-H "X-ApiKey: {MGMT_API_KEY}" \
-u "{MGMT_USERNAME}:{MGMT_PASSWORD}" \

Response example

200 OK
response.json
{
    "Resource": [
        {
            "OldUrl": "/old-path",
            "NewUrl": "/new-path",
            "MarketId": 1,
            "Action": "update",
        }
    ],
    "Message": "string",
    "Details": ["string"]
}

Fetch slug (alias) redirects using Management API

Request example

cURL
curl -L 'https://mgmtapi.geins.io/API/redirect/alias/1?currentCheckpoint=2025-01-01&nextCheckpoint=2025-02-01' \
-H 'Accept: application/json' \
-H "X-ApiKey: {MGMT_API_KEY}" \
-u "{MGMT_USERNAME}:{MGMT_PASSWORD}"

Response example

200 OK
response.json
{
    "Resource": [
        {
            "OldUrl": "old-alias",
            "NewUrl": "new-alias",
            "MarketId": 1,
            "Action": "update",
        }
    ],
    "Message": "string",
    "Details": ["string"]
}

Key points

  • Use currentCheckpoint and nextCheckpoint parameters to fetch redirects within a specific time range
  • The Action field indicates whether the redirect was updated or deleted
  • Both URL and alias redirects return the same response structure

Process URL redirects

  • Use the fetched URL redirects to update your platform's routing rules or for auditing purposes
  • Ensure that old URLs correctly redirect to the new URLs as per the mapping

Process alias redirects

  • Use the fetched alias redirects to update your platform's slug management system
  • Ensure that old slugs correctly are replaced with new slugs in your platform's URL structure

Regularly update redirects

  • Schedule regular fetches of redirects to keep your platform's routing and slug management up to date