# Admin

An administrator account.

# Properties

Property Type Description
uid string The username of the administrator.
email string The contact email of the administrator.
companyRegistrationNumber string Company registration number.
nin string National identification number (or equivalent) in administrator's country.
company string Company name.
firstName string First name.
lastName string Last name.
address string Address, e.g. street and number.
postcode string Postcode.
town string Post town.
country string Country as two-letter ISO 3166-1 alpha-2, e.g. 'SE'.
phone string Phone number.
webshops array A list of webshops that the administrator can modify.

# Methods

# count

Takes a filter object and returns the number of administrators found, as an integer.

# Parameters

A filter object specifying which administrators to count. See Filter objects on the page List selection.

# Example

The request below returns the number of administrators with the email address "viktor@example.com".

Admin.count({
  "/email": "viktor@example.com"
})

# get

Fetches information about an administrator account.

# Parameters

Parameter Description
uid The unique identifier of an administrator account.
query Which info to return. See Query language.

# Example

Admin.get(13012, [
  "uid",
  "username"
])

# getSchema

Fetches the JSON Schema which can be used for client-side validation.

# Parameters

The unique identifier of an administrator account or null for a new account.

# list

Returns an array of objects representing languages.

# Parameters

Parameter Description
query Which info to return. See Query language.
selection Which themes to list. See List selection.

# create

Create a new administrator and return the assigned username and authentication token.

# Parameters

Parameter Description
email E-mail uniquely used to identify the administrator to be created.

# Returns

An object with username and token. token can be used to make a new request authenticated as that administrator.

# Example

Admin.create("foo@example.com")

# login

Authenticates an administrator and returns an authentication token. After a successful login, the user is authenticated for subsequent calls on the same connection (WebSocket). For separate HTTP connections, the authentication token must be passed as a URI parameter for the authentication to be acknowledged.

warning

These authentication tokens MUST be handled with great care since they will grant ANYONE, ANYWHERE, AT ANY TIME who has access to one, administrator rights to your webshop.

# Parameters

Parameter Description
username string
password string

# Returns

An authentication token that can be used in subsequent API connections.

# Example

Admin.login("viktor", "x6E8wsoiwu")