Open2b versione 7.5

pages

pages.find

Returns all the pages.

Request

Admin SDK
Admin.api('site.pages.find', request, function(response) { … });
HTTP POST
/api/v10/site.pages.find
{
  "conditions" : { // returns only the pages …
    "ids" : [ 71, 89, 46 ], // … with these identifiers - int(1…)
    "after" : 22 // … with identifier after this - int(0…)
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "name", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned pages, can contain "id", "-id", "name", "-name", "templateFile" and "-templateFile" - string
  "limit" : 10, // maximum number of pages to return - int(1…)
  "first" : 30 // index of the first page to return - int(0…)
}

Response

{
  "status" : "ok",
  "pages" : [ {
    "id" : 12, // identifier - int(1…)
    "name" : "contacts", // name - string(1…120)
    "title" : { // title - string(0…80)
      "en" : "About Us",
      "it" : "Chi Siamo"
    },
    "content" : { // content as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda..."
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "canonicalURL" : { // canonical URL - string(2) -> string(10…)
      "en" : "https://www.store.com/About-Us",
      "it" : "https://www.store.com/it/Chi-Siamo",
      …
    },
    "templateFile" : "about-us.html", // template file used for the site - string(6…255)
    "isSystemPage" : false, // indicates if it is a system page - bool
    "image" : { // image (can be null)
      "url" : "https://…", // url - string(53…255)
      "width" : 350, // width in pixels - int(1…1000)
      "height" : 200, // height in pixels - int(1…1000)
      "align" : "Left", // alignment, can be "Left", "Center" or "Right"
      "caption" : "" // caption - string(0…80)
    },
    "productsLayout" : { // layout of the products on the page (can be null)
      "products" : 12, // number of products per page, can be 0, 12, 24, 36, 48 or 72 - int
      "columns" : 4, // columns, can be 1, 2, 3, 4 or 6 - int
      "sortOrder" : "-Price", // sort order, can be "Position", "Name", "-Name", "Price", "-Price" or "Date" - string
      "imageSize" : "Optimal", // image size, can be "Optimal", Small", "Medium" or "Large" - string
      "showDescription" : false // indicates if the description is displayed - bool
    },
    "isAlwaysVisible" : true, // indicates if it is always visible - bool
    "resources" : [ { // resources to which the page is associated (can be null)
      "id" : "91", // identifier of the resource - int(1…)
      "type" : "Department" // type of the resource, can be "Collection", "Department", "Producer" or "AttributeValue" - string
    }, {
      "id" : "46",
      "type" : "AttributeValue"
    }, … ]
  }, … ]
}

pages.get

Returns a page given its identifier.

Request

Admin SDK
Admin.api('site.pages.get', request, function(response) { … });
HTTP POST
/api/v10/site.pages.get
{
  "id" : 12, // identifier of the page (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "name", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "page" : { // (can be null)
    "id" : 12, // identifier - int(1…)
    "name" : "contacts", // name - string(1…120)
    "title" : { // title - string(0…80)
      "en" : "About Us",
      "it" : "Chi Siamo"
    },
    "content" : { // content as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda..."
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "canonicalURL" : { // canonical URL - string(2) -> string(10…)
      "en" : "https://www.store.com/About-Us",
      "it" : "https://www.store.com/it/Chi-Siamo",
      …
    },
    "templateFile" : "about-us.html", // template file used for the site - string(6…255)
    "isSystemPage" : false, // indicates if it is a system page - bool
    "image" : { // image (can be null)
      "url" : "https://…", // url - string(53…255)
      "width" : 350, // width in pixels - int(1…1000)
      "height" : 200, // height in pixels - int(1…1000)
      "align" : "Left", // alignment, can be "Left", "Center" or "Right"
      "caption" : "" // caption - string(0…80)
    },
    "productsLayout" : { // layout of the products on the page (can be null)
      "products" : 12, // number of products per page, can be 0, 12, 24, 36, 48 or 72 - int
      "columns" : 4, // columns, can be 1, 2, 3, 4 or 6 - int
      "sortOrder" : "-Price", // sort order, can be "Position", "Name", "-Name", "Price", "-Price" or "Date" - string
      "imageSize" : "Optimal", // image size, can be "Optimal", Small", "Medium" or "Large" - string
      "showDescription" : false // indicates if the description is displayed - bool
    },
    "isAlwaysVisible" : true, // indicates if it is always visible - bool
    "resources" : [ { // resources to which the page is associated (can be null)
      "id" : "91", // identifier of the resource - int(1…)
      "type" : "Department" // type of the resource, can be "Collection", "Department", "Producer" or "AttributeValue" - string
    }, {
      "id" : "46",
      "type" : "AttributeValue"
    }, … ]
  }
}

pages.count

Total number of pages.

Response

Admin SDK
Admin.api('site.pages.count', null, function(response) { … });
HTTP POST
/api/v10/site.pages.count
{
  "status" : "ok",
  "count" : 23 // number of pages - int(0…)
}

pages.create

Creates a new page.

Request

Admin SDK
Admin.api('site.pages.create', request, function(response) { … });
HTTP POST
/api/v10/site.pages.create
{
  "page" : { // page to create (required)
    "name" : "contacts", // name - string(1…120)
    "title" : { // title - string(2) -> string(0…80)
      "en" : "About Us",
      "it" : "Chi Siamo",
      …
    },
    "content" : { // content as HTML - string(2) -> sstring(0…65535)
      "en" : "Our company…",
      "it" : "La nostra azienda…",
      …
    },
    "seoTitle" : { // title for SEO - string(2) -> sstring(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> sstring(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "templateFile" : "about-us.html", // template file used for the site - string(6…255)
    "image" : { // image (can be null)
      "name" : "page.jpg", // file name - string(1…255)
      "content" : "N3R…zaA==" // content encoded in base64 - string
    },
    "imageAlign" : "Center", // alignment of the image, can be "Left", "Center" or "Right" -- "Left"
    "imageCaption" : "", // image caption - string(0..80)
    "productsLayout" : { // layout of the products on the page (can be null)
      "products" : 12, // number of products per page, can be 0, 12, 24, 36, 48 or 72 - int
      "columns" : 4, // columns, can be 1, 2, 3, 4 or 6 - int
      "sortOrder" : "-Price", // sort order, can be "Position", "Name", "-Name", "Price", "-Price" or "Date" - string
      "imageSize" : "Optimal", // image size, can be "Optimal", Small", "Medium" or "Large" - string
      "showDescription" : false // indicates if the description is displayed - bool
    },
    "isAlwaysVisible" : true, // indicates if it is always visible - bool
    "resources" : [ { // resources to which the page is associated (can be null)
      "id" : "91", // identifier of the resource - int(1…)
      "type" : "Department" // type of the resource, can be "Collection", "Department", "Producer" or "AttributeValue" - string
    }, {
      "id" : "46",
      "type" : "AttributeValue"
    }, … ]
  }
}

Response

{
  "status" : "ok",
  "id" : 12 // identifier of the new page - int(1…)
}

Errors

Field Type Description
image Malformed Image width and height must be less than 2500 pixels
image Malformed File format is not a valid or supported format
resources Malformed A resource is repeated
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 Malformed There cannot be only one resource of type collection
resources Malformed There cannot be only one resource of type department
resources Malformed There cannot be only one resource of type producer
resources Malformed Resource <id> of type '<type>' does not exist
templateFile InvalidValue '<templateFile>' is not a template file name

pages.update

Updates a page. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('site.pages.update', request, function(response) { … });
HTTP POST
/api/v10/site.pages.update
{
  "id" : 12, // identifier of the page to update (required) - int(1…)
  "page" : { // pages's fields to update (required)
    "name" : "contacts", // name - string(1…120)
    "title" : { // title - string(2) -> string(0…80)
      "en" : "About Us",
      "it" : "Chi Siamo",
      …
    },
    "content" : { // content as HTML - string(2) -> sstring(0…65535)
      "en" : "Our company…",
      "it" : "La nostra azienda…",
      …
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "templateFile" : "about-us.html", // template file used for the site - string(6…255)
    "image" : { // image (can be null)
      "name" : "page.jpg", // file name - string(1…255)
      "content" : "N3R…zaA==" // content encoded in Base64 - string
    },
    "imageAlign" : "Center", // alignment of the image, can be "Left", "Center" or "Right" -- "Left"
    "imageCaption" : "", // image caption - string(0…80)
    "productsLayout" : { // layout of the products on the page (can be null)
      "products" : 12, // number of products per page, can be 0, 12, 24, 36, 48 or 72 - int
      "columns" : 4, // columns, can be 1, 2, 3, 4 or 6 - int
      "sortOrder" : "-Price", // sort order, can be "Position", "Name", "-Name", "Price", "-Price" or "Date" - string
      "imageSize" : "Optimal", // image size, can be "Optimal", Small", "Medium" or "Large" - string
      "showDescription" : false // indicates if the description is displayed - bool
    },
    "isAlwaysVisible" : true // indicates if it is always visible - bool
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Page <id> does not exist
image Malformed Image width and height must be less than 2500 pixels
image Malformed File format is not a valid or supported format
templateFile InvalidValue '<templateFile>' is not a template file name

pages.delete

Deletes one o more pages.

Request

Admin SDK
Admin.api('site.pages.delete', request, function(response) { … });
HTTP POST
/api/v10/site.pages.delete
{
  "ids" : [ 12, 7, … ] // identifiers of the pages to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}