Open2b versione 7.5

url-redirects

url-redirects.find

Returns the redirects that meet the given conditions.

Request

Admin SDK
Admin.api('site.url-redirects.find', request, function(response) { … });
HTTP POST
/api/v10/site.url-redirects.find
{
  "conditions" : { // returns only the redirects …
    "resourceType" : "Department", // … with this resource type, can be "AttributeValue", "BlogPost", "Collection", "Department", "Page", "Producer", "Product" or "Promotion" - string
    "language" : "en",  // … of this language ( ISO code ) - string(2)
    "paths" : [ "shirts/yellow", … ], // … with these paths - string(1…255)
    "containedPath" : "yellow", // … with path containing this string - string(1…100)
    "isSetBySystem" : false, // … that have been set by the system - bool
    "after" : "shirts/blue" // … with path after this value - string(0…255)
  },
  "order" : [ "language", "path", … ], // sort order of returned redirects, can contain "language", "-language", "path", "-path", "isSetBySystem", "isSetBySystem",
                                       // "expirationDate", "-expirationDate", "creationTime" and "-creationTime" - string
  "limit" : 50, // maximum number of redirects to return - int(1…)
  "first" : 0 // index of the first redirect to return - int(0…)
}

Response

{
  "status" : "ok",
  "redirects" : [ {
    "language" : "en", // language ( ISO code ) - string(2)
    "path" : "shirts/yellow", // path - string(1…255)
    "target" : { // target, only and only one between "resources" and "url" is not null
      "resources" : [ { // resources (can be null)
        "id" : 91, // identifier (required) - int(1…)
        "type" : "Department" // type, can be "AttributeValue", "BlogPost", "Collection", "Department", "Page", "Producer", "Product" or "Promotion" (required) - string
      }, {
        "id" : 46,
        "type" : "AttributeValue"
      }, … ],
      "url" : null // URL, can be relative or absolute (can be null) - string(1…300)
    },
    "preserveQuery" : true, // indicates if the query string of the requested URL must be preserved - bool
    "httpStatus" : 301, // HTTP status code, can be 301, 302, 303 or 307 - int
    "isSetBySystem" : false, // indicates if has been set by the system - bool
    "expirationDate" : "2020-05-15", // expiration date (can be null) - date
    "creationTime" : "2020-06-19 15:35:22" // creation time - datetime
  }, … ]
}

Errors

Field Type Description
language NotFound Language '<language>' does not exist

url-redirects.count

Number of redirects that meet the given conditions.

Request

Admin SDK
Admin.api('site.url-redirects.count', request, function(response) { … });
HTTP POST
/api/v10/site.url-redirects.count
{
  "conditions" : { // counts only the redirects …
    "resourceType" : "Department", // … with this resource type, can be "AttributeValue", "BlogPost", "Collection", "Department", "Page", "Producer", "Product" or "Promotion" - string
    "language" : "en",  // … of this language ( ISO code ) - string(2)
    "paths" : [ "shirts/yellow", … ], // … with these paths - string(1…255)
    "containedPath" : "yellow", // … with path containing this string - string(1…100)
    "isSetBySystem" : false, // … that have been set by the system - bool
    "after" : "shirts/blue" // … with path after this value - string(0…255)
  }
}

Response

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

Errors

Field Type Description
language NotFound Language '<language>' does not exist

url-redirects.set

Sets one or more redirects.

Request

Admin SDK
Admin.api('site.url-redirects.set', request, function(response) { … });
HTTP POST
/api/v10/site.url-redirects.set
{
  "redirects" : [ { // redirects to set (required)
    "language" : "en", // language ( ISO code ) (required) - string(2)
    "path" : "shirts/yellow", // path, must be relative (required) - string(1…255)
    "target" : { // target, only and only one between "resources" and "url" is not null
      "resources" : [ { // resources (can be null)
        "id" : 91, // identifier (required) - int(1…)
        "type" : "Department" // type, can be "AttributeValue", "BlogPost", "Collection", "Department", "Page", "Producer", "Product" or "Promotion" (required) - string
      }, {
        "id" : 46,
        "type" : "AttributeValue"
      }, … ],
      "url" : null // URL, can be relative or absolute (can be null) - string(1…300)
    },
    "preserveQuery" : true // indicates if the query string of the requested URL must be preserved - bool
  }, … ],
  "httpStatus" : 301, // HTTP status code, can be 301, 302, 303 or 307 - int 
  "expiration" : 30 // expiration in days from current date - int(1…365)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
httpStatus InvalidValue httpStatus can be 301, 302, 303 or 307
language NotFound Language '<language>' does not exist
path InvalidValue A resource with path '<path>' already exists 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 collection
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
resources Malformed Target must have 'url' or 'resources' field

url-redirects.delete

Deletes one or more redirects.

Request

Admin SDK
Admin.api('site.url-redirects.delete', request, function(response) { … });
HTTP POST
/api/v10/site.url-redirects.delete
{
  "redirects" : [ { // redirects to delete (required)
    "language" : "en", // language ( ISO code ) (required) - string(2)
    "path" : "shirts/yellow" // 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