Open2b versione 7.5

returns

returns.find

Returns the returns that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.returns.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.returns.find
{
  "conditions" : { // returns only the returns …
    "ids" : [ 4971, … ], // … with these identifiers - int(1…)
    "orders" : [ 1771949227, … ], // … with at least one item of these orders (id) - int(1…)
    "status" : [ "Approved", … ], // … with these statuses, a status can be "Pending", "Approved", "PartiallyApproved", "Rejected" or "Cancelled" - string
    "fromNumber" : "2020/29183", // … with a number greater or equal to this - string(1…32)
    "toNumber" : "2020/31083", // … with a number lower or equal to this - string(1…32)
    "fromCreationTime" : "2020-01-01 00:00:00", // … with creation time equal or next to this - datetime
    "toCreationTime" : "2020-12-31 23:59:59", // … with creation time equal or previous to this - datetime
    "fromUpdateTime" : "2020-01-26 12:00:00", // … with last update time equal or next to this - datetime
    "toUpdateTime" : "2020-05-30 23:59:59", // … with last update time equal or previous to this - datetime
    "customer": 37091, // … of this customer (id) - int(1…)
    "after" : 739820 // … with identifier after this value - int(0…)
  },
  "fields" : [ "id", "number", "status", … ], // returns only these fields - string
  "order" : [ "returnDate" ], // sort order of returned returns, can contain "id", "-id", "number", "-number",
                              // "status", "-status", "creationTime", "-creationTime, "updateTime", "-updateTime"
  "limit" : 10, // maximum number of returns to return - int(1…)
  "first" : 0 // index of the first return to return - int(0…)
}

Response

{
  "status" : "ok",
  "returns" : [ {
    "id" : 4971, // identifier - int(1…)
    "number" : "481", // number - string(0…32)
    "status" : "Pending", // status, can be "Pending", "Approved", "PartiallyApproved", "Rejected" or "Cancelled" - string
    "creationTime" : "2020-02-01 13:13:47", // creation time - datetime
    "updateTime" : "2020-02-03 16:08:11", // update time - datetime
    "customer": 37091, // customer (id) (can be null) - int(1…)
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "items" : [ { // items
      "shipment" : 739820, // shipment (id) - int(1…)
      "orderItem" : 805703, // order item (id) - int(1…)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "reason" : 7, // reason (id) (can be null) - int(1…)
      "comments" : "Size too small", // comments - string(0…200)
      "approval" : "Pending" // approval, can be "Pending", "Approved", "Rejected" or "Cancelled" - string
    }, … ],
    "ip" : "172.16.254.1" // IP address of the device that made the return (can be null) - string(3…39)
  }, … ]
}

returns.get

Returns a return given its identifier.

Request

Admin SDK
Admin.api('commerce.returns.get', request, function(response) { … });
HTTP POST
/api/v10/commerce.returns.get
{
  "id" : 4971, // identifier (required) - int(1…)
  "fields" : [ "id", "number", "status", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "return"  : { // (can be null)
    "id" : 4971, // identifier - int(1…)
    "number" : "481", // number - string(0…32)
    "status" : "Pending", // status, can be "Pending", "Approved", "PartiallyApproved", "Rejected" or "Cancelled" - string
    "creationTime" : "2020-02-01 13:13:47", // creation time - datetime
    "updateTime" : "2020-02-03 16:08:11", // update time - datetime
    "customer": 37091, // customer (id) (can be null) - int(1…)
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "items" : [ { // items
      "shipment" : 739820, // shipment (id) - int(1…)
      "orderItem" : 805703, // order item (id) - int(1…)
      "quantity" : 3.00, // quantity - decimal[8,2](0…)
      "reason" : 7, // reason (id) (can be null) - int(1…)
      "comments" : "Size too small", // comments - string(0…200)
      "approval" : "Pending" // approval, can be "Pending", "Approved", "Rejected" or "Cancelled" - string
    }, … ],
    "ip" : "172.16.254.1" // IP address of the device that made the return (can be null) - string(3…39)
  }
}

returns.count

Number of returns that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.returns.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.returns.count
{
  "conditions" : { // counts the returns …
    "ids" : [ 4971, … ], // … with these identifiers - int(1…)
    "orders" : [ 1771949227, … ], // … with at least one item of these orders (id) - int(1…)
    "status" : [ "Approved", … ], // … with these statuses, a status can be "Pending", "Approved", "PartiallyApproved", "Rejected" or "Cancelled" - string
    "fromNumber" : "2020/29183", // … with a number greater or equal to this - string(1…32)
    "toNumber" : "2020/31083", // … with a number lower or equal to this - string(1…32)
    "fromCreationTime" : "2020-01-01 00:00:00", // … with creation time equal or next to this - datetime
    "toCreationTime" : "2020-12-31 23:59:59", // … with creation time equal or previous to this - datetime
    "fromUpdateTime" : "2020-01-26 12:00:00", // … with last update time equal or next to this - datetime
    "toUpdateTime" : "2020-05-30 23:59:59", // … with last update time equal or previous to this - datetime
    "customer": 37091, // … of this customer (id) - int(1…)
    "after" : 739820 // … with identifier after this value - int(0…)
  }
}

Response

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

returns.create

Creates a new return.

Request

Admin SDK
Admin.api('commerce.returns.create', request, function(response) { … });
HTTP POST
/api/5/commerce.returns.create
{
  "return" : { // return to create (required)
    "number" : "481", // number - string(0…32)
    "creationTime" : "2020-02-01 13:13:47", // creation time - datetime
    "customer": 37091, // customer (id) (can be null) - int(1…)
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "items" : [ { // items (required)
      "shipment" : 739820, // shipment (id) (required) - int(1…)
      "orderItem" : 805703, // order item (id) (required) - int(1…)
      "quantity" : 3.00, // quantity (required) - decimal[8,2](0…)
      "reason" : 7, // reason (id) (can be null) - int(1…)
      "comments" : "Size too small", // comments - string(0…200)
      "approval" : "Pending" // approval, can be "Pending", "Approved", "Rejected" or "Cancelled" - string
    }, … ],
    "ip" : "172.16.254.1" // IP address of the device that made the return (can be null) - string(3…39)
  }
}

Response

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

Errors

Field Type Description
create NotAvailable Returns are not available for this installation
creationTime InvalidValue Creation time '<creationTime>' is in the future
customer NotFound Customer <customer> does not exist
ip Malformed '<ip>' is not a well formed IP address
ip Malformed IP '<ip>' is not in the RFC 5952 canonical representation format
locale Malformed '<locale>' is not a valid locale code
orderItem NotFound Shipment <shipment> has not order item <orderItem>
quantity InvalidValue Quantity <quantity> of order item <orderItem> is not available for return
reason NotFound Reason <reason> does not exist
shipment NotFound Shipment <shipment> does not exist

returns.update

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

Request

Admin SDK
Admin.api('commerce.returns.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.returns.update
{
  "id" : 4971, // identifier of the return to update (required) - int(1…)
  "return" : { // return's fields to update (required)
    "number" : "481", // number - string(0…32)
    "creationTime" : "2020-02-01 13:13:47", // creation time - datetime
    "customer": 37091, // customer (id) (can be null) - int(1…)
    "locale" : "en-GB", // locale (ISO code) of the customer, region is not mandatory - string(2…5)
    "items" : [ { // items
      "shipment" : 739820, // shipment (id) (required) - int(1…)
      "orderItem" : 805703, // order item (id) (required) - int(1…)
      "quantity" : 3.00, // quantity (required) - decimal[8,2](0…)
      "reason" : 7, // reason (can be null) - int(1…)
      "comments" : "Size too small", // comments - string(0…200)
      "approval" : "Pending" // approval, can be "Pending", "Approved", "Rejected" or "Cancelled" - string
    }, … ],
    "ip" : "172.16.254.1" // IP address of the device that made the return (can be null) - string(3…39)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
creationTime InvalidValue Creation time '<creationTime>' is in the future
customer NotFound Customer <customer> does not exist
id NotFound Return <id> does not exist
ip Malformed '<ip>' is not a well formed IP address
ip Malformed IP '<ip>' is not in the RFC 5952 canonical representation format
locale Malformed '<locale>' is not a valid locale code
orderItem NotFound Shipment <shipment> has not order item <orderItem>
quantity InvalidValue Quantity <quantity> of order item <orderItem> is not available for return
reason NotFound Reason <reason> does not exist
shipment NotFound Shipment <shipment> does not exist
update NotAvailable Returns are not available for this installation

returns.delete

Deletes one or more returns.

Request

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

Response

{
  "status" : "ok"
}