# Models

## The PrettyUrl object

````json
{"openapi":"3.1.0","info":{"title":"Pretty URLs API - URL Management & Dynamic Resolution","version":"1.0.0"},"components":{"schemas":{"PrettyUrl":{"type":"object","description":"Represents a URL mapping with complete routing metadata.\n\n**Database Records vs. Dynamic Resolution:**\n\n* **Stored Mappings:** Include `pk`, `created_date`, `modified_date`, and may have hierarchical relationships\n* **Dynamic Resolutions:** Have null timestamps, no `pk` field, and empty `prettyurl_set`\n\n**Field Purposes:**\n\n* **Path Fields:** Define the URL transformation (pretty vs. canonical)\n* **View Metadata:** Enable route resolution (`func_module`, `func_name`, `func_initkwargs`)\n* **Route Parameters:** Capture dynamic URL segments (`args`, `kwargs`)\n* **Query Data:** Preserve URL query parameters for full route reconstruction\n* **Hierarchy:** Support multi-language variants through parent-child relationships","properties":{"pk":{"type":"integer","description":"Unique identifier for stored URL mappings.\n\n**Presence Rules:**\n* Present in database-stored mappings\n* Absent in dynamically resolved results\n* Used for referencing parent URLs in hierarchical structures\n\nClients should check for this field to distinguish between stored and resolved URLs.","nullable":false},"new_path":{"type":"string","format":"uri-reference","description":"The display URL path shown to users and search engines.\n\n**Characteristics:**\n* Human-readable, SEO-optimized format\n* Automatically normalized with leading and trailing slashes based on configuration *(Source: Static System Configuration)*\n* Must be unique across the system\n* Cannot be `/` (root path is reserved)\n\n**Multi-Language Behavior:**\nWhen multi-language mode is enabled *(Source: Static System Configuration)*, language-specific paths may include language prefixes based on the runtime configuration *(Source: Dynamic/Real-time Configuration)*.\n\n**Validation:**\n* Must differ from `old_path` (cannot prettify a URL to itself)\n* Automatically URL-encoded\n* Maximum length: 512 characters","nullable":false},"old_path":{"type":"string","format":"uri-reference","description":"The canonical application route this pretty URL maps to.\n\n**Purpose:**\n* Represents the internal application path before prettification\n* Used for reverse lookups when resolving internal routes\n* Automatically normalized with leading and trailing slashes *(Source: Static System Configuration)*\n\n**Relationship to `new_path`:**\nMultiple pretty URLs (new_path) can point to the same canonical URL (old_path), enabling URL aliasing and A/B testing of URL structures.\n\n**Nullability:**\n* Required when creating manual mappings\n* May be null in rare legacy cases\n* Always present in API responses","nullable":true},"parent":{"type":"integer","nullable":true,"description":"Reference to the parent URL identifier for hierarchical URL structures.\n\n**Hierarchy Rules:**\n* Null for top-level, language-neutral URLs\n* Contains parent `pk` value for language-specific child URLs\n* Enables one-to-many relationship (one parent, multiple children)\n\n**Multi-Language Architecture:**\nParent URLs serve as the canonical reference, while child URLs in `prettyurl_set` provide language-specific variants. This structure allows the same logical page to have different URL paths per language.\n\n**Example:**\nA parent URL `/products/shoes/` (parent=null) might have children like `/tr/urunler/ayakkabi/` (parent=42) and `/ar/منتجات/أحذية/` (parent=42)."},"language":{"type":"string","nullable":true,"description":"Language code for multi-language URL variants.\n\n**Format:** ISO 639-1 language codes (2-character) or extended codes (up to 10 characters)\n**Examples:** `en`, `tr`, `ar`, `de`, `en-US`, `zh-CN`\n\n**Hierarchy Relationship:**\n* Parent URLs typically have `null` or default language\n* Child URLs in `prettyurl_set` have specific language codes\n* Language assignment is required when multi-language mode is enabled *(Source: Static System Configuration)*\n\n**Nullability:**\n* Null for language-neutral URLs in single-language configurations\n* Null or default language for parent URLs in multi-language setups\n* Specific language code for child URLs\n\n**Use Case:**\nEssential for serving localized content and SEO optimization in international markets where the same page needs different URLs per language.","minLength":2,"maxLength":10},"func_module":{"type":"string","nullable":true,"description":"Python module path of the view handling this URL.\n\n**Format:** Dot-separated module path (e.g., `omnishop.products.views`)\n\n**Purpose:**\n* Identifies the application component responsible for rendering this URL\n* Enables programmatic view resolution\n* Used internally for route reconstruction\n\n**Common Patterns:**\n* Product pages: `omnishop.products.views`\n* Category pages: `omnishop.catalogs.views`\n* CMS pages: `omnishop.cms.views`\n* Static pages: `django.views.generic`\n\nThis metadata enables the system to reconstruct the full view context for any URL.","maxLength":256},"func_name":{"type":"string","nullable":true,"description":"View class or function name handling this URL.\n\n**Format:** Python class or function identifier\n\n**Purpose:**\n* Specifies the exact view component within `func_module`\n* Combined with `func_module`, creates a complete view reference\n* Essential for route resolution and URL reversal\n\n**Common Examples:**\n* `ProductDetailView` - Individual product pages\n* `CategoryListView` - Category browsing\n* `FlatPageView` - Static CMS content\n* `CheckoutView` - Checkout process\n\nTogether with `func_module` and `func_initkwargs`, this provides complete view instantiation information.","maxLength":64},"func_initkwargs":{"type":"object","description":"View initialization parameters passed when instantiating the view.\n\n**Structure:** JSON object with key-value pairs\n\n**Purpose:**\n* Configures view-specific behavior\n* Passes template names, model references, or custom parameters\n* Enables view customization without code changes\n\n**Common Parameters:**\n* `model`: Model class name for generic views\n* `template_name`: Template file path\n* `slug_field`: Field used for slug-based lookups\n* Custom business logic parameters\n\n**Example:**\n```json\n{\n  \"model\": \"Product\",\n  \"template_name\": \"products/detail.html\"\n}\n```\n\nThis allows the same view class to handle different contexts based on initialization parameters.","additionalProperties":true},"args":{"type":"array","description":"Positional route parameters extracted from the URL path.\n\n**Format:** Array of strings representing captured URL segments\n\n**Purpose:**\n* Captures unnamed URL path parameters\n* Maintains parameter order from URL pattern\n* Passed to view as positional arguments\n\n**Usage Pattern:**\nModern applications typically use keyword arguments (`kwargs`) instead of positional arguments for clarity and maintainability. This field is often empty in contemporary URL configurations.\n\n**Example:**\nFor a URL pattern like `/archive/<year>/<month>/`, args might be `[\"2024\", \"11\"]`.","items":{"type":"string","maxLength":32}},"kwargs":{"type":"object","description":"Named route parameters extracted from the URL path.\n\n**Structure:** JSON object mapping parameter names to values\n\n**Purpose:**\n* Captures named URL path segments defined in route patterns\n* Provides semantic parameter names for view logic\n* Enables type-safe parameter passing\n\n**Common Parameters:**\n* `pk` or `id`: Primary key for database lookups\n* `slug`: URL-friendly identifier\n* `category_id`, `product_id`: Entity identifiers\n* `page_slug`, `section`: Content navigation parameters\n\n**Example:**\nFor URL pattern `/products/<slug:slug>/`, kwargs would be `{\"slug\": \"running-shoes\"}`.\n\nThis is the preferred method for passing URL parameters in modern applications due to improved code readability.","additionalProperties":{"type":"string"}},"query_params":{"type":"object","description":"Query string parameters parsed from the URL.\n\n**Structure:** JSON object mapping parameter names to values\n\n**Purpose:**\n* Preserves URL query strings (everything after `?`)\n* Supports filtering, sorting, and pagination parameters\n* Maintains analytics tracking parameters (UTM codes, etc.)\n\n**Common Use Cases:**\n* **Filtering:** `?color=red&size=large`\n* **Pagination:** `?page=2&page_size=20`\n* **Sorting:** `?sort=price&order=asc`\n* **Tracking:** `?utm_source=email&utm_campaign=summer2024`\n* **Search:** `?q=running+shoes`\n\n**Preservation:**\nQuery parameters are maintained separately from path parameters, allowing full URL reconstruction including all query data.\n\n**Example:**\nFor URL `/products/?category=shoes&color=blue`, query_params would be `{\"category\": \"shoes\", \"color\": \"blue\"}`.","additionalProperties":{"type":"string"}},"viewname":{"type":"string","nullable":true,"description":"Named URL pattern identifier for reverse URL resolution.\n\n**Purpose:**\n* Enables programmatic URL generation using Django's `reverse()` functionality\n* Provides a stable identifier for URL patterns independent of path structure\n* Facilitates URL construction in templates and code\n\n**Format:** Kebab-case or snake_case identifier\n\n**Common Examples:**\n* `product-detail` - Product detail pages\n* `category-list` - Category browsing\n* `checkout` - Checkout process\n* `cms-flatpage` - Static CMS pages\n\n**Reverse Resolution:**\nApplications can generate URLs by calling `reverse('product-detail', kwargs={'pk': 456})` instead of hardcoding paths, ensuring URL changes don't break application code.\n\nThis field bridges the gap between human-readable URLs and programmatic route management.","maxLength":64},"created_date":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp when this URL mapping was first created.\n\n**Format:** ISO 8601 datetime with timezone\n**Example:** `2024-11-15T10:30:00Z`\n\n**Presence Rules:**\n* Present with valid timestamp for database-stored mappings\n* Null for dynamically resolved URLs (not stored in database)\n\n**Use Cases:**\n* Audit trail for URL creation\n* Identifying recently added URLs\n* Tracking URL generation activities\n* Monitoring URL registry growth\n\nClients can use null values to detect dynamically resolved results vs. stored mappings."},"modified_date":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp when this URL mapping was last updated.\n\n**Format:** ISO 8601 datetime with timezone\n**Example:** `2024-11-20T14:22:00Z`\n\n**Presence Rules:**\n* Present with valid timestamp for database-stored mappings\n* Null for dynamically resolved URLs (not stored in database)\n* Updated whenever any field in the mapping changes\n\n**Use Cases:**\n* Tracking URL changes and updates\n* Cache invalidation triggers\n* Synchronization activities\n* URL audit logs\n\nCompare `modified_date` with `created_date` to identify URLs that have been edited post-creation."},"prettyurl_set":{"type":"array","description":"Child URL mappings for multi-language variants.\n\n**Structure:** Array of language-specific URL objects\n\n**Purpose:**\n* Stores language-specific URL paths for the same logical page\n* Enables internationalized SEO with localized URLs\n* Maintains parent-child hierarchy for URL organization\n\n**Population Rules:**\n* Empty array when multi-language mode is disabled *(Source: Static System Configuration)*\n* Empty for dynamically resolved URLs (no stored children)\n* Empty for child URLs themselves (prevents nesting beyond one level)\n* Populated for parent URLs when language-specific mappings exist\n\n**Child Object Structure:**\nEach child contains `pk`, `new_path`, and `language` fields. Children inherit routing metadata from their parent, so they don't duplicate `func_module`, `func_name`, etc.\n\n**Example:**\nA parent English URL `/products/shoes/` might have children:\n* Turkish: `/tr/urunler/ayakkabi/`\n* Arabic: `/ar/منتجات/أحذية/`\n* German: `/de/produkte/schuhe/`\n\nThis architecture enables one database record to manage multiple language-specific URLs.","items":{"$ref":"#/components/schemas/ChildPrettyUrl"}}}},"ChildPrettyUrl":{"type":"object","description":"Represents a language-specific URL variant within a multi-language hierarchy.\n\n**Hierarchy Position:**\n* Always a child of a parent URL (never standalone)\n* Inherits routing metadata from parent\n* Only contains fields necessary for language-specific identification\n\n**Simplified Structure:**\nChild objects include only `pk`, `new_path`, and `language` since they share routing metadata with their parent.","required":["pk","new_path","language"],"properties":{"pk":{"type":"integer","description":"Unique identifier for this language-specific URL variant.\n\nUsed for direct lookup and parent relationship management."},"new_path":{"type":"string","format":"uri-reference","description":"The language-specific display URL path.\n\n**Localization:**\n* Contains translated or transliterated URL segments\n* Follows language-specific URL conventions\n* May include language prefix based on configuration *(Source: Dynamic/Real-time Configuration)*\n\n**Examples:**\n* English: `/products/running-shoes/`\n* Turkish: `/tr/urunler/kosu-ayakkabilari/`\n* Arabic: `/ar/منتجات/أحذية-الجري/`\n* German: `/de/produkte/laufschuhe/`\n\nEach language variant points to the same logical page but uses localized URL text for SEO optimization.","maxLength":512},"language":{"type":"string","description":"Language code for this URL variant.\n\n**Format:** ISO 639-1 language codes (2-character) or extended codes\n**Examples:** `en`, `tr`, `ar`, `de`, `en-US`, `zh-CN`\n\n**Requirements:**\n* Must be non-null for child URLs\n* Must correspond to a configured system language\n* Should match the localization of the `new_path` content\n\nThis field enables language-aware routing and content delivery.","minLength":2,"maxLength":10}}}}}}
````

## The ChildPrettyUrl object

```json
{"openapi":"3.1.0","info":{"title":"Pretty URLs API - URL Management & Dynamic Resolution","version":"1.0.0"},"components":{"schemas":{"ChildPrettyUrl":{"type":"object","description":"Represents a language-specific URL variant within a multi-language hierarchy.\n\n**Hierarchy Position:**\n* Always a child of a parent URL (never standalone)\n* Inherits routing metadata from parent\n* Only contains fields necessary for language-specific identification\n\n**Simplified Structure:**\nChild objects include only `pk`, `new_path`, and `language` since they share routing metadata with their parent.","required":["pk","new_path","language"],"properties":{"pk":{"type":"integer","description":"Unique identifier for this language-specific URL variant.\n\nUsed for direct lookup and parent relationship management."},"new_path":{"type":"string","format":"uri-reference","description":"The language-specific display URL path.\n\n**Localization:**\n* Contains translated or transliterated URL segments\n* Follows language-specific URL conventions\n* May include language prefix based on configuration *(Source: Dynamic/Real-time Configuration)*\n\n**Examples:**\n* English: `/products/running-shoes/`\n* Turkish: `/tr/urunler/kosu-ayakkabilari/`\n* Arabic: `/ar/منتجات/أحذية-الجري/`\n* German: `/de/produkte/laufschuhe/`\n\nEach language variant points to the same logical page but uses localized URL text for SEO optimization.","maxLength":512},"language":{"type":"string","description":"Language code for this URL variant.\n\n**Format:** ISO 639-1 language codes (2-character) or extended codes\n**Examples:** `en`, `tr`, `ar`, `de`, `en-US`, `zh-CN`\n\n**Requirements:**\n* Must be non-null for child URLs\n* Must correspond to a configured system language\n* Should match the localization of the `new_path` content\n\nThis field enables language-aware routing and content delivery.","minLength":2,"maxLength":10}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.akinon.com/commerce-openapis/pretty-urls/models.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
