resourceByPath
Resolve a URL path to its resource type and ID. Enables headless clients to build dynamic URL-to-resource mappings.
Authentication
Public Access: Accessible with the public API key
Query Structure
{
resourceByPath(path: String!) {
type
id
alternates {
# Alternate fields
}
}
}Arguments
| Argument | Type | Required | Description |
|---|---|---|---|
| path | String | Yes | The URL path to resolve (e.g., “/products/my-product” or “/login”) |
Return Type
Returns a Resource object containing the resolved resource type and optional ID. The Resource type includes:
- type (ResourceKind!): The type of resource this path resolves to
- id (String): The unique identifier of the resource. Null for system pages like login, cart, etc.
- alternates ([Alternate]): Alternate language URLs for this resource, used for hreflang links and language switching
Example
query {
resourceByPath(path: "/products/my-product") {
type
id
alternates {
locale
path
}
}
}Related Types
ResourceString