Open2b versione 7.5

attributes views

attributes-views.find

Returns the attributes views that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.attributes-views.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.attributes-views.find
{
  "conditions" : { // returns only the attributes views …
    "after" : 281 // … with identifier after this - int(0…)
  },
  "fields" : [ "id", "code", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned attributes views, can contain "id", "-id", "name" and "-name" - string
  "limit" : 10, // maximum number of attributes views to return - int(1…)
  "first" : 0 // index of the first attributes view to return - int(0…)
}

Response

{
  "status" : "ok",
  "views" : [ {
    "id" : 281, // identifier - int(1…)
    "code" : "SHOES", // code - string(0…40)
    "name" : "Shoes attributes", // name - string(0…60)
    "attributes" : [ 43, 25, 108, … ] // attributes - int(1…)
  }, … ]
}

attributes-views.get

Returns an attributes view given its identifier.

Request

Admin SDK
Admin.api('commerce.attributes-views.get', request, function(response) { … });
HTTP POST
/api/v10/commerce.attributes-views.get
{
  "id" : 281, // identifier of the attributes view (required) - int(1…)
  "fields" : [ "id", "code", … ]  // fields to return - string
}

Response

{
  "status" : "ok",
  "view" : { // (can be null)
    "id" : 281, // identifier - int(1…)
    "code" : "SHOES", // code - string(0…40)
    "name" : "Shoes attributes", // name - string(0…60)
    "attributes" : [ 43, 25, 108, … ] // attributes - int(1…)
  }
}

attributes-views.count

Number of attributes views that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.attributes-views.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.attributes-views.count
{
  "conditions" : { // counts only the attributes views …
    "after" : 281 // … with identifier after this - int(0…)
  }
}

Response

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

attributes-views.create

Creates a new attributes view.

Request

Admin SDK
Admin.api('commerce.attributes-views.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.attributes-views.create
{
  "view" : { // attributes view to create (required)
    "code" : "SHOES", // code - string(0…40)
    "name" : "Shoes attributes", // name - string(0…60)
    "attributes" : [ 43, 25, 108, … ] // attributes - int(1…)
  }
}

Response

{
  "status" : "ok",
  "id" : 281 // identifier of the new attributes view - int(1…)
}

Errors

Field Type Description
attributes Malformed An attribute id is repeated
attributes NotFound Attribute <attribute> does not exist
code Malformed '<code>' has trailing spaces

attributes-views.update

Updates an attributes view. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('commerce.attributes-views.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.attributes-views.update
{
  "id" : 43, // identifier of the attributes view to update (required) - int(1…)
  "view" : { // attributes view's fields to update (required)
    "code" : "SHOES", // code - string(0…40)
    "name" : "Shoes attributes", // name - string(0…60)
    "attributes" : [ 43, 25, 108, … ] // attributes - int(1…)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
attributes Malformed An attribute id is repeated
attributes NotFound Attribute <attribute> does not exist
code Malformed '<code>' has trailing spaces
id NotFound Attributes view <id> does not exist

attributes-views.delete

Deletes one or more attributes views.

Request

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

Response

{
  "status" : "ok"
}