accounts

accounts.find

Returns all the accounts.

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

request

{
  "fields" : [ "id", "name", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned accounts, can contain "id", "-id", "name", "-"name", "email", "-email",
                        // "access", "-access", "days", "-days", "fromHour", "-fromHour", "toHour", "-toHour", "ip" and "-ip" - string
  "limit" : 10, // maximum number of accounts to return - int(1…100)
  "first" : 30 // index of the first account to return - int(0…)
}

response

{
  "status" : "ok",
  "accounts" : [ {
    "id" : 29, // identifier - int(1…)
    "name" : "John Smith", // name - string(1…50)
    "email" : "johnsmith@acme.com", // email address - string(3…120)
    "access" : "Limited", // access, can be "Full", "Limited" or "Denied" - string
    "days" : "MondayToFriday", // days, can be "MondayToSunday", "MondayToSaturday" or "MondayToFriday" - string
    "fromHour" : 7, // from hour - int(0…23)
    "toHour" : 18, // from hour - int(1…24)
    "sections" : [ "Catalog", "Sales", … ], // sections, can be "Catalog", "Inventory", "Marketing", "Sales", "Customers", "Website", "Apps" and "Settings" - string
    "ip" : "135.22.83.12", // IP number (can be null) - string(7…15)
    "locale" : "en-GB", // locale for the admin panel - string(5)
    "gravatarHash" : "…", // gravatar hash - string(32)
    "background" : "green.png", // background file name (can be null) - string(5…36)
    "rowsNumber" : 15 // rows number - int(5…100)
  }, … ]
}

accounts.get

Returns an account given its identifier.

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

request

{
  "id" : 29, // identifier of the account (required) - int(1…)
  "fields" : [ "id", "name", … ] // fields to return - string
}

response

{
  "status" : "ok",
  "account" : { // (can be null)
    "id" : 29, // identifier - int(1…)
    "name" : "John Smith", // name - string(1…50)
    "email" : "johnsmith@acme.com", // email address - string(3…120)
    "access" : "Limited", // access, can be "Full", "Limited" or "Denied" - string
    "days" : "MondayToFriday", // days, can be "MondayToSunday", "MondayToSaturday" or "MondayToFriday" - string
    "fromHour" : 7, // from hour - int(0…23)
    "toHour" : 18, // from hour - int(1…24)
    "sections" : [ "Catalog", "Sales", … ], // sections, can be "Catalog", "Inventory", "Marketing", "Sales", "Customers", "Website", "Apps" and "Settings" - string
    "ip" : "135.22.83.12", // IP number (can be null) - string(7…15)
    "locale" : "en-GB", // locale for the admin panel - string(5)
    "gravatarHash" : "…", // gravatar hash - string(32)
    "background" : "green.png", // background file name (can be null) - string(5…36)
    "rowsNumber" : 15 // rows number - int(5…100)
  }
}

accounts.authenticate

Authenticates an account given its email and password and on success returns it.

JS
CR.api('site.accounts.authenticate', request, function(response) { … });
HTTP
POST /open2b/api/v3/site.accounts.authenticate

request

{
  "email" : "johnsmith@acme.com", // email (required) - string(3…120)
  "password" : "y3Mp7Haz8U", // password (required) - string(5…20)
  "fields" : [ "id", "name", … ] // fields to return - string
}

response

{
  "status" : "ok",
  "account" : [ {  // (can be null)
    "id" : 29, // identifier - int(1…)
    "name" : "John Smith", // name - string(1…50)
    "email" : "johnsmith@acme.com", // email address - string(3…120)
    "access" : "Limited", // access, can be "Full", "Limited" or "Denied" - string
    "days" : "MondayToFriday", // days, can be "MondayToSunday", "MondayToSaturday" or "MondayToFriday" - string
    "fromHour" : 7, // from hour - int(0…23)
    "toHour" : 18, // from hour - int(1…24)
    "sections" : [ "Catalog", "Sales", … ], // sections, can be "Catalog", "Inventory", "Marketing", "Sales", "Customers", "Website", "Apps" and "Settings" - string
    "ip" : "135.22.83.12", // IP number (can be null) - string(7…15)
    "locale" : "en-GB", // locale for the admin panel - string(5)
    "gravatarHash" : "…", // gravatar hash - string(32)
    "background" : "green.png", // background file name (can be null) - string(5…36)
    "rowsNumber" : 15 // rows number - int(5…100)
  }, … ]
}

accounts.count

Total number of accounts.

JS
CR.api('site.accounts.count', null, function(response) { … });
HTTP
POST /open2b/api/v3/site.accounts.count

response

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

accounts.create

Creates a new account.

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

request

{
  "account" : { // account to create (required)
    "name" : "John Smith", // Name (required) - string(1…50)
    "email" : "johnsmith@acme.com", // email address (required) - string(3…120)
    "password" : "G7icE%yQ", // password - string(5…20)
    "access" : "Limited", // access, can be "Full", "Limited" or "Denied" - string
    "days" : "MondayToFriday", // days, can be "MondayToSunday", "MondayToSaturday" or "MondayToFriday" - string
    "fromHour" : 7, // from hour - int(0…23)
    "toHour" : 18, // from hour - int(1…24)
    "sections" : [ "Catalog", "Sales", null ], // sections, can be "Catalog", "Inventory", "Marketing", "Sales", "Customers", "Website", "Apps" and "Settings" - string
    "ip" : "135.22.83.12", // IP number (can be null) - string(7…15)
    "locale" : "en-GB", // locale for the admin panel - string(2…5)
    "gravatarHash" : "…", // gravatar hash - string(32)
    "background" : "green.png", // Background file name (can be null) - string(5…36)
    "rowsNumber" : 15 // Rows number - int(5…100)
  }
}

response

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

Errors

Field Type Description
account LimitReached Maximum number of limited accounts has been reached
background Malformed Background is not a well formed file name
email AlreadyExists Account with email '<email>' already exixts
email Malformed '<email>' is not a well formed email address
ip Malformed '<ip>' is not a well formed IP address
locale Malformed '<locale>' is not a valid locale code

accounts.update

Updates an account. Any fields left out of the request will remain unchanged.

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

request

{
  "id" : 12, // identifier of the account to update (required) - int(1…)
  "account" : { // account's fields to update (required)
    "name" : "John Smith", // Name - string(1…50)
    "email" : "johnsmith@acme.com", // email address - string(3…120)
    "access" : "Limited", // access, can be "Full", "Limited" or "Denied" - string
    "days" : "MondayToFriday", // days, can be "MondayToSunday", "MondayToSaturday" or "MondayToFriday" - string
    "fromHour" : 7, // from hour - int(0…23)
    "toHour" : 18, // from hour - int(1…24)
    "sections" : [ "Catalog", "Sales", null ], // sections, can be "Catalog", "Inventory", "Marketing", "Sales", "Customers", "Website", "Apps" and "Settings" - string
    "ip" : "135.22.83.12", // IP number (can be null) - string(7…15)
    "locale" : "en-GB", // locale for the admin panel - string(2…5)
    "background" : "green.png", // Background file name (can be null) - string(5…36)
    "rowsNumber" : 15 // Rows number - int(5…100)
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
access InvalidValue Access 'Limited' is not allowed
id NotFound Account <id> does not exist
background Malformed Background is not a well formed file name
email AlreadyExists Account with email '<email>' already exixts
email Malformed '<email>' is not a well formed email address
ip Malformed '<ip>' is not a well formed IP address
locale Malformed '<locale>' is not a valid locale code

accounts.delete

Deletes one o more accounts.

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

request

{
  "ids" : [ 29, 12, … ] // identifiers of the accounts to delete (required) - int(1…)
}

response

{
  "status" : "ok"
}