Open2b versione 7.5

collections

collections.find

Returns the collections that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.collections.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.collections.find
{
  "conditions" : { // returns only the collections …
    "ids" : [ 11, 20, … ], // … with these identifiers - int(1…)
    "type" : "Catalog", // … with this type, can be "Catalog" or "Additional" - string
    "after" : 20 // … with identifier after this - int(0…)
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "type", "code", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned collections, can contain "id", "-id", "code", "-code",
                        // "name" and "-name" - string
  "limit" : 10, // maximum number of collections to return - int(1…)
  "first": 30 // index of the first collection to return - int(0…)
}

Response

{
  "status": "ok",
  "collections" : [ {
    "id" : 8, // identifier - int(1…)
    "type" : "Catalog", // type, can be "Catalog" or "Additional" - string
    "code" : "", // code - string(0…40)
    "name" : "Spring/Summer", // name - string(1…60)
    "producers" : [ 91, 27 ], // producers - int(1…)
    "excludedProducers" : false, // indicates if the producers are excluded - bool
    "attributeValues" : [ 46, 19 ], // attribute values - int(1…)
    "excludedAttributeValues" : false, // indicates if the attribute values are excluded - bool
    "title" : { // title - string(2) -> string(0…60)
      "en" : "Spring/Summer",
      "it" : "Primavera/Estate",
      …
    },
    "summary" : { // summary description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "description" : { // detailed description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "canonicalURL" : { // canonical URL, is null for Additional collections (can be null) - string(10…)
      "en" : "https://shop/spring-summer",
      "it" : "https://shop/primavera-estate",
      …
    },
    "templateFile" : "collection-spring.html", // template file used for the site - string(15…255)
    "productsLayout" : { // layout of the products on the collection page
      "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
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "smallImage" : { // small image (can be null)
      "url" : "https://domain/path", // url - string(53…255)
      "width" : 150, // width in pixel - int(1…2500)
      "height" : 139 // height in pixel - int(1…2500)
    },
    "largeImage" : { // large image (can be null)
      "url" : "https://domain/path", // url - string(53…255)
      "width" : 600, // width in pixel - int(1…2500)
      "height" : 480 // height in pixel - int(1…2500)
    }  }, … ]
}

collections.get

Returns a collection given its identifier.

Request

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

Response

{
  "status" : "ok",
  "collection" : { // (can be null)
    "id" : 8, // identifier - int(1…)
    "type" : "Catalog", // type, can be "Catalog" or "Additional" - string
    "code" : "", // code - string(0…40)
    "name" : "Spring/Summer", // name - string(1…60)
    "producers" : [ 91, 27 ], // producers - int(1…)
    "excludedProducers" : false, // indicates if the producers are excluded - bool
    "attributeValues" : [ 46, 19 ], // attribute values - int(1…)
    "excludedAttributeValues" : false, // indicates if the attribute values are excluded - bool
    "title" : { // title - string(2) -> string(0…60)
      "en" : "Spring/Summer",
      "it" : "Primavera/Estate",
      …
    },
    "summary" : { // summary description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "description" : { // detailed description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "canonicalURL" : { // canonical URL, is null for Additional collections (can be null) - string(10…)
      "en" : "https://shop/spring-summer",
      "it" : "https://shop/primavera-estate",
      …
    },
    "templateFile" : "collection-spring.html", // template file used for the site - string(15…255)
    "productsLayout" : { // layout of the products on the collection page
      "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
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "smallImage" : { // small image (can be null)
      "url" : "https://domain/path", // url - string(53…255)
      "width" : 150, // width in pixel - int(1…2500)
      "height" : 139 // height in pixel - int(1…2500)
    },
    "largeImage" : { // large image (can be null)
      "url" : "https://domain/path", // url - string(53…255)
      "width" : 600, // width in pixel - int(1…2500)
      "height" : 480 // height in pixel - int(1…2500)
    }  }
}

collections.count

Number of collections that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.collections.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.collections.count
{
  "conditions" : { // count only the collections …
    "ids" : [ 11, 20, … ], // … with these identifiers - int(1…)
    "type" : "Catalog", // … with this type, can be "Catalog" or "Additional" - string
    "after" : 20 // … with identifier after this - int(0…)
  }
}

Response

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

collections.create

Creates a new collection.

Request

Admin SDK
Admin.api('commerce.collections.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.collections.create
{
  "collection" : { // collection to create (required)
    "type" : "Catalog", // type, can be "Catalog" or "Additional" (required) - string
    "code" : "", // code - string(0…40)
    "name" : "Spring/Summer", // name (required) - string(1…60)
    "producers" : [ 91, 27 ], // producers - int(1…)
    "excludedProducers" : false, // indicates if the producers are excluded - bool
    "attributeValues" : [ 46, 19 ], // attribute values - int(1…)
    "excludedAttributeValues" : false, // indicates if the attribute values are excluded - bool
    "title" : { // title - string(2) -> string(0…60)
      "en" : "Spring/Summer",
      "it" : "Primavera/Estate",
      …
    },
    "summary" : { // summary description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "description" : { // detailed description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "templateFile" : "collection-spring.html", // template file used for the site - string(15…255)
    "productsLayout" : { // layout of the products on the collection page
      "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
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    }
  }
}

Response

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

Errors

Field Type Description
attributeValues Malformed An attribute value id is repeated
attributeValues Malformed There must be no more than 5000 attribute values
attributeValues NotFound Attribute value <value> does not exist
code AlreadyExists Code '<code>' already exists
code Malformed '<code>' has trailing spaces
create NotAvailable Collections are not available for this installation
producers Malformed A producer id is repeated
producers NotFound Producer <producer> does not exist
templatePage Malformed '<templateFile>' is not a collection template file name

collections.update

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

Request

Admin SDK
Admin.api('commerce.collections.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.collections.update
{
  "id": 11, // identifier of the collection to update (required) - int(1…)
  "collection" : { // collection's fields to update (required)
    "code" : "", // code - string(0…40)
    "name" : "Spring/Summer", // name - string(1…60)
    "producers" : [ 91, 27 ], // producers - int(1…)
    "excludedProducers" : false, // indicates if the producers are excluded - bool
    "attributeValues" : [ 46, 19 ], // attribute values - int(1…)
    "excludedAttributeValues" : false, // indicates if the attribute values are excluded - bool
    "title" : { // title - string(2) -> string(0…60)
      "en" : "Spring/Summer",
      "it" : "Primavera/Estate",
      …
    },
    "summary" : { // summary description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "description" : { // detailed description - string(2) -> string(0…65535)
      "en" : "",
      "it" : "",
      …
    },
    "templateFile" : "collection-spring.html", // template file used for the site - string(15…255)
    "productsLayout" : { // layout of the products on the collection page
      "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
    },
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "",
      "it" : "",
      …
    },
    "smallImage" : { // small image (can be null)
      "name" : "small.png", // file name - string(1…255)
      "content" : "N3R…zaA==" // content encoded in Base64 - string
    },
    "largeImage" : { // large image (can be null)
      "name" : "large.jpg", // file name - string(1…255)
      "content" : "N3R…zaA==" // content encoded in Base64 - string
    }
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
attributeValues Malformed An attribute value id is repeated
attributeValues Malformed There must be no more than 5000 attribute values
attributeValues NotFound Attribute value <value> does not exist
code AlreadyExists Code '<code>' already exists
code Malformed '<code>' has trailing spaces
id NotFound Collection <id> does not exist
largeImage Malformed File format is not a valid or supported format
largeImage Malformed Image width and height must be less than 2500 pixels
producers Malformed A producer id is repeated
producers NotFound Producer <producer> does not exist
smallImage Malformed File format is not a valid or supported format
smallImage Malformed Image width and height must be less than 2500 pixels
templatePage Malformed '<templateFile>' is not a collection template file name
update NotAvailable Collections are not available for this installation

collections.delete

Deletes one o more collections.

Request

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

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids InvalidValue Collection <collection> is used by group <group>
ids Malformed A collection identifier is repeated