Open2b versione 7.5

notes

notes.find

Returns all the notes of a document.

Request

Admin SDK
Admin.api('commerce.notes.find', request, function(response) { … });
HTTP POST
/api/v10/commerce.notes.find
{
  "conditions" : { // returns only the notes …
    "type" : "Customer", // … with this type, can be "Customer", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" (required) - string
    "documents" : [ 1167942543, … ], // … of these documents (id) - int(1…)
    "after" : 39821 // … with identifier after this value - int(0…)
  },
  "fields" : [ "id", "type", "document", … ] // fields to return
  "order" : [ "id", … ], // sort order of returned notes, can contain "id", "-id", "type", "-type", "document", "-document",
                         // "time" and "-time" - string
  "limit" : 10, // maximum number of notes to return - int(1…)
  "first" : 0 // index of the first note to return - int(0…)
}

Response

{
  "status" : "ok",
  "notes" : [ {
    "id" : 39821, // identifier - int(1…)
    "type" : "Customer", // type, can be "Customer", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" - string
    "document" : 1167942543, // document (id) to which the note refers - int(1…)
    "time" : "2020-09-15 14:55:34", // date and time - datetime
    "text" : "Confirmation email has been sent" // text - string(0…1200)
  }, … ]
}

notes.count

Number of notes that meet the given conditions.

Request

Admin SDK
Admin.api('commerce.notes.count', request, function(response) { … });
HTTP POST
/api/v10/commerce.notes.count
{
  "conditions" : { // counts only the notes …
    "type" : "Customer", // … with this type, can be "Customer", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" (required) - string
    "documents" : [ 1167942543, … ], // … of these documents (id) - int(1…)
    "after" : 39821 // … with identifier after this value - int(0…)
  },
}

Response

{
  "status" : "ok",
  "count" : 173 // number of notes - int(1…)
}

notes.create

Creates a new note for a document.

Request

Admin SDK
Admin.api('commerce.notes.create', request, function(response) { … });
HTTP POST
/api/v10/commerce.notes.create
{
  "note" : { // note to create (required)
    "type" : "Customer", // type of document, can be "Customer", "Order", "Quote", "Invoice", "Receipt", "PackingSlip" or "Return" (required) - string
    "document" : 1167942543, // document (id) to which the note refers (required) - int(1…)
    "time" : "2020-09-15 14:55:34", // date and time - datetime
    "text" : "Email has been sent" // text - string(0…1200)
  }
}

Response

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

Errors

Field Type Description
document NotFound Document <document> of type '<type>' does not exist
document LimitReached Document <document> of type '<type>' has already 100 notes

notes.update

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

Request

Admin SDK
Admin.api('commerce.notes.update', request, function(response) { … });
HTTP POST
/api/v10/commerce.notes.update
{
  "id" : 90471, // identifier of the note to update (required) - int(1…)
  "note" : { // note's fields to update (required)
    "time" : "2020-09-15 14:55:34", // date and time - datetime
    "text" : "Email has been sent" // text - string(0…1200)
  }
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
document NotFound Document <document> of type <type> does not exist
time InvalidValue Time '<time>' is in the future
time NotFound Note with time '<time>' does not exist
time AlreadyExists Note with time '<time>' already exists

notes.delete

Deletes one o more notes of a document.

Request

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

Response

{
  "status" : "ok"
}

Errors

Field Type Description
document NotFound Document <document> of type '<type>' does not exist
times InvalidValue Time '<time>' is in the future