Open2b versione 7.2

return-reasons

return-reasons.find

Returns the return reasons that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.return-reasons.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.return-reasons.find
{
  "conditions" : { // return only the reasons …
    "after" : 6 // … with identifier after this value - int(0…)
  }
}

Response

{
  "status" : "ok",
  "reasons" : [ {
    "id" : 7, // identifier - int(1…)
    "description" : { // description - string(2) -> string(0…120)
      "en" : "Item is defective",
      "it" : "Prodotto difettoso"
    }
  }, … ]
}

return-reasons.get

Returns a return reason given its identifier.

Request

Admin SDK
Admin.api('commerce.return-reasons.get', request, function(response) { … });
HTTP POST
/api/v8/commerce.return-reasons.get
{
  "id" : 7 // identifier (required) - int(1…)
}

Response

{
  "status" : "ok",
  "reason" : { // (can be null)
    "id" : 7, // identifier - int(1…)
    "description" : { // description - string(2) -> string(0…120)
      "en" : "Item is defective",
      "it" : "Prodotto difettoso"
    }
  }
}

return-reasons.count

Number of return reasons that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.return-reasons.count', request, function(response) { … });
HTTP POST
/api/v8/commerce.return-reasons.count
{
  "conditions" : { // counts the reasons …
    "after" : 6 // … with identifier after this value - int(0…)
  }
}

Response

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

return-reasons.create

Creates a new return reason.

Request

Admin SDK
Admin.api('commerce.return-reasons.create', request, function(response) { … });
HTTP POST
/api/5/commerce.return-reasons.create
{
  "reason" : { // reason to create (required)
    "description" : { // description - string(2) -> string(0…120)
      "en" : "Item is defective",
      "it" : "Prodotto difettoso"
    }
  }
}

Response

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

return-reasons.update

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

Request

Admin SDK
Admin.api('commerce.return-reasons.update', request, function(response) { … });
HTTP POST
/api/v8/commerce.return-reasons.update
{
  "id" : 7, // identifier of the reason to update (required) - int(1…)
  "reason" : { // reason's fields to update (required)
    "description" : { // description (required) - string(2) -> string(0…120)
      "en" : "Item is defective",
      "it" : "Prodotto difettoso"
    }
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Return reason <id> does not exist
update NotAvailable Return reasons are not available for this installation

return-reasons.delete

Deletes one or more reasons.

Request

Admin SDK
Admin.api('commerce.return-reasons.delete', request, function(response) { … });
HTTP POST
/api/v8/commerce.return-reasons.delete
{
  "ids" : [ 7, 12, … ] // identifiers of the return reasons to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}