Open2b versione 7.2

labels

labels.add

Adds one or more labels to one or more resources.

Request

Admin SDK
Admin.api('commerce.labels.add', request, function(response) { … });
HTTP POST
/api/v8/commerce.labels.add
{
  "ids" : [ 1, 5, 12, … ], // identifiers of the labels to add (required) - int(1…64)
  "type" : "Product", // type of resources, can be "Customer", "Product", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" (required) - string
  "resources" : [ 125, 543, … ] // resources (id) to which assign the labels (required) - int(1…)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids Malformed An identifier is repeated
resources Malformed A resource is repeated
resources Malformed There cannot be more than 1000 resources

labels.find

Returns the labels added to one or more resources.

Request

Admin SDK
Admin.api('commerce.labels.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.labels.find
{
  "conditions" : { // returns only the labels (required) …
    "type" : "Product", // type of resources, can be "Customer", "Product", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" or "PackingSlip" (required) - string
    "resources" : [ 125, 543, 75, … ], // resources (id) for which to return the labels (required) - int(1…)
    "mustHaveName" : true // indicates if the label must have a name - bool
  }
}

Response

{
  "status" : "ok",
  "labels" : { // labels for each resource, only resources with at least one label are returned
    "125" : [ 1, 5, 12, … ],
    "75" : [ 5, 7, … ]
  }
}

Errors

Field Type Description
resources Malformed A resource is repeated
resources Malformed There cannot be more than 1000 resources

labels.replace

Replaces all the labels added to one or more resources.

Request

Admin SDK
Admin.api('commerce.labels.replace', request, function(response) { … });
HTTP POST
/api/v8/commerce.labels.replace
{
  "ids" : [ 1, 5, 12, … ], // labels (id) that replace the old ones (required) - int(1…64)
  "type" : "Product", // type of resources, can be "Customer", "Product", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" (required) - string
  "resources" : [ 125, 543, … ] // resources (id) in which to replace the labels (required) - int(1…)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids Malformed An identifier is repeated
resources Malformed A resource is repeated
resources Malformed There cannot be more than 1000 resources

labels.remove

Removes one or more labels from one or more resources.

Request

Admin SDK
Admin.api('commerce.labels.remove', request, function(response) { … });
HTTP POST
/api/v8/commerce.labels.remove
{
  "ids" : [ 1, 5, 12, … ], // labels (id) to remove (required) - int(1…64)
  "type" : "Product", // type of resources, can be "Customer", "Product", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" (required) - string
  "resources" : [ 125, 543, … ] // resources (id) from which to remove the labels, or null to remove the labels from all the resources (can be null) - int(1…)
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
ids Malformed An identifier is repeated
resources Malformed A resource is repeated
resources Malformed There cannot be more than 1000 resources