API
Introduction
The API reference documentation provides detailed information for each of the methods and endpoints of the platform.
The information can be used for reporting, reading collections, and accessing routes on the platform.
We have language bindings in NodeJs, C#, and Python! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Getting Started
For application development please refer developer guide.
Platform Library
Print
This code is used to print logs.
Request (HTTP: GET,POST,PUT,DELETE)
This code is used to prepare requests to external API/Endpoints
Fetch All Sub-domains
This code is used to get all domains on the instance
Check For Top Domain
This code is used to check the .
Encryption
This code is used to encrypt text.
Decryption
This code is used to decrypt text.
Publish Via Emma
This code is used publish message to a topic.
Log message
This code is used to log text.
Get Property
This code is used to get property.
Fetch Global Properties
This code is used to fetch all global properties.
Send Email
This code is used to send email.
Send SMS
This code is used to send SMS.
Run Aggregation
This code is used to run DB Aggregation.
Run User Script
This code is used to run user script.
Check If Edu Collection
This code is used to check if the collection belong to EDU domain.
Sign Token
This code is used to sign and return user token.
Database API
Database API is accessible via the global "ob" object as "ob.db".
getCount = function (collection, query, options, _callback)
findDistinct = function (collection, key, query, options, _callback)
findAndModify = function (collection, query, sort, replacement, options, _callback)
findStream = function (tableName, query, options, _eod, _com)
agg = function (collection, agg, _eod, _com)
create = function (tableName, _data, options, _callback)
createMultiple = function (tableName, _data, options, _callback)
update = function (tableName, query, options, options2, options3, _callback)
updateMany = function (collection, query, options, options2, options3, _callback)
listCollections = function (filter, _callback)
readFile = function (fileId, res, opts)
API Query
Querying DB via HTTP Endpoints is really easy and follows a simple key value pair standard.
Example:
Consider a collection name TASK
It has following fields :
Text Queries
Query on single field
oquery=name=Dave Smith
Query on multiple fields
oquery=name=Dave Smith,amount=0
Starts With Query
oquery=name==Dave Smith
Does Not Starts with Query
oquery=name=!=Dave
Contains Query
oquery=name=*Dave
Does Not Contain Query
oquery=name=!*Dave
Number Queries
Equals Than
oquery=amount===0
Greater Than
oquery=amount=>0
Less Than
oquery=amount=<0
Date Queries
Today
oquery=created_on=today
Yesterday
oquery=created_on=yesterday
Day Before Yesterday
oquery=created_on=daybeforeyesterday
Custom
oquery=created_on=#in2018-07
oquery=created_on=on2018-07-15
Plarform Endpoints
Authentication
To obtain an access token, use this code:
Make sure to replace
Username & Password
with your login credentials.
SOFOS uses API keys to allow access to the API. You can register a new SOFOS API key at our developer portal.
SOFOS expects a security tokem to be included in all API requests to the server in a header that looks like the following:
Authorization: Bearer
This endpoint retrieves all kittens.
HTTP Request
POST http://*.obto.co/auth
Query Parameters
Important
Every collection in SOFOS is accessible via a HTTP API.
Example :
https://*.obto.co/o/recs/?stream=true&project=&oquery=
Fetch API
This endpoint retrieves a data from a specified collection.
HTTP Request
GET https://*.obto.co/o/recs/?stream=true&project=&oquery=
URL Parameters
Post API
This endpoint will create a new record in the collection specified
HTTP Request
POST https://*.obto.co/o/
POST Body
Errors
The SOFOS API uses the following error codes:
Last updated