banners

banners.find

Returns the banners that meet the given conditions.

JS
CR.api('site.banners.find', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.banners.find

request

{
  "conditions" :  { // returns the banners …
    "location" : 3, // … with this location - int(1…10)
    "isVisible" : true // … that are visibles - bool
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "location", … ], // fields to return - string
  "order" : [ "id" ], // sort order of returned banners, can contain "id", "-id", "location", "-location", "position" and "-position" - string
  "limit" : 10, // maximum number of banners to return - int(1…100)
  "first" : 30 // index of the first banner to return - int(0…)
}

response

{
  "status" : "ok",
  "banners" : [ {
    "id" : 27, // identifier - int(1…)
    "location" : 3, // location - int(1…10)
    "position" : 5, // position - int(1…100)
    "image" : { // image for each language - string(2) ->
      "en" : { // (can be null)
        "url" : "http://…", // image URL - string(7…255)
        "width" : 100, // width in pixel - int(1…2000)
        "height" : 120 // height in pixel - int(1…2000)
      },
      "it" : { // (can be null)
        "url" : "http://…", // image URL - string(7…255)
        "width" : 100, // width in pixel - int(1…2000)
        "height" : 120 // height in pixel - int(1…2000)
      }
    },
    "alternativeText" : { // alternative text - string(2) -> string(0…255)
      "en" : "Best offers",
      "it" : "Offerte speciali"
    },
    "link" : { // link - string(2) -> string(0…255)
      "en" : "http://…",
      "it" : "http://…"
    },
    "openNewWindow" : false, // indicates if the link must open a new window - bool
    "isVisible" : true, // Indicates if it is visible on site - bool
  }, … ]
}

banners.get

Returns a banner given its identifier.

JS
CR.api('site.banners.get', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.banners.get

request

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

response

{
  "status" : "ok",
  "banner" : { // (can be null)
    "id" : 27, // identifier - int(1…)
    "location" : 3, // location - int(1…10)
    "position" : 5, // position - int(1…100)
    "image" : { // image for each language - string(2) ->
      "en" : { // (can be null)
        "url" : "http://…", // image URL - string(7…255)
        "width" : 100, // width in pixel - int(1…2000)
        "height" : 120 // height in pixel - int(1…2000)
      },
      "it" : { // (can be null)
        "url" : "http://…", // image URL - string(7…255)
        "width" : 100, // width in pixel - int(1…2000)
        "height" : 120 // height in pixel - int(1…2000)
      }
    },
    "alternativeText" : { // alternative text - string(2) -> string(0…255)
      "en" : "Best offers",
      "it" : "Offerte speciali"
    },
    "link" : { // link - string(2) -> string(0…255)
      "en" : "http://…",
      "it" : "http://…"
    },
    "openNewWindow" : false, // indicates if the link must open a new window - bool
    "isVisible" : true, // Indicates if it is visible on site - bool
  }
}

banners.count

Number of banners that meet the given conditions.

JS
CR.api('site.banners.count', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.banners.count

request

{
  "conditions" :  { // counts the banners …
    "location" : 3, // … with this location - int(1…10)
    "isVisible" : true // … that are visibles - bool
  }
}

response

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

banners.create

Creates a new banner.

JS
CR.api('site.banners.create', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.banners.create

request

{
  "banner" : { // banner to create (required)
    "location" : 3, // location (required) - int(1…10)
    "position" : 5, // position - int(1…100)
    "image" : { // image for each language - string(2) ->
      "en" : { // (can be null)
        "name" : "offer.jpg", // name - string(1…255)
        "content" : "…" // content Base64 encoded - string(100…1365334)
      },
      "it" : { // (can be null)
        "name" : "offerta.jpg", // name  - string(1…255)
        "content" : "…" // content Base64 encoded - string(100…1365334)
      }
    },
    "alternativeText" : { // alternative text - string(2) -> string(0…255)
      "en" : "Best offers",
      "it" : "Offerte speciali"
    },
    "link" : { // link - string(2) -> string(0…255)
      "en" : "http://…",
      "it" : "http://…"
    },
    "openNewWindow" : false, // indicates if the link must open a new window - bool
    "isVisible" : true // indicates if it is visible on site - bool
  }
}

response

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

Errors

Field Type Description
image Malformed Image content for language '<language>' is corrupted or is not an image
image Malformed Image content format for language '<language>' is not supported
image Malformed Image size for language '<language>' can not be greater than 500 KB
link Malformed Link for language '<language>' is not a valid HTTP URL
location Invalid Location <location> has already 100 banners

banners.update

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

JS
CR.api('site.banners.update', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.banners.update

request

{
  "id" : 12, // Identifier of the banner to update (required) - int(1…)
  "banner" : { // banner's fields to update (required)
    "location" : 3, // location - int(1…10)
    "position" : 5, // position - int(1…100)
    "image" : { // image - string(2) ->
      "en" : { // (can be null)
        "name" : "offer.jpg", // name - string(1…255)
        "content" : "…" // content Base64 encoded - string(100…1365334)
      },
      "it" : { // (can be null)
        "name" : "offerta.jpg", // name - string(1…255)
        "content" : "…" // content Base64 encoded - string(100…1365334)
      }
    },
    "alternativeText" : { // alternative text - string(0…255)
      "en" : "Best offers",
      "it" : "Offerte speciali"
    },
    "link" : { // link - string(0…255)
      "en" : "http://…",
      "it" : "http://…"
    },
    "openNewWindow" : false, // indicates if the link must open a new window - bool
    "isVisible" : true // indicates if it is visible on site - bool
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
image Malformed Image content for language '<language>' is corrupted or is not an image
image Malformed Image content format for language '<language>' is not supported
image Malformed Image size for language '<language>' can not be greater than 200 KB
link Malformed Link for language '<language>' is not a valid HTTP URL
location Invalid Location <location> has already 100 banners

banners.delete

Deletes one o more banners.

JS
CR.api('site.banners.delete', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.banners.delete

request

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

response

{
  "status" : "ok"
}