Open2b versione 7.2

movements

movements.find

Returns the movement that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.movements.find', request, function(response) { … });
HTTP POST
/api/v8/commerce.movements.find
{
  "conditions" : { // returns only the movements …
    "sku" : "A927TP", // … with this item SKU - string(1…40)
    "fromCreationTime" : "2020-11-01 12:00:00", // … created after this date - datetime
    "toCreationTime" : "2020-01-31 23:59:59", // … created before this date - datetime
    "keywords" : "shirt", // … with these exact keywords - string(1…100)
    "after" : 58913 // … with identifier after this value - int(0…)
  },
  "fields" : [ "id", "sku", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned movements, can contain "id", "-id", "sku", "-sku", "adjustment", "-adjustment",
                        // "creationTime", "-creationTime", "description", "-description" - string
  "limit" : 10, // maximum number of movements to return - int(1…)
  "first" : 0 // index of the first movement to return - int(0…)
}

Response

{
  "status" : "ok",
  "movements" : [ {
    "id" : 58913, // identifier - int(1…)
    "sku" : "A927TP", // item SKU - string(1…40)
    "adjustment" : "-5.00", // adjustment of the quantity in stock - decimal[11,2]
    "creationTime" : "2020-08-01 12:34:50", // creation time - datetime
    "description" : "order number 3819" // description - string(0…255)
  }, … ]
}

movements.get

Returns a movement given its identifier.

Request

Admin SDK
Admin.api('commerce.movements.get', request, function(response) { … });
HTTP POST
/api/v8/commerce.movements.get
{
  "id" : 58913, // identifier of the movement (required) - int(1…)
  "fields" : [ "id", "sku", … ] // fields to return - string
}

Response

{
  "status"   : "ok",
  "movement" : { // (can be null)
    "id" : 58913, // identifier - int(1…)
    "sku" : "A927TP", // item SKU - string(1…40)
    "adjustment" : "-5.00", // adjustment of the quantity in stock - decimal[11,2]
    "creationTime" : "2020-08-01 12:34:50", // creation time - datetime
    "description" : "order number 3819" // description - string(0…255)
  }
}

movements.count

Number of movements that meet the specified conditions.

Request

Admin SDK
Admin.api('commerce.movements.count', request, function(response) { … });
HTTP POST
/api/v8/commerce.movements.count
{
  "conditions" : { // counts only the movements …
    "sku" : "A927TP", // … with this item SKU - string(1…40)
    "fromCreationTime" : "2020-11-01 12:00:00", // … created after this date - datetime
    "toCreationTime" : "2020-01-31 23:59:59", // … created before this date - datetime
    "keywords" : "shirt", // … with these keywords - string(1…100)
    "after" : 58913 // … with identifier after this value - int(0…)
  }
}

Response

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

movements.create

Creates a new movement.

Request

Admin SDK
Admin.api('commerce.movements.create', request, function(response) { … });
HTTP POST
/api/v8/commerce.movements.create
{
  "movement" : { // movement to create (required)
    "sku" : "A927TP", // item SKU (required) - string(1…40)
    "adjustment" : "-5.00", // adjustment of the quantity in stock (required) - decimal[11,2]
    "description" : "order number 3819" // description - string(0…255)
  }
{

Response

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

Errors

Field Type Description
sku NotFound Item '<sku>' does not exist
adjustment InvalidValue Adjustment <adjustment> is out of range

movements.update

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

Request

Admin SDK
Admin.api('commerce.movements.update', request, function(response) { … });
HTTP POST
/api/v8/commerce.movements.update
{
  "id"  : 58913, // identifier of the movement to update (required) - int(1…)
  "movement" : { // movement's fields to update (required)
    "description" : "order number 3819" // movement's properties to update - string(1…255)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Movement <id> does not exist

movements.delete

Deletes one or more movements.

Request

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

Response

{
  "status" : "ok"
}