Open2b versione 7.5

tax-classes

tax-classes.find

Returns all the tax classes.

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

Request

{
  "conditions" : { // counts the tax classes …
    "after" : 2 // … with identifier after this value - int(0…)
  },
  "fields" : [ "id", "code", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned tax classes, can contain "id", "-id", "code", "-code", "name" and "-name" - string
  "limit" : 10, // maximum number of tax classes to return - int(1…)
  "first" : 0 // index of the first tax class to return - int(0…)
}

Response

{
  "status" : "ok",
  "taxClasses" : [ {
    "id" : 7, // identifier - int(1…)
    "code" : "TVA", // code - string(1…32)
    "name" : "Europe" // name - string(0…60)
  }, … ]
}

tax-classes.get

Returns a tax class given its identifier.

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

Request

{
  "id" : 7, // identifier (required) - int(1…)
  "fields" : [ "id", "code", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "taxClass" : { // (can be null)
    "id" : 7, // identifier - int(1…)
    "code" : "TVA", // code - string(1…32)
    "name" : "Europe" // name - string(0…60)
  }
}

tax-classes.count

Number of tax classes that meet the given conditions.

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

Request

{
  "conditions" : { // counts the tax classis …
    "after" : 2 // … with identifier after this value - int(0…)
  }
}

Response

{
  "status" : "ok",
  "count" : 9 // number of tax classes - int(0…)
}

tax-classes.create

Creates a new tax class.

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

Request

{
  "taxClass" : { // tax class to create (required)
    "code" : "TVA", // code (required) - string(1…32)
    "name" : "Europe" // name - string(0…60)
  }
}

Response

{
  "status" : "ok",
  "id" : 7 // identifier of the new tax class - int(1…)
}

Errors

Field Type Description
code AlreadyExists Tax class code '<code>' already exists

tax-classes.update

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

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

Request

{
  "id" : 43, // identifier of the tax class to update (required) - int(1…)
  "taxClass" : { // tax class's fields to update (required)
    "code" : "TVA", // code - string(1…32)
    "name" : "Europe" // name - string(0…60)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
code AlreadyExists Tax class code '<code>' already exists
id NotFound Tax class <id> does not exist

tax-classes.delete

Deletes one o more tax classes.

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

Request

{
  "ids" : [ 7, 3, 5, … ] // identifiers of the tax classes to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}