Unit API API Reference
API provides access to user data
API Endpoint
https://api.unit.ms
Response Content-Types: application/json
Schemes: https
Version: 1.0.0
Authentication
oauth
Api
Returns current API version
Client MUST keep version of API what is was written for. If minor or major version was updated - client should offer to update it (if new version is available).
Current API version
Response Example (200 OK)
"string"
Method for API testing
Test API calls using this method
Parameter with any value
Response with given value
- foo_is_empty
Response Example (200 OK)
{
"foo": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Announcement
Get last service announcement preview
Method returns short preview of last service announcement
Announcement preview
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"id": "integer",
"title": "string",
"background_color": "string",
"text_color": "string",
"url": "string",
"published_at": "string (date-time)"
}
oauth | basic |
Url
Get information about URL
Returns detailed information about URL, including title, preview image, etc.
target URL
URL info
- url_is_empty
- url_not_valid
- account_deleted
- access_token_is_empty
- access_token_not_valid
- unable_to_load_url
Response Example (200 OK)
{
"id": "integer",
"title": "string",
"url": "string",
"display_url": "string",
"image": {
"id": "integer (int32)",
"url": "string",
"width": "integer (int32)",
"height": "integer (int32)",
"size": "integer (int64)",
"mime_type": "string"
}
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
oauth | basic |
Get archived (gzip) web page
Returns web page by given URL as a single HTML file with inlined resources (css, images), File is packed in gzip. Field id
from response should be used in URLElement.archive_file_id to attach archive to element. Archiving is available currently for html pages only.
target URL
Archive file
- url_is_empty
- url_not_valid
- account_deleted
- access_token_is_empty
- access_token_not_valid
- unable_to_load_url
Response Example (200 OK)
{
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
oauth | basic |
Location
Get venues around given location
Returns array of found venues no further than 200m from given coordinates
latitude
longitude
search query
Venues
- latitude_not_valid
- longitude_not_valid
- query_too_long
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
[
{
"name": "string",
"lat": "number (double)",
"lng": "number (double)",
"address": "string"
}
]
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
User
Create a new user
Creates a new user in terms of Unit API. Before using this method you should create user and at least one credential in Auth API.
Auth credential ID
Lang code. See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
Имя (никнейм)
Timezone, Europe/Moscow. Full list see here https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Country code [ISO 3166] in lower case. See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
Success registration result
- email_not_valid
- lang_not_valid
- name_too_short
- name_too_long
- name_not_valid
- timezone_not_valid
- country_code_not_valid
- email_already_registered
- too_many_requests
Response Example (200 OK)
{
"user": {
"id": "integer",
"name": "string",
"email": "string",
"timezone": "string",
"country_code": "string",
"lang": "string",
"created_at": "string (date-time)",
"updated_at": "string (date-time)",
"is_deleted": "boolean",
"deleted_at": "string (date-time)",
"terminated_at": "string (date-time)",
"is_email_verified": "boolean",
"is_active": "boolean",
"privilege": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
},
"confirmation_hash": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (403 Forbidden)
{
"error": "string"
}
Response Example (429 Too Many Requests)
{
"error": "string"
}
Get user's public profile
Returns user's public profile by username or email. Public profile contains only public information that could be shown for everyone.
username or email
Public profile
- user_not_found
Response Example (200 OK)
{
"id": "integer",
"name": "string",
"privilege": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
Get full user info
Returns full user info about current signed in user
User info
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"id": "integer",
"name": "string",
"email": "string",
"timezone": "string",
"country_code": "string",
"lang": "string",
"created_at": "string (date-time)",
"updated_at": "string (date-time)",
"is_deleted": "boolean",
"deleted_at": "string (date-time)",
"terminated_at": "string (date-time)",
"is_email_verified": "boolean",
"is_active": "boolean",
"privilege": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Delete user account
Marks user account as deactivated and revokes all user sessions. User account will be recovered in next 30 days, after that all data will be physically deleted.
True if success
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
"boolean"
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Log out user
Marks access token as deleted.
Log out result
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
"boolean"
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Recover deleted user
Make user account active again. Account could be recovered during 30 days after deletion.
Recovered successfully.
- account_is_active
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
"boolean"
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Element
Get root Unit
Returns root unit. Method should be used by web client. Other clients MUST fetch it during initial syncronization.
Unit element
- element_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"title": "string",
"elements_order": [
"string"
],
"reminder": "string (date-time)",
"due_date": "string (date)",
"is_important": "boolean",
"color": "string",
"is_active": "boolean",
"tags": [
{
"name": "string"
}
],
"sharing_options": {
"is_public": "boolean",
"recipients": [
{
"username": "string",
"privilege": "string"
}
]
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Get element children
Returns list of children for given guid. Method is publicly available: data will be returned in two cases: if user is authenticated, and he is an owner of the element, or if element or one of its parents is public
Unit GUID
Elements list
- guid_not_valid
- element_not_found
Response Example (200 OK)
[
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
]
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
Get element parents
Returns list of parents for given guid in order from last to first. If user is authenticated, and he is an owner of the requested element - all parents will be returned. If user is NOT authenticated - all parents up to last public element will be returned
Unit GUID
Elements list
- guid_not_valid
- element_not_found
Response Example (200 OK)
[
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
]
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
Get elements
Returns list of elements by filters
Return elements as tree
Filter elements by tag
Elements array
- bad_request
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Save batch of elements
Response will contain array of updated elements with filled guid and usn (or updated for new elements)
Array of elements that should be inserted/updated. Client MUST provide consistent tree for update.
Request Example
[
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
]
Array of updated elements
- bad_request
Element errors Common errors
- guid_not_valid
- guid_is_empty
- usn_is_empty
- element_not_found
- element_type_mismatch
- element_detached
- local_id_duplicated
- child_exists_in_multiple_units
- previous_parent_is_missing
- element_is_missing
- update_on_deleted_element
- element_type_not_valid
- expires_at_is_empty
- trashed_from_is_empty
- element_has_updates
Unit element errors
- title_is_empty
- title_too_long
- system_unit_modification_not_valid
- home_unit_not_found
- trash_unit_not_found
- too_many_elements
- elements_order_has_excess_entries
- elements_order_has_invalid_entries
- color_not_valid
- sharing_privilege_not_valid
- tags_not_valid
- too_many_tags
Toggle element errors
- title_is_empty
- title_too_long
- too_many_elements
- elements_order_has_invalid_entries
Text element errors
- content_is_empty
- content_too_long
- unknown_list_type
- is_checked_attribute_missed
- is_checked_attribute_excess
- unknown_header_type
- list_type_attribute_excess
URL element errors
- url_not_valid
- url_too_long
- url_title_too_long
- image_not_found
Image element errors
- image_not_found
File element errors
- file_not_found
Audio element errors
- audio_not_found
Video element errors
- video_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
- update_required
- elements_quota_reached
Response Example (200 OK)
{
"max_usn": "integer (int32)",
"elements": [
{
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
],
"deleted_elements": [
"string"
]
}
Response Example (400 Bad Request)
{
"error": "string",
"elements": [
{
"guid": "string",
"local_id": "string",
"error": "string"
}
]
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (426 Upgrade Required)
{
"error": "string",
"elements": [
{
"guid": "string",
"local_id": "string",
"error": "string"
}
]
}
Response Example (507 Insufficient Storage)
{
"error": "string"
}
oauth | basic |
Get element
Returns element data. Method is publicly available: element will be returned in two cases: if user is authenticated, and he is an owner of the element, or if element or one of its parents is public
Element GUID
Response Example (200 OK)
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
Append batch of elements
Response will contain array of updated elemets as in /elements
Array of elements to append
Element GUID
Request Example
[
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
]
Array of updated elements
Errors the same as for POST /elements
- account_deleted
- access_token_is_empty
- access_token_not_valid
- unit_not_found
- change_not_consistent
Response Example (200 OK)
{
"max_usn": "integer (int32)",
"elements": [
{
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
],
"deleted_elements": [
"string"
]
}
Response Example (400 Bad Request)
{
"error": "string",
"elements": [
{
"guid": "string",
"local_id": "string",
"error": "string"
}
]
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
Response Example (409 Conflict)
{
"error": "string"
}
oauth | basic |
Delete element
Marks element as deleted
Element GUID
Operation result
- account_deleted
- access_token_is_empty
- access_token_not_valid
- root_unit_deletion_not_allowed
- element_not_found
Response Example (200 OK)
{
"parent": {
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
},
"deleted_elements": [
"string"
]
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (403 Forbidden)
{
"error": "string"
}
Response Example (404 Not Found)
{
"error": "string"
}
oauth | basic |
Upload audio to element
Max file size - 50MB.
Allowed MIME-type:
- audio/mp4
- audio/aac
- audio/mpeg
- audio/m4a
Element GUID
File binary contents
Updated audio element
- file_is_empty
- element_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
- max_file_size_exceeded
- bad_file_type
- quota_reached
Response Example (200 OK)
{
"title": "string",
"artist": "string",
"duration": "integer (int32)",
"file_id": "integer (int32)",
"file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (413 Request Entity Too Large)
{
"error": "string"
}
Response Example (415 Unsupported Media Type)
{
"error": "string"
}
Response Example (507 Insufficient Storage)
{
"error": "string"
}
oauth | basic |
Upload video to element
Max file size - 500MB.
Allowed MIME-type:
- video/3gpp
- video/3gpp2
- video/h261
- video/h263
- video/h264
- video/jpeg
- video/jpm
- video/mj2
- video/mp2t
- video/mp4
- video/mpeg
- video/ogg
- video/quicktime
- video/vnd.dece.hd
- video/vnd.dece.mobile
- video/vnd.dece.pd
- video/vnd.dece.sd
- video/vnd.dece.video
- video/vnd.dvb.file
- video/vnd.fvt
- video/vnd.mpegurl
- video/vnd.ms-playready.media.pyv
- video/vnd.uvvu.mp4
- video/vnd.vivo
- video/webm
- video/x-f4v
- video/x-fli
- video/x-flv
- video/x-m4v
- video/x-matroska
- video/x-mng
- video/x-ms-asf
- video/x-ms-vob
- video/x-ms-wm
- video/x-ms-wmv
- video/x-ms-wmx
- video/x-ms-wvx
- video/x-msvideo
- video/x-sgi-movie
- video/x-smv
Element GUID
File binary contents
Updated video element
- file_is_empty
- element_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
- max_file_size_exceeded
- bad_file_type
- quota_reached
Response Example (200 OK)
{
"title": "string",
"file_id": "integer (int32)",
"file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (413 Request Entity Too Large)
{
"error": "string"
}
Response Example (415 Unsupported Media Type)
{
"error": "string"
}
Response Example (507 Insufficient Storage)
{
"error": "string"
}
oauth | basic |
Upload image to element
Max file size - 50MB.
Allowed MIME-type:
- image/gif
- image/jpeg
- image/png
Element GUID
File binary contents
Updated image element
- file_is_empty
- element_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
- max_file_size_exceeded
- bad_file_type
- quota_reached
Response Example (200 OK)
{
"image_id": "integer (int32)",
"image": {
"id": "integer (int32)",
"url": "string",
"width": "integer (int32)",
"height": "integer (int32)",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (413 Request Entity Too Large)
{
"error": "string"
}
Response Example (415 Unsupported Media Type)
{
"error": "string"
}
Response Example (507 Insufficient Storage)
{
"error": "string"
}
oauth | basic |
Upload file to element
Max file size - 1GB
Element GUID
File binary contents
Updated file element
- file_is_empty
- element_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
- max_file_size_exceeded
- quota_reached
Response Example (200 OK)
{
"title": "string",
"file_id": "integer (int32)",
"file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (413 Request Entity Too Large)
{
"error": "string"
}
Response Example (507 Insufficient Storage)
{
"error": "string"
}
oauth | basic |
Upload url archive to element
Max url archive size - 100MB
Element GUID
URL archive in webarchive format
Updated URL element
- file_is_empty
- element_not_found
- account_deleted
- access_token_is_empty
- access_token_not_valid
- max_file_size_exceeded
- quota_reached
Response Example (200 OK)
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (413 Request Entity Too Large)
{
"error": "string"
}
Response Example (507 Insufficient Storage)
{
"error": "string"
}
oauth | basic |
Search elements
Fulltext search for all kinds of elements
Search results
- query_too_short
- query_too_long
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"matches_total": "integer",
"matches_presented": "integer",
"match_groups": [
{
"type": "string",
"matches_total": "integer",
"matches": [
{
"element": {
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
},
"parent": {
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
}
]
}
]
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Sync
Information about account syncronization state"
API syncrinization is stateless. Each client after sync keeps max USN and could continue syncronization starting from this USN. This method returns current state of account to compare it with client's state.
Account syncronization state
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"current_time": "string (date-time)",
"full_sync_time": "string (date-time)",
"max_usn": "integer (int32)",
"service_usage": {
"storage_used": "number (integer)",
"elements_number": "integer"
}
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Get chunk with data for syncronization
Returns chunk with data for syncronization: created and updated elements and GUID list of deleted objects
USN that was last during previous syncronization. By default after_usn=0
Max num of changes that will be returned. Max value of limit is 100. By default limit=10
Deleted elements will not be returned. Helpful if you just need to fetch all data
List of account changes starting with after_usn. This changes should be applied to local client's DB
- after_usn_not_valid
- limit_not_valid
- account_deleted
- access_token_is_empty
- access_token_not_valid
Response Example (200 OK)
{
"current_time": "string (date-time)",
"chunk_max_usn": "integer (int32)",
"max_usn": "integer (int32)",
"elements": [
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
],
"deleted_elements": [
"string"
]
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
oauth | basic |
Application
Redirect to application
Redirects user to Unit app or shows minimal landing page
Current device couldn't be accepted, just show landing page
Redirect to app
Payment
Register AppStore receipt
Method validates AppStore receipt and if receipt is valid - registers all payments, charged by this receipt
Receipt is valid and registered. User's plan updated successfully.
- receipt_is_empty
- price_is_empty
- price_format_is_invalid
- currency_is_empty
- currency_format_is_invalid
- account_deleted
- access_token_is_empty
- access_token_not_valid
Receipt is invalid.
Response Example (200 OK)
{
"success": "boolean",
"appstore_code": "integer",
"appstore_code_description": "string",
"product_id": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
}
Response Example (400 Bad Request)
{
"error": "string"
}
Response Example (401 Unauthorized)
{
"error": "string"
}
Response Example (402 Payment Required)
{
"success": "boolean",
"appstore_code": "integer",
"appstore_code_description": "string",
"product_id": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
}
oauth | payments_appstore |
Tag
Schema Definitions
User: object
- id: integer
- name: string
- email: string
- timezone: string
- country_code: string
- lang: string
- created_at: string (date-time)
- updated_at: string (date-time)
- is_deleted: boolean
-
Flag that user is deleted
- deleted_at: string (date-time)
-
RFC 3339 full-time. Time when user was deleted. Example: 1988-01-18T01:28:50.52Z
- terminated_at: string (date-time)
-
RFC 3339 full-time. Time when user will be permanently deleted. Example: 1988-01-18T01:28:50.52Z
- is_email_verified: boolean
-
Flag that email is verified
- is_active: boolean
- privilege: PrivilegeLevel
- accounting: Accounting
Example
{
"id": "integer",
"name": "string",
"email": "string",
"timezone": "string",
"country_code": "string",
"lang": "string",
"created_at": "string (date-time)",
"updated_at": "string (date-time)",
"is_deleted": "boolean",
"deleted_at": "string (date-time)",
"terminated_at": "string (date-time)",
"is_email_verified": "boolean",
"is_active": "boolean",
"privilege": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
}
Accounting: object
- storage_limit: number (integer)
-
Total available storage for user in megabytes
- elements_limit: integer
-
Max units number for user
- plan: string , x ∈ { BASIC , PLUS }
-
Account plan
- currency: string
-
Plan price currency
- active_since: string (date-time)
-
RFC 3339 full-time. Time since when plan is active. Example: 1988-01-18T01:28:50.52Z
- active_till: string (date-time)
-
RFC 3339 full-time. Time till when plan is active. Example: 1988-01-18T01:28:50.52Z
- renewal_period_months: integer
-
Plan renewal period
- last_charged_at: string (date-time)
-
RFC 3339 full-time. Time when user was charged last time. Example: 1988-01-18T01:28:50.52Z
- next_charge_at: string (date-time)
-
RFC 3339 full-time. Time when user will be charged next time. Example: 1988-01-18T01:28:50.52Z
Example
{
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
ServiceUsage: object
Service usage statistics. Used to notify user that some limitations is coming.
- storage_used: number (integer)
-
How much storage user already used
- elements_number: integer
-
Number of active elements in user account
Example
{
"storage_used": "number (integer)",
"elements_number": "integer"
}
PublicUserInfo: object
Public info that could be available for everyone
- id: integer
- name: string
- privilege: PrivilegeLevel
Example
{
"id": "integer",
"name": "string",
"privilege": "string"
}
AnnouncementPreview: object
Announcement previews used in popups in mobile app / web to show news and other stuff to user
- id: integer
- title: string
- background_color: string
- text_color: string
- url: string
- published_at: string (date-time)
Example
{
"id": "integer",
"title": "string",
"background_color": "string",
"text_color": "string",
"url": "string",
"published_at": "string (date-time)"
}
RegistrationResult: object
Result of registration operation
- user: User
- confirmation_hash: string
Example
{
"user": {
"id": "integer",
"name": "string",
"email": "string",
"timezone": "string",
"country_code": "string",
"lang": "string",
"created_at": "string (date-time)",
"updated_at": "string (date-time)",
"is_deleted": "boolean",
"deleted_at": "string (date-time)",
"terminated_at": "string (date-time)",
"is_email_verified": "boolean",
"is_active": "boolean",
"privilege": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
},
"confirmation_hash": "string"
}
Image: object
- id: integer (int32)
- url: string
- width: integer (int32)
- height: integer (int32)
- size: integer (int64)
-
File size in bytes
- mime_type: string
Example
{
"id": "integer (int32)",
"url": "string",
"width": "integer (int32)",
"height": "integer (int32)",
"size": "integer (int64)",
"mime_type": "string"
}
File: object
- id: integer (int32)
- url: string
- name: string
-
Original file name
- size: integer (int64)
-
File size in bytes
- mime_type: string
Example
{
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
}
UpdateSequenceNum: integer (int32)
Each data element has an "Update Sequence Number” (USN) that identifies the order in which it was last modified in the account. The USNs within an account start at "1" (for the first object created in the account) and then increase monotonically every time an object is created, modified, or deleted. At any point, the service is capable of ordering the objects in the account using their USN values. To synchronize, a client must only receive the objects that were changed after the last client sync. Besides, USN lets us know that object was updated and notify user about conflicts. If conflict occured client app should answer which version user want to keep.
Example
"integer (int32)"
UpdatedElement: object
Updated element contains guid
, usn
and local_id
if it was given in original request
- guid: Guid
- usn: UpdateSequenceNum
- local_id: string
Example
{
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
Element: object
Abstract element, contains common fields
- type: string
- guid: Guid
- usn: UpdateSequenceNum
- local_id: string
Example
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
TextElement:
Simple text element
- content: string (up to chars)
- list_type: string , x ∈ { BULLETED , NUMERIC , CHECKLIST }
- header_type: string , x ∈ { H1 , H2 , H3 }
- checked: boolean
Example
{
"content": "string",
"list_type": "string",
"header_type": "string",
"checked": "boolean",
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
DividerElement:
Horizontal divider element
Example
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
UnitElement:
Unit element is an element that could contain any other elements
- title: string (up to chars)
- elements_order: object[]
-
Ordered list of elements GUID's
- reminder: string (date-time)
-
RFC 3339 full-time. Client MUST apply timezone before seting up reminder. Example: 1988-01-18T01:28:50.52Z
- due_date: string (date)
-
RFC 3339 full-date that could be considered as unit deadline. Example: 2016-01-18
- is_important: boolean
-
Unit marked as important
- color: string , x ∈ { NONE , RED , ORANGE , YELLOW , GREEN , BLUE , INDIGO , VIOLET }
-
One of predefined colors. NONE means no color.
- is_active: boolean true
-
Unit cound be marked as done. By default - true"
- tags: object[]
-
Tags list. Max tags num per unit is 100
- sharing_options: UnitSharingOptions
Example
{
"title": "string",
"elements_order": [
"string"
],
"reminder": "string (date-time)",
"due_date": "string (date)",
"is_important": "boolean",
"color": "string",
"is_active": "boolean",
"tags": [
{
"name": "string"
}
],
"sharing_options": {
"is_public": "boolean",
"recipients": [
{
"username": "string",
"privilege": "string"
}
]
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
ToggleElement:
Toggle element
- title: string (up to chars)
- elements_order: object[]
-
Ordered list of elements GUID's
Example
{
"title": "string",
"elements_order": [
"string"
],
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
UnitSharingOptions: object
- is_public: boolean
-
If unit is public - it will be accessible for everyone.
- recipients: object[]
-
List of users with which unit is shared. In users accounts will be created LinkedUnit. If list is empty - unit is not shared. Username could be '*', then unit will be shared with everyone who have direct link.
Example
{
"is_public": "boolean",
"recipients": [
{
"username": "string",
"privilege": "string"
}
]
}
ImageElement:
Image element. For performance purposes client should cache locally two images: for landscape and portrait layouts. Source image must be used only for zoom.
- image_id: integer (int32)
- image: Image
Example
{
"image_id": "integer (int32)",
"image": {
"id": "integer (int32)",
"url": "string",
"width": "integer (int32)",
"height": "integer (int32)",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
AudioElement:
Audio element
- title: string (1 to 250 chars)
- artist: string (1 to 250 chars)
- duration: integer (int32)
- file_id: integer (int32)
- file: File
Example
{
"title": "string",
"artist": "string",
"duration": "integer (int32)",
"file_id": "integer (int32)",
"file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
VideoElement:
Example
{
"title": "string",
"file_id": "integer (int32)",
"file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
FileElement:
Example
{
"title": "string",
"file_id": "integer (int32)",
"file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
UrlElement:
URL element. There are two cases for work with this element: 1) application could ask API for preview before sync. This is the best option. 2) application could create this element with one parameter - url, then preview image and header will be added automatically on API side, USN will be updated and app will receive update with image and header during next sync
- url: string
- preview_id: integer (int64)
- preview: UrlPreview
- archive_file_id: integer (int32)
- archive_file: File
Example
{
"url": "string",
"preview_id": "integer (int64)",
"preview": {
"id": "integer",
"title": "string",
"url": "string",
"display_url": "string",
"image": {
"id": "integer (int32)",
"url": "string",
"width": "integer (int32)",
"height": "integer (int32)",
"size": "integer (int64)",
"mime_type": "string"
}
},
"archive_file_id": "integer (int32)",
"archive_file": {
"id": "integer (int32)",
"url": "string",
"name": "string",
"size": "integer (int64)",
"mime_type": "string"
},
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
LocationElement:
Location element
- name: string (up to chars)
- address: string (up to chars)
- lat: number (double) , { x ∈ ℝ | -90 ≤ x ≤ 90 }
- lng: number (double) , { x ∈ ℝ | -180 ≤ x ≤ 180 }
Example
{
"name": "string",
"address": "string",
"lat": "number (double)",
"lng": "number (double)",
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
UrlPreview: object
Information for pretty-printing URLs
- id: integer
- title: string (up to chars)
- url: string
- display_url: string
- image: Image
Example
{
"id": "integer",
"title": "string",
"url": "string",
"display_url": "string",
"image": {
"id": "integer (int32)",
"url": "string",
"width": "integer (int32)",
"height": "integer (int32)",
"size": "integer (int64)",
"mime_type": "string"
}
}
SharingRecipient: object
Sharing recipient
- username: string (1 to 255 chars)
-
User ID: username or email
- privilege: SharedUnitPrivilegeLevel
Example
{
"username": "string",
"privilege": "string"
}
SyncState: object
Account sync state. max_usn contains top USN in user account. After sync client must keep max USN to continue with it on next sync.
- current_time: string (date-time)
-
Current UTC time in RFC 3339 full-time format
- full_sync_time: string (date-time)
-
If last sync was before this date - client must run full sync: remove all local data and read all data from API. By default this date is equals to user registration time and could be changed by service, if happened changes that required full sync (archivation, removing old data, etc.). UTC time in RFC 3339 full-time format
- max_usn: UpdateSequenceNum
- service_usage: ServiceUsage
Example
{
"current_time": "string (date-time)",
"full_sync_time": "string (date-time)",
"max_usn": "integer (int32)",
"service_usage": {
"storage_used": "number (integer)",
"elements_number": "integer"
}
}
SyncChunk: object
List of changes: new elements, deleted elements, etc.
- current_time: string (date-time)
-
Current time in RFC 3339 full-time format
- chunk_max_usn: UpdateSequenceNum
- max_usn: UpdateSequenceNum
- elements: object[]
- deleted_elements: object[]
Example
{
"current_time": "string (date-time)",
"chunk_max_usn": "integer (int32)",
"max_usn": "integer (int32)",
"elements": [
{
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
],
"deleted_elements": [
"string"
]
}
ElementBatchSaveResult: object
Batch save result
- max_usn: UpdateSequenceNum
- elements: object[]
- deleted_elements: object[]
Example
{
"max_usn": "integer (int32)",
"elements": [
{
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
],
"deleted_elements": [
"string"
]
}
ElementBranchDeleteResult: object
Element branch delete result
- parent: UpdatedElement
- deleted_elements: object[]
Example
{
"parent": {
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
},
"deleted_elements": [
"string"
]
}
ErrorElementBatchSave: object
Batch save error
- error: string
-
Error text code, for example "bad_data"
- elements: object[]
Example
{
"error": "string",
"elements": [
{
"guid": "string",
"local_id": "string",
"error": "string"
}
]
}
ElementError: object
- guid: Guid
- local_id: string
-
Element ID on client side if was given in request
- error: string
-
Error text code, for example "element_detached"
Example
{
"guid": "string",
"local_id": "string",
"error": "string"
}
ReceiptRegistrationResult: object
- success: boolean
- appstore_code: integer
-
AppStore validation error code. Empty is success=true
- appstore_code_description: string
-
Error description. Empty is success=true
- product_id: string
-
AppStore product id. Empty is success=false
- accounting: Accounting
Example
{
"success": "boolean",
"appstore_code": "integer",
"appstore_code_description": "string",
"product_id": "string",
"accounting": {
"storage_limit": "number (integer)",
"elements_limit": "integer",
"plan": "string",
"currency": "string",
"active_since": "string (date-time)",
"active_till": "string (date-time)",
"renewal_period_months": "integer",
"last_charged_at": "string (date-time)",
"next_charge_at": "string (date-time)"
}
}
SearchResult: object
- matches_total: integer
- matches_presented: integer
- match_groups: object[]
Example
{
"matches_total": "integer",
"matches_presented": "integer",
"match_groups": [
{
"type": "string",
"matches_total": "integer",
"matches": [
{
"element": {
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
},
"parent": {
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
}
]
}
]
}
SearchMatchGroup: object
- type: string
- matches_total: integer
- matches: object[]
Example
{
"type": "string",
"matches_total": "integer",
"matches": [
{
"element": {
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
},
"parent": {
"type": "string",
"guid": "string",
"usn": "integer (int32)",
"local_id": "string"
}
}
]
}