Returns the departments that meet the given conditions.
Admin SDKAdmin.api('commerce.departments.find', request, function(response) { … });
HTTP POST/api/v10/commerce.departments.find
{
"conditions" : { // returns only the departments …
"ids" : [ 91, 66, … ], // … with these identifiers - int(1…)
"parent" : 39, // … with this parent department (id) (can be null) - int(1…)
"after" : 81 // … with identifier after this - int(0…)
},
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", … ], // fields to return - string
"order" : [ "name" ], // sort order of returned departments, can contain "id", "-id", "code", "-code",
// "name", "-name", "position" and "-position" - string
"limit" : 10, // maximum number of departments to return - int(1…)
"first": 30 // index of the first department to return - int(0…)
}
{
"status": "ok",
"departments" : [ {
"id" : 91, // identifier - int(1…)
"code" : "SHIRTS", // code - string(0…32)
"parent" : 39, // parent department (id) (can be null) - int(1…)
"ancestors" : [ 12, 39 ], // ancestor departments (id) - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "Books",
"it" : "Libri"
},
"description" : { // description - string(2) -> string(0…65535)
"en" : "",
"it" : ""
},
"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.site.com/books",
"it" : "https://www.site.com/it/libri",
…
},
"countDepartment" : 12, // number of sub-departments - int(0…)
"countProduct" : 4905, // total number of products contained in the department - int(0…)
"templateFile" : "department-shirts.html", // template file used for the site - string(15…255)
"position" : 3, // position (can be null) - int(1…)
"departmentColumns" : 3, // number of columns in which the sub-departments are displayed - int(1…5)
"productsLayout" : { // layout of the products on the department 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
},
"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" : 150, // width in pixel - int(1…2500)
"height" : 139, // height in pixel - int(1…2500)
"align" : "Left" // alignment, can be "Left", "Center" or "Right" - string
},
"visibility" : "Visible" // visibility, can be "Visible", "VisibleIfHasProducts" or "NotVisible" - string
}, … ]
}
Returns a department given its identifier.
Admin SDKAdmin.api('commerce.departments.get', request, function(response) { … });
HTTP POST/api/v10/commerce.departments.get
{
"id" : 91, // identifier of the department (required) - int(1…)
"language" : "en", // language ( ISO code ) of the texts to return - string(2)
"fields" : [ "id", "code", … ] // fields to return - string
}
{
"status" : "ok",
"department" : { // (can be null)
"id" : 91, // identifier - int(1…)
"code" : "SHIRTS", // code - string(0…32)
"parent" : 39, // parent department (id) (can be null) - int(1…)
"ancestors" : [ 12, 39 ], // ancestor departments (id) - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "Books",
"it" : "Libri"
},
"description" : { // description - string(2) -> string(0…65535)
"en" : "",
"it" : ""
},
"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.site.com/books",
"it" : "https://www.site.com/it/libri",
…
},
"countDepartment" : 12, // number of sub-departments - int(0…)
"countProduct" : 4905, // total number of products contained in the department - int(0…)
"templateFile" : "department-shirts.html", // template file used for the site - string(15…255)
"position" : 3, // position (can be null) - int(1…)
"departmentColumns" : 3, // number of columns in which the sub-departments are displayed - int(1…5)
"productsLayout" : { // layout of the products on the department 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
},
"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" : 150, // width in pixel - int(1…2500)
"height" : 139, // height in pixel - int(1…2500)
"align" : "Left" // alignment, can be "Left", "Center" or "Right" - string
},
"visibility" : "Visible" // visibility, can be "Visible", "VisibleIfHasProducts" or "NotVisible" - string
}
}
Number of departments that meet the given conditions.
Admin SDKAdmin.api('commerce.departments.count', request, function(response) { … });
HTTP POST/api/v10/commerce.departments.count
{
"conditions" : { // count only the departments …
"ids" : [ 91, 66, … ], // … with these identifiers - int(1…)
"parent" : 39, // … with this parent department (id) (can be null) - int(1…)
"after" : 81 // … with identifier after this - int(0…)
}
}
{
"status" : "ok",
"count" : 23 // number of departments - int(0…)
}
Field | Type | Description |
---|---|---|
parent | NotFound | Department <parent> does not exist |
Creates a new department.
Admin SDKAdmin.api('commerce.departments.create', request, function(response) { … });
HTTP POST/api/v10/commerce.departments.create
{
"department" : { // department to create (required)
"code" : "SHIRTS", // code - string(0…32)
"parent" : 39, // parent department (id) (can be null) - int(1…)
"name" : { // name - string(2) -> string(0…60)
"en" : "",
"it" : "",
…
},
"description" : { // description - string(2) -> string(0…65535)
"en" : "",
"it" : "",
…
},
"seoTitle" : { // title for SEO - string(2) -> string(0…255)
"en" : "",
"it" : "",
…
},
"seoDescription" : { // description for SEO - string(2) -> string(0…255)
"en" : "",
"it" : "",
…
},
"templateFile" : "department-shirts.html", // template file used for the site - string(15…255)
"position" : 3, // position (can be null) - int(1…)
"departmentColumns" : 3, // number of columns in which the sub-departments are displayed - int(1…5)
"productsLayout" : { // products layout on the department 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
},
"visibility" : "Visible" // visibility, can be "Visible", "VisibleIfHasProducts" or "NotVisible" - string
}
}
{
"status" : "ok",
"id" : 91 // identifier of the new department - int(1…)
}
Field | Type | Description |
---|---|---|
parent | NotFound | Department <parent> does not exist |
parent | InvalidValue | Department <parent> is at the last level |
templateFile | InvalidValue | '<templateFile> ' is not a department template file name |
Updates a department. Any fields left out of the request will remain unchanged.
Admin SDKAdmin.api('commerce.departments.update', request, function(response) { … });
HTTP POST/api/v10/commerce.departments.update
{
"id": 91, // identifier of the department to update (required) - int(1…)
"department" : { // department's fields to update (required)
"code" : "SHIRTS", // code - string(0…32)
"name" : { // name - string(2) -> string(0…60)
"en" : "",
"it" : "",
…
},
"description" : { // description - string(2) -> string(0…65535)
"en" : "",
"it" : "",
…
},
"seoTitle" : { // title for SEO - string(2) -> string(0…255)
"en" : "",
"it" : "",
…
},
"seoDescription" : { // description for SEO - string(2) -> string(0…255)
"en" : "",
"it" : "",
…
},
"templateFile" : "department-shirts.html", // template file used for the site - string(15…255)
"position" : 3, // position (can be null) - int(1…)
"departmentColumns" : 3, // number of columns in which the sub-departments are displayed - int(1…5)
"productsLayout" : { // products layout on the department's 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
},
"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
},
"largeImageAlign" : "Left", // alignment of the large image, can be "Left", "Center" or "Right" - string
"visibility" : "Visible" // visibility, can be "Visible", "VisibleIfHasProducts" or "NotVisible" - string
}
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
id | NotFound | Department <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 |
smallImage | Malformed | File format is not a valid or supported format |
smallImage | Malformed | Image width and height must be less than 2500 pixels |
templateFile | InvalidValue | '<templateFile> ' is not a department template file name |
Deletes one o more departments. Departments with sub-departments or products are not deleted.
Admin SDKAdmin.api('commerce.departments.delete', request, function(response) { … });
HTTP POST/api/v10/commerce.departments.delete
{
"ids" : [ 91, 66, … ] // identifiers of the departments to delete (required) - int(1…)
}
{
"status" : "ok"
}
Field | Type | Description |
---|---|---|
ids | InvalidValue | Department <id> contains subdepartments |
ids | InvalidValue | Department <id> contains products |