url-rewrites

url-rewrites.find

Returns the rewrites that meet the given conditions.

Request

Admin SDK
Admin.api('site.url-rewrites.find', request, function(response) { … });
HTTP POST
/api/v7/site.url-rewrites.find
{
  "conditions" : { // returns only the rewrites …
    "resourceType" : "Department", // … with this resource type, can be "AttributeValue", "BlogPost", "Department", "Page", "Producer", "Product" or "Promotion" - string 
    "resourceIDs" : [ 46, 19, 22, … ], // … with these resources (id) - int(1…)
    "containedPath" : "fiction", // … with path containing this string - string(1…100)
    "withLanguage" : "en", // … with a rewrite for this language ( ISO code ) - string(2)
    "after" : [ { // … with resources after this value
      "id" : 91, // identifier (required) - int(1…)
      "type" : "Department" // type, can be "AttributeValue", "BlogPost", "Department", "Page", "Producer", "Product" or "Promotion" (required) - string
    }, {
      "id" : 44,
      "type" : "AttributeValue"
    }, … ]
  },
  "limit" : 150, // maximum number of rewrites to return - int(1…)
  "first" : 0 // index of the first rewrite to return - int(0…)
}

Response

{
  "status" : "ok",
  "rewrites" : [ {
    "resources" : [ { // resources
      "id" : 91, // identifier - int(1…)
      "type" : "Department" // type, can be "AttributeValue", "BlogPost", "Department", "Page", "Producer", "Product" or "Promotion" - string
    }, {
      "id" : 46,
      "type" : "AttributeValue"
    }, … ],
    "path" : { // path - string(2) -> string(1…255)
      "en" : "books/science-fiction",
      "it" : "libri/fantascienza",
      …
    },
    "updateTime" : "2020-06-19 17:53:51" // last update time - datetime
  }, … ]
}

Errors

Field Type Description
resourceIDs Malformed 'resourceType' is required with 'resourceIDs'
language NotFound Language '<language>' does not exist

url-rewrites.count

Number of rewrites that meet the given conditions.

Request

Admin SDK
Admin.api('site.url-rewrites.count', request, function(response) { … });
HTTP POST
/api/v7/site.url-rewrites.count
{
  "conditions" : { // counts only the rewrites …
    "resourceType" : "Department", // … with this resource type, can be "AttributeValue", "BlogPost", "Department", "Page", "Producer", "Product" or "Promotion" - string 
    "resourceIDs" : [ 46, 19, 22, … ], // … with these resources (id) - int(1…)
    "containedPath" : "fiction", // … with path containing this string - string(1…100)
    "withLanguage" : "en", // … with a rewrite for this language ( ISO code ) - string(2)
    "after" : [ { // … with resources after this value
      "id" : 91, // identifier (required) - int(1…)
      "type" : "Department" // type, can be "AttributeValue", "BlogPost", "Department", "Page", "Producer", "Product" or "Promotion" (required) - string
    }, {
      "id" : 44,
      "type" : "AttributeValue"
    }, … ]
  }
}

Response

{
  "status" : "ok",
  "count" : 1392 // number of rewrites - int(0…)
}

Errors

Field Type Description
resourceIDs Malformed 'resourceType' is required with 'resourceIDs'
language NotFound Language '<language>' does not exist

url-rewrites.set

Sets one or more rewrites.

Request

Admin SDK
Admin.api('site.url-rewrites.set', request, function(response) { … });
HTTP POST
/api/v7/site.url-rewrites.set
{
  "rewrites" : [ { // rewrites to set (required)
    "language" : "en", // language ( ISO code ) (required) - string(2)
    "resources" : [ { // resources
      "id" : 91, // identifier (required) - int(1…)
      "type" : "Department" // type, can be "AttributeValue", "BlogPost", "Department", "Page", "Producer", "Product" or "Promotion" (required) - string
    }, {
      "id" : 46,
      "type" : "AttributeValue"
    }, … ],
    "path" : "books/science-fiction" // path, must be relative (required) - string(1…255)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
language NotFound Language '<language>' does not exist
path AlreadyExists Path '<path>' already exists as redirect for language '<language>'
path Malformed Path '<path>' is a reserved path
path Malformed Path '<path>' is not a relative URL path
resources Malformed A resource is repeated
resources Malformed Blog posts cannot be combined with other resources
resources Malformed Pages cannot be combined with other resources
resources Malformed Products cannot be combined with other resources
resources Malformed Promotions cannot be combined with other resources
resources Malformed There cannot be more than one department
resources Malformed There cannot be more than one producer
resources NotFound Resource <id> of type '<type>' does not exist
rewrites Malformed Can not set the same path <path> for more than a language

url-rewrites.delete

Deletes one or more rewrites.

Request

Admin SDK
Admin.api('site.url-rewrites.delete', request, function(response) { … });
HTTP POST
/api/v7/site.url-rewrites.delete
{
  "rewrites" : [ { // rewrites to delete (required)
    "language" : "en", // language ( ISO code ) (required) - string(2)
    "path" : "books/science-fiction" // path, must be relative (required) - string(1…255)
  }, … ]
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
language NotFound Language '<language>' does not exist
path Malformed Path '<path>' is a reserved path
path Malformed Path '<path>' is not a relative URL path
Quanto ti è stata utile questa pagina?

Grazie per averci aiutato a migliorare questa pagina