Open2b versione 7.5

producers

producers.find

Returns all the producers.

Admin SDK
Admin.api('commerce.producers.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.producers.find

Request

{
  "conditions" : { // returns only the producers …
    "ids" : [ 91, 27, … ], // … with these identifiers - int(1…)
    "after" : 39 // … 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 producers, can contain "id", "-id", "code", "-code", "name" and "-name" - string
  "limit" : 10, // maximum number of producers to return - int(1…)
  "first" : 30 // index of the first producer to return - int(0…)
}

Response

{
  "status" : "ok",
  "producers" : [ {
    "id" : 39, // identifier - int(1…)
    "code" : "NIKE", // code - string(0…32)
    "name" : "Nike", // name - string(0…60)
    "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/acme",
      "it" : "https://www.site.com/it/acme",
      …
    },
    "productsLayout" : { // products layout on the producer 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
    },
    "logo" : { // logo (can be null)
        "url" : "https://...", // url - string(14…)
        "width" : 260, // width in pixel - int(1…2500)
        "height" : 190 // height in pixel - int(1…2500)
    }
  }, … ]
}

producers.get

Returns a producer given its identifier.

Admin SDK
Admin.api('commerce.producers.get', request, function(response) { … });
HTTP POST
/api/v10/commerce.producers.get

Request

{
  "id" : 39, // identifier of the producer (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "code", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "producer" : { // (can be null)
    "id" : 39, // identifier - int(1…)
    "code" : "NIKE", // code - string(0…32)
    "name" : "Nike", // name - string(0…60)
    "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/acme",
      "it" : "https://www.site.com/it/acme",
      …
    },
    "productsLayout" : { // products layout on the producer 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
    },
    "logo" : { // logo (can be null)
        "url" : "https://...", // url - string(14…)
        "width" : 260, // width in pixel - int(1…2500)
        "height" : 190 // height in pixel - int(1…2500)
    }
  }
}

producers.count

Number of producers that meet the given conditions.

Admin SDK
Admin.api('commerce.producers.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.producers.count

Request

{
  "conditions" : { // counts only the producers …
    "ids" : [ 91, 27, … ], // … with these identifiers - int(1…)
    "after" : 39 // … with identifier after this - int(0…)
  }
}

Response

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

producers.create

Creates a new producer.

Admin SDK
Admin.api('commerce.producers.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.producers.create

Request

{
  "producer" : { // producer to create (required)
    "code" : "NIKE", // code - string(1…32)
    "name" : "Nike", // name - string(0…60)
    "productsLayout" : { // products layout on the producer 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
    },
    "logo" : { // logo (can be null)
      "name": "nike.png", // file name - string(1…255)
      "content" : "N3R…zaA==" // content (JPEG, PNG or GIF) encoded in Base64 - string
    }
  }
}

Response

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

Errors

Field Type Description
logo Malformed File format is not a valid or supported format
logo Malformed Image width and height must be less than 2500 pixels

producers.update

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

Admin SDK
Admin.api('commerce.producers.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.producers.update

Request

{
  "id" : 91, // identifier of the producer to update (required)
  "producer" : { // producer's fields to update (required)
    "code" : "NIKE", // code - string(1…32)
    "name" : "Nike", // name - string(0…60)
    "productsLayout" : { // products layout on the producer 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
    },
    "logo" : { // logo (can be null)
      "name": "nike.png", // file name - string(1…255)
      "content" : "N3R…zaA==" // content (JPEG, PNG or GIF) encoded in Base64 - string
    }
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Producer <id> does not exist
logo Malformed File format is not a valid or supported format
logo Malformed Image width and height must be less than 2500 pixels

producers.delete

Deletes one or more producers.

Admin SDK
Admin.api('commerce.producers.delete', request, function(response) { … });
HTTP POST
/api/v10/commerce.producers.delete

Request

{
  "ids" : [ 91, 27, … ] // identifiers of the producers to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}