The clevabit API is organized around the REST principle. It features predictable resource-oriented HTTP URLs.
While all request bodies are expected in JSON encoded request objects, all responses provided by the API are encoded as CBOR objects, except stated otherwise.
The API uses standard HTTP verbs, and response codes.
This documentation is constructed using a couple of different styles.
The first paragraphs give information about basic concepts and requirements that need to be understood and followed when using the API.
The second part of the documentation contains the available operations, grouped by domain. The operations descriptions contain multiple different information in a very concise representation. The following image gives a quick overview of the information available from those specifications.
The last part of the documentation is a definition of all the objects being used for requests and responses. Those are directly being linked back and forth with the operations.
Possible API Modifiers (Tags)
Certain APIs are marked with specific tags. Those tags give additional information about the status of the API.
At the moment the following tags are defined:
- Work In Progress (WIP): This API is in specification progress. Please be aware that it may not be implemented yet or change without further notice.
- Deprecated (DEP): This API is deprecated and shouldn’t be used anymore. Please exchange code that still uses this endpoint.
- To Be Removed (TBR): This API was deprecated before and is now marked to be removed in the near future.
This documentation is updated and extended on a constant basis. Keeping informed about updates may be important, especially when it comes to deprecations or removal.
While we try to keep things backwards compatible, certain situations, e.g. security concerns, force us to make incompatible changes to the API.
To stay informed with important updates, you can join the Developer Portal Updates mailing list and automatically receive updates whenever important updates happen right into your inbox.
To sign up for being notified automatically use the form below.
The clevabit API provides different base URLs, depending on the environment to use. The Sandbox is for non-production, development and testing, whereas the other environments are used for Production and depend on the region of the world the user is assigned to. Those domains must be used for production use only.
Sandbox: https://sandbox.clevabit.cloud/api/v1
EU Production: https://eu.app.clevabit.cloud/api/v1
environment: sandbox
domain: sandbox.clevabit.com
The Sandbox provides demo data from testing devices, which are not related to any real world customer. That said, the Sandbox cannot access real customer data.
To login into the Sandbox, use the same application id and application key to be used against the production environment, however username/email and password are different and valid only with the sandbox environment.
Apart from that, the sandbox has one additional feature, which is not available in the production environment.
The sandbox includes support to send and receive objects as JSON. Support for this feature is implemented according to the W3C defined standard headers:
HTTP Header | Direction | Description |
---|---|---|
Accept | Request | Can be set to one of the content types (application/cbor or application/json) and defines the content encoding of the request object. |
Content-Type | Response | Can be set to one of the content types (application/cbor or application/json) and defines the content encoding of the response object. |
Furthermore, the Sandbox has relaxed Rate Limits, therefore is suited for development and debugging uses.
environment: eu.app
domain: eu.app.clevabit.cloud
The Production environment is used for real world requests, being directed towards real customer data and objects are always encoded as CBOR with the content type application/cbor). Accept and Content-Type headers are ignored in production.
Production environments have specific Rate Limits. Therefore, development and testing should only be executed against the Sandbox environment.
This API environment must not be used for development or debugging.
API calls to any endpoint other than /auth require a valid authorization (Bearer) token.
Valid tokens can be acquired using two separate methods, depending on the client that wants to access the API.
For partner applications systems, that use direct server to server communication, the API provides the /auth endpoint which must be called with valid set of its unique application id (x-app-id) and application key (x-app-key) credentials. Furthermore, a valid customer id (x-app-cid) registered with the partner application must be given.
For partner applications reading data for multiple users, a special account with access to multiple customer accounts may be provided. Otherwise multiple requests (one request per customer account) are required.
Registered web- or mobile frontends have to use the oauth2 / OpenID based login mechanism through https://auth.clevabit.com. This URL provides a standard conforming mechanism according to the oauth2 and OpenId specification. To provide a frontend, the respective web- or mobile application has to be registered with clevabit first. Login attempts from non-registered applications will be prevented.
To request a set of application id and application key, or to register a frontend with clevabit, please contact your clevabit representative.
After a valid login, the response contains the Authorization Token, which is used for further calls to the API. This token is also known as Bearer Token.
The Authorization Token itself is a base64 encoded and signed JSON object, called JSON WebToken.
The Bearer Token can be provided by two different ways, one more suited for web applications (especially progressive webapps), the latter one for server to server communication.
When using a HTTP client which directly supports cookies (like browsers), the authorization cookie is automatically set upon successful login.
The Authorization Token is a signed and base64 encoded JSON Webtoken. This means it can be decoded by the application, and using the correct public key, it could also be validated.
The JSON Webtoken contains a set of values which might or might not be interesting to the application. The full JWT specification is available as RFC 7519.
The clevabit API uses two types of tokes, depending on how you authorized with the API. While Auth0 provided JWT tokens (all frontend logins) check permissions based on a finer grained scope system, according to the OAuth2 / OpenId specification. Tokens retrieved through the Application login Logging In (Applications) though, use a slightly simpler access system purely based on roles, as applications can act on multiple customers (if priviledges are set).
To decode the JSON Webtoken, the signature has to be cut off and the base64 encoded data have to be decoded and parsed into a JSON data structure.
Using JavaScript, the following function, helps performing those steps.
function parseJwt(token: any): any {
let base64Url = token.split('.')[1];
let base64 = base64Url.replaceAll('-', '+').replaceAll('_', '/');
return JSON.parse(window.atob(base64));
}
Values inside the JSON Webtoken:
Key | Name | Value | Datatype |
---|---|---|---|
iss | Issuer | This value represents the issuer of the token. | string |
sub | Subject | The username/email address used to login | string |
aud | Audience | The customer’s name | string |
nbf | Not Before | Token not valid before timestamp | number |
jti | JSON Webtoken ID | Randomly generated UUID at login, to make the JWT unique per login | string (format: uuid) |
iat | Issued At | Timestamp of the creation time of the JWT | number |
exp | Expiration | Timestamp of the expiration time of the JWT | number |
ips | IP Address | Actual IP address used for the login | string |
Additionally to the standard claims described above, partner application login tokens contain an additional set of namespaced claims.
Claim namespaces for clevabit partner application tokens always begin with the namespace https://auth.clevabit.com/ appended by the actual claim’s name. That said, a namespaced claim test would actually be represented by a claim with the key https://auth.clevabit.com/test.
Available claims are:
Key | Name | Value | Datatype |
---|---|---|---|
customers | Customer IDs / References | The customer UUID list | string[] (format: uuid), comma separated list |
shortname | Shortname | The customer’s internal short reference | string |
roles | Roles / permissions | Roles or permissions assigned to the account or application | string[], comma separated list |
The Subscription Query Language is a simple object type based language to define object updates being interested in.
The syntax is defined to be easily understandable, parsable and writeable, and follows the following basic rules:
<identifier>: <predicate>, <anotheridentifier>: <anotherpredicate>
The term identifier in this case is the actual property type of interest, e.g. device or customer, followed by a colon and then the value definition.
Value definitions are one of the following types:
A selector of * (asterisk) selects all possible values. It’s the strongest wildcard, and returns true for all matchers.
device: *
The * selector can also be used by itself as a simple “select all” selector, without providing any specific identifiers. In this case, however, no further selection can be provided.
A string selector is always enclosed in starting and terminating " (double quotes). Single quotes are not supported for strings, that said, double quotes inside the string need to be escaped with a \ (reverse backslash).
A floating point value is a float64 representation, either positive or negative. Decimal separator is always a dot (not comma) and leading zeros can be omitted.
An integer value is an int64 representation, either positive or negative. Leading zeros are allowed.
A list is a simple container to collect a group of sub selectors to select multiple elements at the same time, e.g. multiple device ids.
A simple example to select two devices based on their UUIDs:
device: [ 066c9fbf-6799-47b8-90b9-fabc113c90a9, 47abe0cd-87ac-4a3c-9bb0-909babe9939a ]
In addition multiple object types can be chained into a single query to select elements with more than one property. This can be achieved by separating the different query parts by a comma.
The following example would select all devices of a single barn, represented by the given UUID.
device: *, barn: 066c9fbf-6799-47b8-90b9-fabc113c90a9
UUIDs must be represented as an UUID literal, as defined by the RFC 4122 Section 3 with 32 hexadecimal digits (base-16) and 5 groups separated by hyphens, in the form of 8-4-4-4-12.
The query language grammar is defined as the following pseudo grammar definition:
WHITESPACE: [ \r\n\t]+ -> skip ;
fragment Letter: [a-zA-Z]+ ;
fragment HexDigit: [0-9a-fA-F] ;
fragment HexOctet: HexDigit HexDigit ;
fragment OctalDigit: [0-7] ;
fragment ZeroToThree: [0-3] ;
fragment DigitNoZero: [1-9] ;
fragment Digit: '0' | DigitNoZero ;
fragment NaturalNumber: DigitNoZero Digit* ;
fragment Character: ~['"\\] | EscapeSequence ;
fragment EscapeSequence: '\\' [btnfr"'\\] | '\\' OctalDigit | '\\' OctalDigit OctalDigit | '\\' ZeroToThree OctalDigit OctalDigit ;
fragment DoubleHex: HexOctet HexOctet ;
fragment QuadHex: DoubleHex DoubleHex ;
fragment SextetHex: DoubleHex DoubleHex DoubleHex ;
MINUS: ('-') ;
GT: '>' ;
LT: '<' ;
GE: '>=' ;
LE: '<=' ;
ASSIGN: '=' ;
WILDCARD: '*' ;
IDENTIFIER: Letter (Letter | '-')* Letter ;
TERMINAL: ('"' Character* '"') | ('\'' Character* '\'') ;
FLOAT: ('0' | NaturalNumber)? '.' Digit Digit* ;
INTEGER: Digit+ ;
UUID: QuadHex '-' DoubleHex '-' DoubleHex '-' DoubleHex '-' SextetHex ;
query:
'*' # selectAll
| (elementRule (',' elementRule)* EOF) # elements
;
floatRule:
MINUS? FLOAT
;
integerRule:
MINUS? INTEGER
;
elementRule:
identifier=IDENTIFIER ':' predicate=predicateRule
;
uuidRule:
uuid=UUID
;
wildcardRule:
WILDCARD
;
stringLiteralRule:
TERMINAL
;
predicateRule:
listRule #list
| objectRule #object
| floatRule #float
| integerRule #integer
| uuidRule #uuid
| wildcardRule #wildcard
| stringLiteralRule #string
| comparisonRule #comparison
;
listElementsRule:
(floatRule (',' floatRule)*) #floats
| (integerRule (',' integerRule)*) #integers
| (uuidRule (',' uuidRule)*) #uuids
| (stringLiteralRule (',' stringLiteralRule)*) #strings
;
listRule:
'[' listElementsRule? ']'
;
objectRule:
'{' query '}'
;
comparisonRule:
comp1=comparisonRule '&&' comp2=comparisonRule #and
| comp1=comparisonRule '||' comp2=comparisonRule #or
| operatorRule #operator
;
operatorRule:
op=(GT | LT | GE | LE) floatRule | integerRule
;
All data returned from the authenticated API calls is encoded in the space efficient binary data format CBOR, except stated otherwise.
CBOR is a standard for binary encoding, specified through the IETF (Internet Engineering Task Force) and available as RFC 7049. The object format of CBOR objects mostly resembles those of JSON objects, supporting objects, lists, dictionaries and properties. The main reason for using CBOR is the binary representation, variable length encoding of numeric values, as well as the easiness of encoders and decoders.
The only exception is the Sandbox environment, which can be asked to return JSON objects instead.
CBOR encoders and decoders are available for many programming languages and runtime environments. An extensive but not complete list is available from the CBOR website.
The API is subject to rate limiting. If no customer specific rate limit is defined, the default rate limiting rules apply.
- Maximum of login attempts per IP: 10 per hour
- Maximum of unauthenticated requests: 200 per hour
- Maximum of authenticated requests: 5000 per day
Since the API is not designed for data polling, low limits are set by default. Keeping up-to-date with the continuously arriving measurements, the API defines an Event subscription mechanism, based on WebSocket. An alternative is to subscribe to an MQTT event channel.
Because of these low rate limits, development and debugging must be executed against the Sandbox environment, where rate limitations don’t apply.
The given rate limits can be found from HTTP response headers, which giving information about the remaining quota and time in the current time window.
API endpoints which can be accessed in an unauthenticated state respond with the unauthenticated quote, while endpoints with authentication need respond with the corresponding authenticated quota though.
Requests that exceed the given quota return with the HTTP status 429 (Too Many Requests) and also provide a Retry-After header, which represents the number of seconds (in UTC epoch) to wait before retrying the request.
Additional headers represent values according to the following table:
Header | Description | Included |
---|---|---|
X-Rate-Limit-Limit | The rate limit ceiling this specific request | Every Response |
X-Rate-Limit-Remaining | The number of requests left for the current time window | Every Response |
X-Rate-Limit-Reset | The remaining window before the rate limit resets in UTC epoch seconds | Every Response |
Retry-After | The number of seconds (in UTC epoch) before rertying this request | Exceeding Requests only |
The Service Id is a short alpha-numerical code, which is used in certain support requests and special operations, e.g. the AuthCode is not readable anymore.
The main reason behind the code is, it can be manually input (in contrast to the long AuthCode) and has a check digit at the end to catch basic input errors.
The first 8 characters are random printable ascii characters, while the last digit is the check digit. It is calculated according to the following pseudo code:
checkDigit := 0
for character in serviceId[0:8]
checkDigit := checkDigit + ascii(character)
checkDigit := checkDigit % 10
checkDigit := 10 - checkDigit
ok := checkDigit == int(serviceId[9])
The unit of a ValueType is defined as in the following table.
Value Type | Data Unit | UUID |
---|---|---|
Temperature | Degree Kelvin | 7fec9d76-8e4b-48e7-9c85-cf5cf865c4eb |
Humidity | Percent | b1a43e5d-2a8c-40ee-9f93-fcd3f66303e4 |
Ammonia | PPM (Parts per Million) | b7faf6da-5ef2-4e63-845f-c72561482ea1 |
Carbon Dioxide | PPM (Parts per Million) | 5873342c-4c0a-4d06-928a-f109133d3868 |
Illuminance | Lux | 6d4f79f6-e1bc-4e9f-82cc-bcfd1d1c0d27 |
This list only contains the most commonly used Value Types. In case a full list of Value Types is required, the Metadata API provides a call which retrieves all Value Type information.
{environment}
.app.clevabit.cloud/api/v1/authAuthentication
The Authorization endpoint is used to execute an actual login.
A valid x-app-cid header can be provided for logins to other customer accounts form the default assigned one. Additional account privileges have to be available to be able to login into other customers.
The way the customer’s UUID is retrieved may differ depending on the login method.
Request headers
The customer id is a UUID, which is provided as a string according to REF 4122 Section 3 in 5 groups separated by hyphens, in the form of 8-4-4-4-12, with characters being lower case.
The application id is a UUID, which is provided as a string according to REF 4122 Section 3 in 5 groups separated by hyphens, in the form of 8-4-4-4-12, with characters being lower case.
The application key is a random string, 64 characters long. The value is case sensitive.
Responses
The login attempt was successful
Body
Examples
{
"token": "...encoded token...",
"customer": {
"ref": "...customer uuid...",
"type": "customer"
},
"account": {
"ref": "...account uuid...",
"type": "account"
}
}
The request is malformed or missing at least one requirement
The username or password is wrong
The account is not allowed for the requested customer (x-app-cid)
curl -X POST \
"https://{environment}.clevabit.com/api/v1/auth" \
-H "x-app-id: ...uuid..." \
-H "x-app-key: ...app_key..." \
-H "x-app-cid: ...uuid..."
{environment}
.app.clevabit.cloud/api/v1/authAuthentication
Calling the /auth endpoint with the DELETE method, logs out the current authenticated user. The user is identified from the Authorization Token provided by the authorization header field or using the HTTP cookie.
Responses
The logout attempt was successful
The logout attempt failed
curl -X DELETE \
"https://{environment}.clevabit.com/api/v1/auth" \
-H "Authentication: Bearer ...encoded_token..."
{accountId}
{accountId}
{accountId}
/password{environment}
.app.clevabit.cloud/api/v1/accounts/{accountId}
Authentication
Returns the user profile for the given account’s uuid.
Path variables
The account’s uuid
Responses
{environment}
.app.clevabit.cloud/api/v1/accounts/{accountId}
Authentication
Updates data in the user account. Updateable elements are metadata and the contact information (as well as contact address). Metadata is not merged though, but overridden.
Path variables
The account’s uuid
Request body
Responses
The update was succesfully executed.
Request decoding failed
Not logged in
No access to the account
Resource not found
Unspecific error
{environment}
.app.clevabit.cloud/api/v1/accounts/{accountId}
/passwordAuthentication
Updates the password of the useraccount.
Path variables
The account’s uuid
Request body
The new password to set.
Responses
The update was succesfully executed.
Body
Request decoding failed
Not logged in
No access to the account
Resource not found
Unspecific error
All customer related information are collected underneath the /customer endpoint. This includes data like devices, data series, queries and customer related information.
A user account can only access information for the customer the account is assigned to. A customer, though, can have multiple accounts assigned. Depending on the account’s permissions, not all endpoints might be available, e.g. an account might only be authenticated to view a specific subset of the customer’s devices.
{customerId}
{customerId}
{customerId}
/delegates{customerId}
/clients{customerId}
/contacts{customerId}
/contacts/{contactId}
{customerId}
/contacts{customerId}
/contacts/{contactId}
{customerId}
/contacts/{contactId}
{customerId}
/addresses{customerId}
/addresses/{addressId}
{customerId}
/addresses{customerId}
/addresses/{addressId}
{customerId}
/addresses/{addressId}
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
Authentication
This endpoint retrieves basic information on the customer specified by {customerid}.
The logged in account needs to have access to the respective customer and permissions to view the information.
Path variables
The customer’s UUID
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
Authentication
This endpoint updates the customer’s information.
Path variables
The customer’s UUID
Request body
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/delegatesAuthentication
Receives all delegates configured for the customer. A delegate is another customer which is accessible from the current customer as it would have all the same access rights. This is normally used for customers from specific departments with individual billing addresses or access to daughter companies.
Path variables
The customer’s UUID
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/clientsAuthentication
Receives all clients configured for the customer. A client is the a business associate of the requested customer. Examples of valid clients include the customer of a supplier or the customer of a veterinarian.
Path variables
The customer’s UUID
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/contactsAuthentication
This endpoint provides a list of all contacts associated with the selected customer.
If the body contains a valid ContactsRequest which specifies a query for one or more of the available query attributes, the result will be filtered to only match contacts with the given filter criteria.
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
The request was malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/contacts/{contactId}
Authentication
This endpoint retrieves a specific contact, selected by the given contact id.
Path variables
The customer’s UUID
The contact’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/contactsAuthentication
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/contacts/{contactId}
Authentication
Path variables
The customer’s UUID
The contact’s UUID
Request body
Responses
The request was successfully executed
The silo wasn’t updated
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/contacts/{contactId}
Authentication
The endpoint removes a previously created contact with the selected customer.
Path variables
The customer’s UUID
The contact’s UUID
Responses
The request was successfully executed
The request was malformed, e.g. request body was missing
The requester is not logged in
The requester has no access to the customer
The resource wasn’t found
The contact is still assigned and cannot be deleted
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/addressesAuthentication
This endpoint provides a list of all addresses associated with the selected customer.
If the body contains a valid AddressesRequest which specifies a query for one or more of the available query attributes, the result will be filtered to only match addresses with the given filter criteria.
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
The request was malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/addresses/{addressId}
Authentication
This endpoint retrieves a specific address, selected by the given address id.
Path variables
The customer’s UUID
The address’ UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/addressesAuthentication
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/addresses/{addressId}
Authentication
Path variables
The customer’s UUID
The address’ UUID
Request body
Responses
The request was successfully executed
The silo wasn’t updated
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/addresses/{addressId}
Authentication
The endpoint removes a previously created address with the selected customer. The operation may fail if the address is still assigned to another entity, e.g. contact, barn, etc.
Path variables
The customer’s UUID
The address’ UUID
Responses
The request was successfully executed
The request was malformed, e.g. request body was missing
The requester is not logged in
The requester has no access to the customer
The resource wasn’t found
The contact is still assigned and cannot be deleted
Devices are always referenced using a reference uuid. When a device is registered with a customer, a unique ID is generated and should be stored for later interaction with the device. As an alternative the device’s reference uuid can be retrieved from the devices being assigned to a customer.
{customerId}
/devices{customerId}
/devices/{deviceId}
{customerId}
/devices{customerId}
/devices/{deviceId}
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/devicesAuthentication
This endpoint provides a list of all devices registered with the customer and visible to the currently logged in account.
If the body contains a valid DevicesRequest which specifies a query for one or more of the available query attributes, the result will be filtered for only devices matching the given filter criteria.
When withPagination is NOT set or set to true, the actual pagination mechanism will be used, which has additional features. Apart from providing full objects, it also includes features such as sorting. A request with withPagination set to false is deprecated but continues to work for now.
Sortable properties are:
- name
- deviceId
- serialNumber
- serviceId
- externalId
- deviceEui
- deviceType
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
Body
Returns SetOfNamedReferences when withPagination is false, otherwise returns the composite object of PaginatableResponse and the property devices.
Requests with withPagination set to false are deprecated and will be removed in the future.
The request was malformed
Unauthorized | The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/devices/{deviceId}
Authentication
This endpoint retrieves information about the selected device.
Path variables
The customer’s UUID
The device’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The device couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/devicesAuthentication
The endpoint registers a newly set up device with the selected customer.
This call fails, if the logged in account has no access to the given customer reference.
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
Device already registered
The request was malformed, e.g. request body was missing
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/devices/{deviceId}
Authentication
The endpoint removes a previously registered device with the selected customer.
This call fails, if the logged in account has no access to the given customer reference or the device is not registered with the customer.
Path variables
The customer’s UUID
The device’s UUID
Responses
The request was successfully executed
Body
Device already unregistered
The request was malformed, e.g. request body was missing
The requester is not logged in
The requester has no access to the customer
Farms are always referenced using a reference uuid. Farms are registered with an existing customer and provide a top-level element of all entities related with a specific farm.
{customerId}
/farms{customerId}
/farms/{farmId}
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/farmsAuthentication
This endpoint provides a list of all farms associated with the customer and visible to the currently logged in account.
If the body contains a valid FarmsRequest which specifies a query for one or more of the available query attributes, the result will be filtered to only match farms with the given filter criteria.
Path variables
The customer’s UUID
Request parameters
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
Searches only for farms matching the given name pattern.
The metadata property defines if the response contains a metadata object, defining the currently directly jumpable pages, as well as the page cursor values.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
Request body
Responses
The request was successfully executed
Body
The response style depends on the request object given in the request.
If outline is set to true, an array of the actual Farm objects is returned, otherwise a set of _NamedReference_s.
If metadata is set to true, a surrounding object is added, which provides a field data with the resulting objects according to the above rule, and a field metadata, which adds additional page metadata like pagination.
The request was malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/farms/{farmId}
Authentication
This endpoint retrieves a specific farm, selected by the given farm id.
Path variables
The customer’s UUID
The farm’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The farm couldn’t be found
{customerId}
/barns{customerId}
/barns/{barnId}
{customerId}
/barns{customerId}
/barns/{barnId}
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/barnsAuthentication
This endpoint is used request a list of barns avaiable to the given customer.
List calls are implemented as GET HTTP verbs. For that reason, since not all HTTP clients are able to provide a body in a GET request, the BarnsRequest object defined in the body can also be sent as a query parameter.
Query parameters are CBOR packed and BASE64 encoded JSON objects which are sent using the query URL parameter. For simplicity the object can also be sent as a JSON string, but only if the Content-Type header is defined as application/json.
Furthermore, using the outline property set to true, the API will return a list of the matching Barn objects instead of the NamedReferences. This can minimize the number of requests for clients on low throughtput networks (e.g. mobile clients).
Depending on the login type of the account the result may respond with different sets of silos. Feedmills, for example, have all their associated customer’s silos returned, whereas farmers will receive a list of their silos (of all barns) returned. An account with both accssociations (feedmill and farmer) is not supported.
Path variables
The customer’s UUID
Request parameters
The search definition, containing the request body object, if not sent through the request’s body.
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
Request body
Responses
The request was successfully executed
Body
The response style depends on the request object given in the request.
If outline is set to true, data will contain an array of the actual Barn objects is returned, otherwise a set of NamedReferences.
The request was malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/barns/{barnId}
Authentication
This endpoint retrieves a specific barn, selected by the given barn id.
Path variables
The customer’s UUID
The barn’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The barn couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/barnsAuthentication
Creates a new barn, including a potentially provided, new contact and address.
The contact object and the address object can either contain full information (and no reference) to get created automatically, or contain a reference to an existing contact or address to be associated with the newly created barn.
Path variables
The customer’s UUID
Request body
Responses
All items are successfully created.
The request was malformed
Body
The requester is not logged in
The requester has no access to the customer
An unspecified error
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/barns/{barnId}
Authentication
Path variables
The customer’s UUID
The barn’s UUID
Request body
Responses
Update was executed
Request decoding failed
Not logged in
No access to the customer
Resource not found
Unspecific error
{customerId}
/silos{customerId}
/silos/{siloId}
{customerId}
/farms/{farmId}
/barns/{barnId}
/silos{customerId}
/silos/{siloId}
{customerId}
/silos/{siloId}
{customerId}
/silos/{siloId}
/graphs{customerId}
/silos/{siloId}
/suppliers{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/silosAuthentication
This endpoint provides a list of all silos associated with the selected customer and visible to the currently logged in account.
List calls are implemented as GET HTTP verbs. For that reason, since not all HTTP clients are able to provide a body in a GET request, the SilosRequest object defined in the body can also be sent as a query parameter.
Query parameters are CBOR packed and BASE64 encoded JSON objects which are sent using the query URL parameter. For simplicity the object can also be sent as a JSON string, but only if the Content-Type header is defined as application/json.
Furthermore, using the outline property set to true, the API will return a list of the matching Silo objects instead of the NamedReferences. This can minimize the number of requests for clients on low throughtput networks (e.g. mobile clients).
Depending on the login type of the account the result may respond with different sets of silos. Feedmills, for example, have all their associated customer’s silos returned, whereas farmers will receive a list of their silos (of all barns) returned. An account with both accssociations (feedmill and farmer) is not supported.
Path variables
The customer’s UUID
Request parameters
The search definition, containing the request body object, if not sent through the request’s body.
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
Request body
Responses
The request was successfully executed
Body
The response style depends on the request object given in the request.
If outline is set to true, an array of the actual Silo objects is returned, otherwise a set of _NamedReference_s.
If metadata is set to true, a surrounding object is added, which provides a field data with the resulting objects according to the above rule, and a field metadata, which adds additional page metadata like pagination.
Examples
With pagination metadata:
{
"metadata": {
"pagination": {
"numOfPages": 3,
"currentPage": 1,
"pages": [
"tPTZXY3Vq9fpsA5HI9Rd...==",
"PCZfRZvMauZXDVzElvEi...=="
]
}
},
"data": [{
"reference": {
"ref": "48b2170b-0723-433c-be08-c596bad62ef2",
"type": "silo",
"uri": "/api/v1/customers/...customer_id/silos/48b2170b-0723-433c-be08-c596bad62ef2"
},
"parent": {
"ref": "9ff13309-2533-42be-afa5-41c01243176b",
"type": "barn",
"uri": "/api/v1/customers/...customer_id.../barns/9ff13309-2533-42be-afa5-41c01243176b"
},
"name": "Test Silo 1",
"dimension": {
"gap": 250,
"bodyHeight": 4330,
"coneHeight": 1270,
"siloDiameter": 1910,
"exhaustDiameter": 420
},
"content": "Feed Type 1",
"volume": 13.23,
"fillingLevel": 1.82,
"remaining": 0,
"state": "critical",
"bulkDensity": 0.6,
"customer": "Customer 1",
"location": "Example City"
}]
}
Without pagination metadata:
[{
"ref": "0d95d2cb-e553-48b4-8da4-4f76da7bedaf",
"type": "silo",
"uri": "/api/v1/customers/...customer_id.../silos/0d95d2cb-e553-48b4-8da4-4f76da7bedaf",
"name": "Test Silo 1"
}, {
"ref": "2818d0ff-554c-4613-aa9d-4a01ad80c289",
"type": "silo",
"uri": "/api/v1/customers/...customer_id/silos/2818d0ff-554c-4613-aa9d-4a01ad80c289",
"name": "Test Silo 1"
}]
The request was malformed
The requester is not logged in
The requester has no access to the customer
The server has rejected the request as unprocessable.
curl -X GET "https://{environment}.clevabit.com/api/v1/customers/{customerid}/silos?q.outline=true&q.metadata=true&q.limit=100&q.pageCursor=tPTZXY3Vq9fpsA5HI9Rd"
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/silos/{siloId}
Authentication
This endpoint retrieves a specific silo, selected by the given silo id.
Path variables
The customer’s UUID
The silo’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/farms/{farmId}
/barns/{barnId}
/silosAuthentication
Path variables
The customer’s UUID
The farm’s UUID
The barn’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/silos/{siloId}
Authentication
Path variables
The customer’s UUID
The silo’s UUID
Request body
Responses
The request was successfully executed
The silo wasn’t updated
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/silos/{siloId}
Authentication
The endpoint removes a previously created silo with the selected customer and barn.
Path variables
The customer’s UUID
The silo’s UUID
Responses
The request was successfully executed
The request was malformed, e.g. request body was missing
The requester is not logged in
The requester has no access to the customer
The resource wasn’t found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/silos/{siloId}
/graphsAuthentication
This endpoint retrieves the data graph for a specific silo, selected by the given silo id.
Values in the time series are provided in cubic meters (m³).
Path variables
The customer’s UUID
The silo’s UUID
Request body
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/silos/{siloId}
/suppliersAuthentication
This endpoint lists all suppliers assigned to be able to refill a silo.
Path variables
The customer’s UUID
The silo’d UUID
Responses
The request was successfully executed
The request was malformed
The requester is not logged in
The requester has no access to the customer
The server has rejected the request as unprocessable.
{customerId}
/periods{customerId}
/periods/{periodId}
{customerId}
/periods{customerId}
/periods/{periodId}
{customerId}
/period-templates{customerId}
/period-templates/{templateId}
{customerId}
/period-templates{customerId}
/period-templates/{templateId}
{customerId}
/period-templates/{templateId}
{customerId}
/periods/{periodId}
/graphs{customerId}
/periods/{periodId}
/rehouse{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/periodsAuthentication
This endpoint provides a list of all periods associated with the selected barn.
List calls are implemented as GET HTTP verbs. For that reason, since not all HTTP clients are able to provide a body in a GET request, the PeriodsRequest object defined in the body can also be sent as a query parameter.
Query parameters are CBOR packed and BASE64 encoded JSON objects which are sent using the query URL parameter. For simplicity the object can also be sent as a JSON string, but only if the Content-Type header is defined as application/json.
Furthermore, using the outline property set to true, the API will return a list of the matching Period objects instead of the NamedReferences. This can minimize the number of requests for clients on low throughtput networks (e.g. mobile clients).
Path variables
The customer’s UUID
Request parameters
The search definition, containing the request body object, if not sent through the request’s body.
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
Request body
Responses
The request was successfully executed
Body
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/periods/{periodId}
Authentication
This endpoint retrieves a specific barn period, selected by the given period id.
Path variables
The customer’s UUID
The period’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The barn couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/periodsAuthentication
This call creates a new period with options of placing and removing animals from a specific barn bound to the specific time span. A period, for example, can represent a fattening period / run.
Furthermore, a period offers a way to generate graphs and aggregate data tables, based on the devices assigned to the barn, for any measurement taken during the period.
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/periods/{periodId}
Authentication
This call updates a period with options of placing and removing animals from a specific barn bound to the specific time span. A period, for example, can represent a fattening period / run.
Furthermore, a period offers a way to generate graphs and aggregate data tables, based on the devices assigned to the barn, for any measurement taken during the period.
The parent reference cannot be changed from the original value set, when the period was created. A request trying to change the parent reference will be rejected with
Path variables
The customer’s UUID
The period’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
The object was changed in an invalid way.
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/period-templatesAuthentication
This endpoint provides a list of all barn period templates associated with the selected customer.
Path variables
The customer’s UUID
Request body
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
Responses
The request was successfully executed
The request was malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/period-templates/{templateId}
Authentication
This call retrieves an existing period template with information around target values expected for specific value types.
Path variables
The customer’s UUID
The period template’s UUID
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/period-templatesAuthentication
This call creates a new period template with information around target values expected for specific value types.
Path variables
The customer’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/period-templates/{templateId}
Authentication
This call updates an existing period template with information around target values expected for specific value types.
Path variables
The customer’s UUID
The period template’s UUID
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/period-templates/{templateId}
Authentication
This call deletes an existing period template. For this call to finish successfully, the to be deleted period template cannot be assigned to a barn period, no matter if in open or closed state.
Path variables
The customer’s UUID
The period template’s UUID
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/periods/{periodId}
/graphsAuthentication
This endpoint retrieves all graph data of the selected period based on the period’s parent reference.
This call is implemented with the GET HTTP verbs. For that reason, since not all HTTP clients are able to provide a body in a GET request, the PeriodsRequest object defined in the body can also be sent as a query parameter.
Query parameters are CBOR packed and BASE64 encoded JSON objects which are sent using the query URL parameter. For simplicity the object can also be sent as a JSON string, but only if the Content-Type header is defined as application/json.
Path variables
The customer’s UUID
The period’s UUID
Request parameters
The search definition, containing the request body object, if not sent through the request’s body.
Request body
If not defined or an empty array, it defaults to: ["mean", "min", "max"]
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The barn couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/periods/{periodId}
/rehouseAuthentication
This endpoint enables to rehouse animals from one barn to another. In response, additional period entities may be created.
When rehousing, remaining animals in the barn may be split into multiple independent barns, basically creating multiple smaller herds. The accumulated animal number of all targets must, however, be equal to the remaining animals in the barn.
If only one target barn is given, the number of animals, being rehoused to this specific target, can be omitted. It will simply rehouse all remaining animals.
Path variables
The customer’s UUID
The period’s UUID
Request body
The target barn’s UUID
Optional An unsigned integer, representing the number of animals being moved to this target barn. If not present, all animals will be rehoused.
Optional An unix timestamp representing the point in time (in the past) at which the animals were rehoused. If not present, the current point in time is assumed.
Responses
The request was successfully executed
The requester passed in an illegal value, see response message
The requester is not logged in
The requester has no access to the customer
The barn couldn’t be found
{logbookId}
{logbookId}
{logbookId}
{environment}
.app.clevabit.cloud/api/v1/logbooksAuthentication
Lists all matching logbooks according to the requested query parameters.
Request body
Responses
The request was successfully executed
The request was malformed.
Body
The user is not authenticated against the API.
Body
The user is forbidden from accessing the item.
Body
An unspecific error happenend.
Body
{environment}
.app.clevabit.cloud/api/v1/logbooks/{logbookId}
Authentication
This endpoint retrieves a specific logbook, selected by the given logbook id.
Path variables
The logbook’s UUID
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/logbooksAuthentication
Request body
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/logbooks/{logbookId}
Authentication
Updates an existing logbook in the backend. The update operation is not a full incredential operation, but a full update. That means, updating entries needs to send all previous entries with it. Same goes for content and tags elements, there is no merging of previous and current objects, but objects are exchanged completely.
Path variables
The logbook’s uuid
Request body
Responses
The request was successfully executed
The request is malformed or does not conform to the update rules
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/logbooks/{logbookId}
Authentication
Deletes an existing logbook in the backend.
Returns HTTP 200 (OK) with string “ok” if deletion was successful.
Path variables
The logbook’s uuid
Request body
Responses
The request was successfully executed
Body
The request is malformed or does not conform to the update rules
The requester is not logged in
The requester has no access to the customer
{customerId}
/selectlists/{key}
{customerId}
/selectlists/{key}
{customerId}
/selectlists/{key}
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/selectlists/{key}
Authentication
This endpoint retrieves a specific selection list, selected by the given selection list id or its key property.
Path variables
The customer’s UUID
The requested selection list key. This is either the key property (canonical property) or the selection list’s UUID.
Responses
The request was successfully executed
The requester is not logged in
The requester has no access to the customer
The silo couldn’t be found
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/selectlists/{key}
Authentication
Updates a selection list. This operation is implemented as a Copy-On-Write operation for base lists. Base lists are selection lists, which are predefined and not bound to a customer. That means, if a base list is updated for the first time, a copy operation will duplicate this selection list, bind it to the specific customer (executing the operation) and fill it with the provided entries. Further updates on the non-base lists are standard full updates. While this operation is transparent is calling the endpoint with the key instead of the UUID, it is not transparent in the latter case. After the Copy-On-Write operation the returned list has a new reference (UUID) assigned.
Path variables
The customer’s UUID
The requested selection list key. This is either the key property (canonical property) or the selection list’s UUID.
Request body
Responses
The request was successfully executed
The request is malformed or does not conform to the update rules
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/selectlists/{key}
Authentication
Deletes an existing selection list if, and only if, the given key has a customer specific selection list with the given key. Without a customer specific list, the operation will fail.
Returns HTTP 200 (OK) with string “gone” if deletion was successful.
Path variables
The customer’s UUID
The requested selection list key. This is either the key property (canonical property) or the selection list’s UUID.
Request body
Responses
The request was successfully executed
Body
The request is malformed or does not conform to the update rules
The requester is not logged in
The requester has no access to the customer
{customerid}
/feedmill/silos{customerid}
/feedmill/silos/{siloid}
{environment}
.app.clevabit.cloud/api/v1/api/v1/customers/{customerid}
/feedmill/silosAuthentication
Path variables
Request body
A timespan definition of which time range and rollup / granularity to query
A list of one or more metrics to return as a result
Optional filter definition to limit the results to silos matching the filter criteria
Optional logical AND operator. Default: false (which means OR)
Optional filter by silo name
Optional filter by customerName
Optional filter by an array of zero or more client ids
Responses
The request was malformed.
Body
The user is not authenticated against the API.
Body
The user is forbidden from accessing the item.
Body
An unspecific error happenend.
Body
{environment}
.app.clevabit.cloud/api/v1/api/v1/customers/{customerid}
/feedmill/silos/{siloid}
Authentication
Values in the aggregation result may provide a value of -1
. This value is to be interpreted as “out of range” or erroneous.
Path variables
Request body
A timespan definition of which time range and rollup / granularity to query
A list of one or more metrics to return as a result
Responses
The request was malformed.
Body
The user is not authenticated against the API.
Body
The user is forbidden from accessing the item.
Body
An unspecific error happenend.
Body
The Metadata URL endpoints provide information on available value types, predefined intervals or similar.
{customerId}
/metadata/intervals{customerId}
/metadata/valuetypes{customerId}
/metadata/dataseries{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/metadata/intervalsAuthentication
deprecated
The Intervals endpoint provides a set of predefined time ranges, valid to be used in time-frame based queries.
Path variables
The customer’s UUID
Responses
The metadata request was successfully executed
The requester is not logged in
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/metadata/valuetypesAuthentication
The Valuetypes endpoint provides the set of valid value types based on measurements in the customer’s account.
Path variables
The customer’s UUID
Responses
The metadata request was successfully executed
The requester is not logged in
{environment}
.app.clevabit.cloud/api/v1/customers/{customerId}
/metadata/dataseriesAuthentication
The data series endpoint provides a set of available data series. A data series defines a specific measurement like temperature or humidity. If at least one device in the customer’s account had a certain measurement at any point in the time inside the valid data retention time-frame, it will be returned as an available data series, even though no current information may be available.
Path variables
The customer’s UUID
Responses
The metadata request was successfully executed
The requester is not logged in
{metricId}
{metricId}
{environment}
.app.clevabit.cloud/api/v1/metrics/analyticsAuthentication
This endpoint is used to query aggregated metrics. Multiple aggregations can be requested at a time.
Request body
Responses
{environment}
.app.clevabit.cloud/api/v1/metricsAuthentication
Lists all matching user metrics according to the requested query parameters. The query time period available, though, is limited to the last 7 days.
Request body
Responses
The request was successfully executed
The request was malformed.
Body
The user is not authenticated against the API.
Body
The user is forbidden from accessing the item.
Body
An unspecific error happenend.
Body
{environment}
.app.clevabit.cloud/api/v1/metricsAuthentication
Creates a new single user metric to the backend. After transforming the metric to the generalized backend format, the metric will traverse the common calculation pipeline and will be handled exactly as automatically collected metrics.
This can be useful to add metrics like temperature for locations, where no automatic collection of the temperature happens due to lack of hardware, or any other reason.
When pushing a metric, a parent reference must be provided as part of the object body. The authentication token used for the request must have access rights to the object referenced in the parent reference.
Request body
Responses
The request was successfully executed
The request is malformed
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/metrics/{metricId}
Authentication
Updates an existing user metric in the backend. After transforming the metric to the generalized backend format, it will update the previous value, except the data types of the old and new values mismatch.
Updating values has some limitation in what can be updated:
- Only metrics in the last 7 days can be updated
- The value type cannot be changed
- The data type cannot be changed
- The parent cannot be changed
- Tags cannot be updated, exchanged, extended
- Metadata cannot be updated, exchanged, extended
Path variables
The metric’s uuid
Request body
Responses
The request was successfully executed
The request is malformed or does not conform to the update rules
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/metrics/{metricId}
Authentication
Deletes an existing user metric in the backend. Due to the time-series nature of a metric, additional properties (apart from the metricId) need to be provided. For additional information, see body.
Returns HTTP 200 (OK) with string “ok” if deletion was successful.
Path variables
The metric’s uuid
Request body
Responses
The request was successfully executed
Body
The request is malformed or does not conform to the update rules
The requester is not logged in
The requester has no access to the customer
{environment}
.app.clevabit.cloud/api/v1/metrics/analytics/rollupsAuthentication
Request body
Responses
Body
The given start time aligned to the possible rollups
The given end time aligned to the possible rollups
The selected timezone
An array of possible rollup values
The rollup’s key
The rollup in seconds
The Event Subscriber endpoint is used to push updates to partner applications or clients.
MQTT and WebSocket are available as the event source to support mobile and web clients, as well as M2M communication with partner systems.
Values being pushed through the subscription channel are subclasses of PushMessages. Based on the value of messageType the receiver can read the actual data by casting the object to its subclass.
Unknown values of messageType are required to be ignored by the receiving end.
{subscriptionId}
Subscribing to a stream of events requires defining a query according to the Query Language.
To build a query, the following identifiers are defined for events:
Identifier | Expected Datatype(s) | Required | Description |
---|---|---|---|
device | UUID, LIST[UUID], * | true | Predicate to select a single, a list of, or all available devices. |
customer | UUID, LIST[UUID], * | false | Predicate to select a single, a list of, or all available customers. |
value-type | UUID, LIST[UUID], * | false | Predicate to select a single, a list of, or all available value types. |
The device query identifier must be sent with all queries, building the base of the selection algorithm. The basic query can be as simple as: device: *
.
The only exception from this rule is the simple “select all” predicate, which consists of the *-sign (asterisk) only, without any identifier.
{environment}
.app.clevabit.cloud/api/v1/eventsAuthentication
This endpoint subscribes with a specific subscription request. The subscription data push is executed using a subscription MQTT topic. The URL and topic name is returned after a successful subscription.
The MQTT connection can be created using a MQTT socket connection or using a MQTT over WebSocket connection. In both cases the connection base must be a TLS socket (MQTTS or WSS). Furthermore, any connection to the endpoints (MQTT direct or MQTT over WebSocket) must be made using a MQTT client, supporting version 5 of the MQTT protocol. Older versions of the protocol are not supported.
A subscription request can provide an optional timestamp for the last value received with a previous subscription. All updates being produces in the meantime will be pushed right after the connection handshake with the topic.
The maximum duration of the time between now and the provided timestamp is 12 hours (43200 seconds). Requests with longer duration will be cut to the last 12 hours from the current point in time.
MQTT topics expire after 5 minutes with no subscriber being connected to the MQTT server. If the client, however, provided the MQTT persistent_client option while connecting, the client is able to reconnect in case of a lost connection, without the need of resubscribing.
Both subscription types can be explicitly cancelled.
With a successful subscription, depending on the requested subscription type, the result either returns an endpoint URL and a topic name.
The returned endpoint URL may be only valid for this specific subscription and should not be used by other subscriptions or cached.
Push messages are delivered using an at least once delivery algorithm. That means, that the same message may be delivered more than once. Receivers can use the uuid field to filter on already processed messages. With that, however, it is up to the receiving end to make sure that messages are processed only once.
When subscribing to an event stream, a selection query has to be passed in the query member of the transmitted Subscription. The definition of the query syntax is available here.
Request body
Responses
The request was successfully executed
The requester has an access violation in the query
The requester is not logged in
{environment}
.app.clevabit.cloud/api/v1/events/{subscriptionId}
Authentication
This endpoint cancels a previously requested subscription and stops pushing information right away.
Path variables
The subscription’s UUID
Responses
The request was successfully executed
The requester is not logged in
The subscription is not found
The address’ reference
Optional first line of an address
Optional possible second line of an address
Optional local zip code
Optional city
Optional state
Optional country
The id of the aggregation, being unique in the query and the aggregation
The value type for data entry values in this aggregation
The aggregation being executed
The set of aggregated time series
Identifier to uniquely identify response aggregations.
How to generate data series:
- meter: one data series per device
- valuetype: one data series per value type (which aggregates over all devices)
The time span definition for this aggregation request.
An array of aggregations to run.
An array of value types to query.
An array of UUIDs to identify which meters should be queried. Either meters or parents must be set.
An array of Reference objects to identify which meter parents should be queried. The search depth to find devices underneath the parent can be configured using searchDepth. Either meters or parents must be set.
Optional search depth parameter, defining how far to traverse the object graph to find meters underneath the parent references. 0 means only the parent, negative values are not allowed.
Optional array of tag filters to select metrics.
If true user metrics are queried, if false automatically collected (IoT) metrics are queried. Defaults to false.
If true empty time buckets carry the last seen value forward, if false the bucket does not exist. Defaults to false.
Optional canonical path to select a JSON property inside the metrics metadata or inside the value itself, when the metric is of data type JSON.
If true null values are valid values of time buckets, if false null values are filtered and not returned. Defaults to false.
If true the aggregation results include an array with metadata of all metrics that were part of an aggregation operation, if false this does nothing. Defaults to false.
If true the aggregation results include an additional value outside the default time buckets, which represents the time and value of the last metric received. If false this does nothing. Defaults to false.
Optional explicit query timeout to cancel queries after number of seconds. This is only a hint to cancel queries earlier than the backend’s maximum query time. The backend may ignore this value for high amounts of seconds.
The name of the data series
The object’s reference being referred to by this data series
The time-series data
An array of aggregation definitions to be executed by the query engine.
A type representing arbitrary valid Javascript / JSON types.
Encoded Bearer Token (JSON Web Token)
The customer’s reference
If the login is based on a user account, this field represents the reference to the user’s profile data. For non user logins, this field is omitted.
The barn’s reference
The barn’s parent reference
The barn’s name
The barn’s location
The barn’s address
The barn’s main contact reference
True if the returned contact details is the company address, otherwise false.
Optional barn metadata.
Search by name pattern.
Search by parent reference.
Equals
NotEquals
GreaterThan
LessThan
GreaterThanEquals
LessThanEquals
And
Or
Any
Firstname or company name
Optional contact address.
Deprecated version of the new field name. Please update your code to use the new field.
The metric’s id, will be filled by the server before returning the updated object.
The metric’s parent. Can be every valid reference, e.g. a barn reference, a silo reference, a device reference, …
The metric’s value type. Valid value types can be retrieved using the metadata endpoint.
The metric’s value, according to the data type defined by the given value type. Values that don’t match the given value type’s data type are rejected by the server.
The optional metric’s created timestamp, if a specific timestamp should be set. If not available, the current timestamp on the server-side is used for created.
Free form tags to be stored alongside the actual metric and being available for later analytics.
Free form metadata to be stored alongside the actual metric. Metadata can be retrieved together with the metrics later, however, metadata cannot be used as query
The name of the parent element.
Only available when the device represents a multi-sensor device.
Only available when requested with an application oauth token.
If set to false, this disables the pagination and returns all elements in the old reference list style. This functionality is deprecated and will be removed in the future.
The prefix defines the beginning of the resulting data series. The actual generated name will be combined from the given prefix and the name of the requested aggregation. That said, as an example, a prefix set to “temperature-” and an aggregation of type “median” will generate a data series id of “temperature-median” which contains the actual devices and metrics.
Query according to the clevabit Query Specification.
Mixin for all objects that have a pagination request.
The page token for the page to retrieve.
The number of items to retrieve for a single page. If a page token is given, the items per page value of the page token has precedence.
Sorting criteria to sort the result list. If a page token is given, the sorting criteria contained in the token have precendence.
Mixin for all objects that have a pagination / list result.
The pagination information.
The estimated number of available pages.
The current page’s number.
An array of the next few following pages. The array is zero-based and the actual page number must be calculated based on the current page number. The elements in the array are the Page Cursor tokens to jump to the specific page.
Estimated number of pages available.
Page number of the current page.
Page token for the first page. Includes page limit, sorting and other elements.
Zero, one or two of the preceding pages. The number of entries depends on the current position in the pagination. If there is two elements in the array, the order is: [ second-previous, previous ]
The current page token.
Zero, one or two of the following pages. The number of entries depends on the current position in the pagination. If there is two elements in the array, the order is: [ next, second-next ]
The period’s reference. Will be filled by the server on creation before returning the updated object.
The period’s parent reference.
The period’s name.
A value defining the type of period, e.g. ‘fattening_round’ or ‘cleaning_cycle’.
The period’s state.
The period’s start timestamp.
The period’s template id. The template is used to assign daily target values to value types like temperature, humidity, relative weight gain and others.
The period’s end timestamp. If not given when ending the period (state Closed, Cancelled, Abandoned), the current point is set by default.
Additional, free form metadata to be stored alongside the actual period. Metadata is a string-key, any-value object, which can also contain multiple levels.
Optional property for periods that are part of a grow-out round. It represents the day inside the overall grow-out round at which this specific period started.
The template’s uuid. Will be filled by the server on creation before returning the updated object.
The template’s default number of days. This number defines the default cycle length for every period with this template.
The template’s target definitions.
The target’s value type uuid.
The target values.
An optional timespan definition. If omitted or only populated with rollup or slices the actual start time of the period is used. If the period is not yet closed, the current point in time is used as end, otherwise the period’s closing timestamp.
If start and end is defined, start must be before end in time.
A value that defines the time interval in with values are aggregated according to the requested aggregation(s). The value can be represented as a number of seconds or as a string with the following format:
- 5s: number as seconds
- 5m: number as minutes
- 5h: number as hours
- 5d: number as days
If no value is specified or the given value is not available for the selected time range, the backend will take the according default value for the time range into account.
Defaults to a daily rollup if not defined otherwise.
If slices and rollup is defined, slices takes precedence and the value of rollup is ignored.
A value that defines the number of time slices to create. To create the length of a time slice, the backend will divide the defined time range by the given number of slices.
If slices and rollup is defined, slices takes precedence and the value of rollup is ignored.
A value that defines the start of the requested time window. The value can be represented as a UNIX timestamp (UTC) or as a string with the following format:
- (-)5s: number as seconds with represents now - 5 seconds
- (-)5m: number as minutes with represents now - 5 minutes
- (-)5h: number as hours with represents now - 5 hours
- (-)5d: number as days with represents now - 5 days
All values can be combined with a valid date-time string in the style of YYYY-MM-DD HH:mm:ss (time in 24h) or UNIX timestamp.
Combined values look like:
- 2020-03-01 00:00:00 -6h
- 1583020800 -6h
Defaults to the start of the period if not defined otherwise.
A value that defines the end of the requested time window. The value can be represented as a UNIX timestamp (UTC) or as a string with the following format:
- (-)5s: number as seconds with represents now - 5 seconds
- (-)5m: number as minutes with represents now - 5 minutes
- (-)5h: number as hours with represents now - 5 hours
- (-)5d: number as days with represents now - 5 days
All values can be combined with a valid date-time string in the style of YYYY-MM-DD HH:mm:ss (time in 24h) or UNIX timestamp.
Combined values look like:
- 2020-03-01 00:00:00 -6h
- 1583020800 -6h
If end is defined, the timespan is considered a closed timespan. Therefore, if advance is set to true, end has precedence over advance. That means, any value defined for advance is ignored on closed timespans.
Defaults to the current point in time for open periods and the closing day of the period if the period is already closed.
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
A value that defines the start of the requested time window. The value can be represented as a UNIX timestamp (UTC) or as a string with the following format:
- (-)5s: number as seconds with represents now - 5 seconds
- (-)5m: number as minutes with represents now - 5 minutes
- (-)5h: number as hours with represents now - 5 hours
- (-)5d: number as days with represents now - 5 days
All values can be combined with a valid date-time string in the style of YYYY-MM-DD HH:mm:ss (time in 24h) or UNIX timestamp.
Combined values look like:
- 2020-03-01 00:00:00 -6h
- 1583020800 -6h
A value that defines the end of the requested time window. The value can be represented as a UNIX timestamp (UTC) or as a string with the following format:
- (-)5s: number as seconds with represents now - 5 seconds
- (-)5m: number as minutes with represents now - 5 minutes
- (-)5h: number as hours with represents now - 5 hours
- (-)5d: number as days with represents now - 5 days
All values can be combined with a valid date-time string in the style of YYYY-MM-DD HH:mm:ss (time in 24h) or UNIX timestamp.
Combined values look like:
- 2020-03-01 00:00:00 -6h
- 1583020800 -6h
If end is defined, the timespan is considered a closed timespan. Therefore, if advance is set to true, end has precedence over advance. That means, any value defined for advance is ignored on closed timespans.
Defines the dimensions of a rectangular silo.
This value represents the distance (gap) between the upper level of a full silo and the radar sensor in millimeters (mm).
This value represents the height of the silo body, without the cone, in millimeters (mm).
This value represents the height of the silo cone in millimeters (mm).
This value represents the a side of a rectangular silo in millimeters (mm).
This value represents the b side of a rectangular silo in millimeters (mm).
This value represents the c side of a rectangular silo in millimeters (mm).
This value represents the d side of a rectangular silo in millimeters (mm).
The dimension type, which is either round or rectangular.
The silo’s reference.
The silo’s parent reference.
The silo’s name.
The silo’s dimensions and type.
The silo’s dimensions.
The silo’s current content. Free text field.
The silo’s volume in cubic meters.
The silo’s current filling level in cubic meters.
The silo’s estimated remaining runtime, based on the last 7 days of relative usage, in seconds.
The silo’s current state as warning level.
The silo content’s current bulk density in 1/1000’s of a kg/m3.
The silo’s customer name, only available if requested with role feedmill.
The silo’s location, only available if requested with role feedmill.
The silo’s description. This is either a silo specific value or the name of the underlying silo’s template.
Defines the dimensions of a silo.
This value represents the distance (gap) between the upper level of a full silo and the radar sensor in millimeters (mm).
This value represents the height of the silo body, without the cone, in millimeters (mm).
This value represents the height of the silo cone in millimeters (mm).
This value represents the silo diameter in millimeters (mm).
This value represents the cone’s exhaust diameter in millimeters (mm).
The dimension type, which is either round or rectangular.
The outline property defines if the api is supposed to return actual objects or a list of references. If this property is set to true, actual objects are returned.
The metadata property defines if the response contains a metadata object, defining the currently directly jumpable pages, as well as the page cursor values.
The limit property defines the maximum number of elements that will be returned from the call. The value of 0 means return all elements. In this case the server is free to reject the call with an HTTP status 422 (Unprocessable Entity) to request pagination, or set a default limit, in case metadata in the response is requested.
The pageCursor property defines the page to jump to, before applying the limit. If not supplied, the first page is retrieved.
Sorting direction
Sorting column
Unsorted
Ascending Order
Descending Order
The Subscription object represents a successfully executed subscription. To connect to the MQTT broker, either via WebSocket or using a direct MQTT socket, the presented endpoint must be used. This endpoint must not be cached for other subscription, may, however, be reused in case of a sudden disconnect. The reconnect must happen within 15 minutes after disconnection though, otherwise the subscription will expire.
To connect to the MQTT server, the following setup must be used:
MQTT parameter | Value |
---|---|
URL | Subscription::endpoint |
clientId | Subscription::clientId |
password | Valid JWT Token |
qos | 0 or 1 |
It is recommended to connect the client as a persistent_client to make sure that short disconnects keep the subscription alive and prevent missing out on events being delivered.
The pushMessages member may contain messages, that would have since been received using the provided query and the lastTimestamp values of the SubscriptionRequest.
reserved
The name of the tag to query. Required for all operators except AND
and OR
.
The operator to use for the query.
The comparison value. Required for all operators except AND
, OR
and ANY
.
The list of TagComparison
s for the AND
operator.
The list of TagComparison
s for the OR
operator.
The list of elements for the ANY
operator. All elements in the list must be of the same type.
An optional timespan definition. If omitted or only populated with rollup only the last value or the last aggregation, according to the defined rollup value, of each data series will be returned.
If start and end is defined, start must be before end in time.
A value that defines the time interval in with values are aggregated according to the requested aggregation(s). The value can be represented as a number of seconds or as a string with the following format:
- 5s: number as seconds
- 5m: number as minutes
- 5h: number as hours
- 5d: number as days
If no value is specified or the given value is not available for the selected time range, the backend will take the according default value for the time range into account.
If slices and rollup is defined, slices takes precedence and the value of rollup is ignored.
A value that defines the number of time slices to create. To create the length of a time slice, the backend will divide the defined time range by the given number of slices.
If slices and rollup is defined, slices takes precedence and the value of rollup is ignored.
A value that defines the start of the requested time window. The value can be represented as a UNIX timestamp (UTC) or as a string with the following format:
- (-)5s: number as seconds with represents now - 5 seconds
- (-)5m: number as minutes with represents now - 5 minutes
- (-)5h: number as hours with represents now - 5 hours
- (-)5d: number as days with represents now - 5 days
All values can be combined with a valid date-time string in the style of YYYY-MM-DD HH:mm:ss (time in 24h) or UNIX timestamp.
Combined values look like:
- 2020-03-01 00:00:00 -6h
- 1583020800 -6h
A value that defines the end of the requested time window. The value can be represented as a UNIX timestamp (UTC) or as a string with the following format:
- (-)5s: number as seconds with represents now - 5 seconds
- (-)5m: number as minutes with represents now - 5 minutes
- (-)5h: number as hours with represents now - 5 hours
- (-)5d: number as days with represents now - 5 days
All values can be combined with a valid date-time string in the style of YYYY-MM-DD HH:mm:ss (time in 24h) or UNIX timestamp.
Combined values look like:
- 2020-03-01 00:00:00 -6h
- 1583020800 -6h
If end is defined, the timespan is considered a closed timespan. Therefore, if advance is set to true, end has precedence over advance. That means, any value defined for advance is ignored on closed timespans.
An value that defines if the backend will create a websocket push url, to automatically advance and push new metric rollups when they become available.
If end is defined, the timespan is considered a closed timespan. Therefore, if advance is set to true, end has precedence over advance. That means, any value defined for advance is ignored on closed timespans.
Default is false.
UNIX timestamp
UUIDs in CBOR are encoded using as registered CBOR extension Tag 37, which in itself if a combination of CBOR major type 6, the tag’s id (37) and the major type 2 (bytestring), as well as the additional information of 16 (for 16 bytes). Following that header are the 16 actual data bytes representing the UUID.
While UUIDs in CBOR are represented as its own data type, in JSON UUIDs are to be represented as a string according to the RFC 4122 Section 3 specification, as 8-4-4-4-12 hex encoding.
Is the user capability enabled
Human readable name of the user capability
Internal key of the user capability
Name of the enabled variant (for a/b testing)
Optional properties based on the enabled variant
The account’s login email address. The login email can be different from the contact’s email address.
The account’s reference uuid.
Optional account’s contact information.
Optional account picture, which can either be a URL, the base64 encoded image data or omitted / null.
True if at least one user identity has a password based login, otherwise false.
Capabilities or features enabled for the user