NAV Navbar
NodeJs Python Java

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

ob.print(<log>)

This code is used to print logs.

Request (HTTP: GET,POST,PUT,DELETE)

ob.request()

This code is used to prepare requests to external API/Endpoints

Fetch All Sub-domains

ob.alldomains(<domain>)

This code is used to get all domains on the instance

Check For Top Domain

ob.isTop(<domain_name>)

This code is used to check the .

Encryption

ob.utils.encrypt(<text>)

This code is used to encrypt text.

Decryption

ob.utils.encrypt(<text>)

This code is used to decrypt text.

Publish Via Emma

ob.emma.publish(<message>)

This code is used publish message to a topic.

Log message

ob.log(<message>)

This code is used to log text.

Get Property

ob.getProperty(<property_name>)

This code is used to get property.

Fetch Global Properties

ob.getGloablProps()

This code is used to fetch all global properties.

Send Email

ob.sendMailv2(<Email object>)

This code is used to send email.

Send SMS

ob.sendSMS(<SMS Object>)

This code is used to send SMS.

Run Aggregation

ob.agg(<message>)

This code is used to run DB Aggregation.

Run User Script

ob.runScript(<user_script>)

This code is used to run user script.

Check If Edu Collection

ob.isEdu(<collection_name>)

This code is used to check if the collection belong to EDU domain.

Sign Token

ob.sign(<message>)

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 :

Fields Type Description
name text
amount number
created_on datetime
manager reference

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 <GENERATED TOKEN>

This endpoint retrieves all kittens.

HTTP Request

POST http://*.obto.co/auth

Query Parameters

Parameter Default Description
user_name NA Your user name which is used to login
password NA Your password which is used to login

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/<collection_name>?stream=true&project=<fields>&oquery=<db query>

URL Parameters

Parameter Value Description
stream true The ID of the kitten to retrieve
projection comma seperate list of fields to show
oquery See API Query Builder

Post API




This endpoint will create a new record in the collection specified

HTTP Request

POST https://*.obto.co/o/<collection_name>

POST Body

Body Description
Json Data Data to be posted

Reports (SOFOS)

Get Fee Defaulters





The above command returns JSON structured like this:


This endpoint retrieves all fee defaulters for a given range.

HTTP Request

GET https://*.obto.co/getfeedefaultersv2.bto

Query Parameters

Parameter Mandatory Description
start_month true Start month of the range.
end_month true End month of the range
fee_head false Tuition Fee

HTTP Response

Get Daily Fee Collection






This endpoint retrieves daily fee collection for a given date range.

HTTP Request

POST https://*.obto.co/getdailyfeecollectionheadwise.bto

URL Parameters

Parameter Mandatory Description
from true Start date.
to true End date
payment_type true Payment type (cash, cheque, card, neft, all)

Get Fee Summary





This endpoint fetches fee summary, monthwise or fee head wise.

HTTP Request

GET https://*.obto.co/feesummary.bto?type=TYPE

URL Parameters

Parameter Description
type month

Get Student Concession






This endpoint retrieves current consession for a student

HTTP Request

POST https://*.obto.co/o/recs/fee_concession?stream=true&

URL Parameters

Parameter Mandatory Description
name.value true Student ID

Get Daily Leave Report






This endpoint fetches all the leave requests for a given date.

HTTP Request

GET https://*.obto.co/o/recs/leave_request?stream=true&oquery=created_on=today

URL Parameters

Parameter Description
ID The ID of the kitten to delete

Get Daily Unique SMS Sent





The above command returns JSON structured like this:


This endpoint deletes a specific kitten.

HTTP Request

GET https://*.obto.co/

URL Parameters

Parameter Description
ID The ID of the kitten to delete

Get Daily Rollbacks





The above command returns JSON structured like this:


This endpoint fetches daily rollbacked reciepts.

HTTP Request

GET https://*.obto.co/

URL Parameters

Parameter Description
ID The ID of the kitten to delete

Get Class Details





The above command returns JSON structured like this:


This endpoint deletes a specific kitten.

HTTP Request

GET https://*.obto.co/classbycategory.bto

URL Parameters

Parameter Description
None Blank

Get Monthly Class Attendance




The above command returns JSON structured like this:


This endpoint deletes a specific kitten.

HTTP Request

GET https://*.obto.co/attendancebyclassbymonth/:class/:start/:end

URL Parameters

Parameter Description
class Class Name
start Start Date
end End Date

Get Student Attendance




The above command returns JSON structured like this:


This endpoint deletes a specific kitten.

HTTP Request

GET https://*.obto.co/o/recs/attendance?stream=true&oquery=created=today

URL Parameters

Parameter Description
class Class Name
start Start Date
end End Date

Get Student Information




The above command returns JSON structured like this:


This endpoint deletes a specific kitten.

HTTP Request

GET https://*.obto.co/o/recs/registration?stream=true&oquery=sequence=

URL Parameters

Parameter Description
sequence Student's Admission No#

Get Teacher Information




The above command returns JSON structured like this:


This endpoint deletes a specific kitten.

HTTP Request

GET https://*.obto.co/o/recs/pltf_user?stream=true&oquery=active=true,roles=*teacher

URL Parameters

Parameter Description
roles Role that needs to be searched

Get Teacher's Attendance





This endpoint fetches Teacher's Attendance.

HTTP Request

GET https://*.obto.co/o/recs/teacher_attendance?stream=true&oquery=created_on=today,name.value=Teacher's User ID

URL Parameters

Parameter Description
name.value User ID
created_on Date

Get Student Grade Book





This endpoint fetches Student grade book for a term.

HTTP Request

GET https://*.obto.co/o/recs/result?stream=true&oquery=session=2018-19,term=halfyear,admission_no=STUDENT ADMISSION NO

URL Parameters

Parameter Description
session Current Session
term halfyear,finalyear
admission_no Student's Admission No#

Important Processes

Errors

The SOFOS API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.