Rest API

Documents

Documents are the JSON arrays of objects and related to NoSQL databases. The document requests allow working with such data, creating a new one, and deleting it:

  1. document/create
  2. document/get
  3. document/update
  4. document/delete

document/create

Request for creating a new document.

Request

It contains token and document object that consists of document data.

Name Type Description
app object application object, which is created
document object object which consists of document data

Example:

token:.nemdoznk_qmb-qmohhs_-uwdhdzrhevjlhbdole

document:{
    "document_name":"my_document",
    "app_id":"3733",
    "item_id":"81906",
    "element_id":43593,
    "data":{...}
}

Response

In return will be data about created document.

{  
   "document_id":507f191e810c19729de860ea,
   "app_id":3733,
   "item_id":81906,
   "document_name":"my_document",
   "element_id":43593,
   "data":{...}
}

Status Code

Name Description
000 invalid JSON
000 missing property (return name of the missing property)
000 user does not have rights to create document
200 Ok document is created

document/get

Request for getting an existing document.

Request

It contains token and document ID.

Name Type Description
token string using for getting access
document_id number unique document ID

Example:

token:zefkp-dxog-wnrdybbmhvnllb_heyffjii.jcmkx

document_id:507f191e810c19729de860ea

Response

As a result, we can see document object.

{
  "document_id":507f191e810c19729de860ea,
  "document_name":"test",
  "app_id":3418,
  "Item_id":"81906",
  "element_id":43593,
  "data": {...},
}

Status Code

Name Description
000 user does not have rights to view document
200 Ok document is received

document/update

Request for updating documents.

Request

It contains token and document object.

Name Type Description
token string using for getting access
document object needed document

Example:

token:zefkp-dxog-wnrdybbmhvnllb_heyffjii.jcmkx


document:{
  "document_id":507f191e810c19729de860ea,
  "document_name":"my_document",
  "app_id":3418,
  "item_id":"81906",
  "element_id":43593,
  "data":{...}
}

Response

In reply will be updated data.

{
  "document_id":507f191e810c19729de860ea,
  "document_name":"test",
  "app_id":3418,
  "item_id":"81906",
  "element_id":43593,
  "data":{...}
}

Status Code

Name Description
000 wrong properties
000 user have no rigts to update document
200 Ok document is updated

document/delete

Request for deleting an existing document.

Request

It contains token and document ID.

Name Type Description
token string using for getting access
document_id number unique document ID

Example:

token:zefkp-dxog-wnrdybbmhvnllb_heyffjii.jcmkx

document_id:507f191e810c19729de860ea

Response

In return will be displayed a success message.

delete document with id=507f191e810c19729de860e

Status Code

Name Description
000 user have no right to delete document
200 Ok document is deleted