Open2b versione 7.5

accounts

accounts.find

Returns the accounts that meet the given conditions.

Request

Admin SDK
Admin.api('site.accounts.find', request, function(response) { … });
HTTP POST
/api/v10/site.accounts.find
{
  "conditions" : { // returns only the accounts …
    "after" : 29 // … with identifier after this - int(0…)
  },
  "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…)
  "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.

Request

Admin SDK
Admin.api('site.accounts.get', request, function(response) { … });
HTTP POST
/api/v10/site.accounts.get
{
  "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.

Request

Admin SDK
Admin.api('site.accounts.authenticate', request, function(response) { … });
HTTP POST
/api/v10/site.accounts.authenticate
{
  "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.

Response

Admin SDK
Admin.api('site.accounts.count', null, function(response) { … });
HTTP POST
/api/v10/site.accounts.count
{
  "status" : "ok",
  "count" : 23 // number of accounts - int(0…)
}

accounts.create

Creates a new account.

Request

Admin SDK
Admin.api('site.accounts.create', request, function(response) { … });
HTTP POST
/api/v10/site.accounts.create
{
  "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.

Request

Admin SDK
Admin.api('site.accounts.update', request, function(response) { … });
HTTP POST
/api/v10/site.accounts.update
{
  "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.

Request

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

Response

{
  "status" : "ok"
}