suppliers

suppliers.find

Returns the suppliers that meet the given conditions.

JS
CR.api('commerce.suppliers.find', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.suppliers.find

request

{
  "conditions" : { // returns the suppliers with this …
    "ids" : [ 285, 378, … ], // … identifiers - int(1…)
    "code" : "TF78123", // … code - string(1…32)
    "keywords" : "acme", // … keywords in code, name, company code or email - string(1…20)
    "country" : "GB", // … country (ISO code) - string(2)
    "stateProv" : "LND" // … state, province or county - string(1…3)
  },
  "fields" : [ "id", "code", … ], // fields to return - string
  "order" : [ "id" ], // sort order of returned suppliers, can contain "id", "-id", "code", "-code", "email", "-email",
                      // "companyName", "-companyName", "companyCode", "-companyCode", "country", "-country",
                      // "phoneNumber", "-phoneNumber", "mobileNumber", "-mobileNumber", "faxNumber", "-faxNumber",
                      // "updateTime" and "-updateTime" - string
  "limit" : 10, // maximum number of suppliers to return - int(1…100)
  "first" : 0 // index of the first supplier to return - int(0…)
}

response

{
  "status" : "ok",
  "suppliers" : [ {
    "id" : 285, // identifier - int(1…)
    "code" : "TF78123", // code - string(0…32)
    "firstName" : "Sherlock", // first name - string(0…25)
    "lastName" : "Holmes", // last name - string(0…25)
    "personalCode" : "SH239IBA", // personal code number - string(0…20)
    "companyName" : "Investigations Inc", // company name - string(1…100)
    "companyCode" : "INV8403MC1", // company code number - string(0…20)
    "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
    "street1" : "221b Baker Street", // street, first row - string(0…60)
    "street2" : "", // street, second row - string(0…60)
    "city" : "London", // city - string(0…25)
    "postalCode" : "NW1 6XE", // postal code - string(0…20)
    "stateProv" : "LND", // state, province or county - string(0…3)
    "country" : "GB", // country (ISO code) - string(2)
    "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
    "mobileNumber" : "", // mobile number - string(0…15)
    "faxNumber" : "", // fax number - string(0…15)
    "email" : "holmes@inv-london.com", // email address - string(0…120)
    "updateTime" : "2013-09-05 15:38:07" // last update time - datetime
  }, … ]
}

suppliers.get

Returns a supplier given its identifier.

JS
CR.api('commerce.suppliers.get', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.suppliers.get

request

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

response

{
  "status" : "ok",
  "supplier" : { // (can ben null)
    "id" : 285, // identifier - int(1…)
    "code" : "TF78123", // code - string(0…32)
    "firstName" : "Sherlock", // first name - string(0…25)
    "lastName" : "Holmes", // last name - string(0…25)
    "personalCode" : "SH239IBA", // personal code number - string(0…20)
    "companyName" : "Investigations Inc", // company name - string(1…100)
    "companyCode" : "INV8403MC1", // company code number - string(0…20)
    "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
    "street1" : "221b Baker Street", // street, first row - string(0…60)
    "street2" : "", // street, second row - string(0…60)
    "city" : "London", // city - string(0…25)
    "postalCode" : "NW1 6XE", // postal code - string(0…20)
    "stateProv" : "LND", // state, province or county - string(0…3)
    "country" : "GB", // country (ISO code) - string(2)
    "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
    "mobileNumber" : "", // mobile number - string(0…15)
    "faxNumber" : "", // fax number - string(0…15)
    "email" : "holmes@inv-london.com", // email address - string(0…120)
    "updateTime" : "2013-09-05 15:38:07" // last update time - datetime
  }
}

suppliers.count

Number of suppliers that meet the given conditions.

JS
CR.api('commerce.suppliers.count', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.suppliers.count

request

{
  "conditions" : { // counts the suppliers with this …
    "ids" : [ 285, 378, … ], // … identifiers - int(1…)
    "code" : "TF78123", // … code - string(1…32)
    "keywords" : "acme", // … keywords in code, name, company code or email - string(1…20)
    "country" : "GB", // … country (ISO code) - string(2)
    "stateProv" : "LND" // … state, province or county - string(1…3)
  }
}

response

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

suppliers.create

Create a new supplier.

JS
CR.api('commerce.suppliers.create', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.suppliers.create

request

{
  "supplier" : { // supplier to create (required)
    "code" : "TF78123", // code - string(0…32)
    "firstName" : "Sherlock", // first name - string(0…25)
    "lastName" : "Holmes", // last name - string(0…25)
    "personalCode" : "SH239IBA", // personal code number - string(0…20)
    "companyName" : "Investigations Inc", // company name (required) - string(1…100)
    "companyCode" : "INV8403MC1", // company code number - string(0…20)
    "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
    "street1" : "221b Baker Street", // street, first row - string(0…60)
    "street2" : "", // street, second row - string(0…60)
    "city" : "London", // city - string(0…25)
    "postalCode" : "NW1 6XE", // postal code - string(0…20)
    "stateProv" : "LND", // state, province or county - string(0…3)
    "country" : "GB", // country (ISO code) - string(2)
    "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
    "mobileNumber" : "", // mobile number - string(0…15)
    "faxNumber" : "", // fax number - string(0…15)
    "email" : "holmes@inv-london.com" // email address - string(0…120)
  }
}

response

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

Errors

Field Type Description
code AlreadyExists Code '<code>' already exists
email InvalidValue '<email>' is not a well formed email address

suppliers.update

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

JS
CR.api('commerce.suppliers.update', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.suppliers.update

request

{
  "id" : 285, // identifier of the supplier to update (required) - int(1…)
  "supplier" : { // supplier's fields to update (required)
    "code" : "TF78123", // code - string(0…32)
    "firstName" : "Sherlock", // first name - string(0…25)
    "lastName" : "Holmes", // last name - string(0…25)
    "personalCode" : "SH239IBA", // personal code number - string(0…20)
    "companyName" : "Investigations Inc", // company name - string(1…100)
    "companyCode" : "INV8403MC1", // company code number - string(0…20)
    "companyCode2" : "7J BA3 006", // second company code number - string(0…20)
    "street1" : "221b Baker Street", // street, first row - string(0…60)
    "street2" : "", // street, second row - string(0…60)
    "city" : "London", // city - string(0…25)
    "postalCode" : "NW1 6XE", // postal code - string(0…20)
    "stateProv" : "LND", // state, province or county - string(0…3)
    "country" : "GB", // country (ISO code) - string(2)
    "phoneNumber" : "+44+207 2243688", // phone number - string(0…15)
    "mobileNumber" : "", // mobile number - string(0…15)
    "faxNumber" : "", // fax number - string(0…15)
    "email" : "holmes@inv-london.com" // email address - string(0…120)
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Supplier '<id>' does not exist
code AlreadyExists Code '<code>' already exists
email InvalidValue Email '<email>' is not a well formed email address

suppliers.delete

Deletes one or more suppliers.

JS
CR.api('commerce.suppliers.delete', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.suppliers.delete

request

{
  "ids" : [ 285, 71, 392, … ] // identifiers of the suppliers to delete (required) - int(1…)
}

response

{
  "status" : "ok"
}