Built-in service Acceptor

The `` acceptor`` service is intended for mass storage of objects of different classes.

Available at <server address>/rest/acceptor.

To work with the service, its registration in the application configuration file deploy.json is required. Also the repositories dataRepo and metaRepo must be specified in options for the service. For example:

  "modules": {
    "rest": {
      "globals": {
        "di": {
          "acceptor": {
            "module": "modules/rest/lib/impl/acceptor",
            "options": {
              "dataRepo": "ion://dataRepo",
              "metaRepo": "ion://metaRepo"

Authorization is carried out through all major access types.

The service uses the POSTmethod, objects are passed as an array of objects in JSON format in the request body, with the mandatory indication of the json content Content-Type:application/json in the header. You don’t need to specify auto-generated fields.

In the header in the property ion-converter the name of the converter that should be used when processing data - both the request and the response - can be passed. And the data converter itself must be registered in the options of the service. If no handler is specified, the default handler is used.

The object data must include:

  • _id - the object ID in the key field
  • _class - object class with namespace
  • _classVer - class version

All the rest of the values must correspond to class properties, including data types correspondance. Example:

curl -X POST -u demo@local:ion-demo \
   -H "Content-Type:application/json" \
   -d '[{"_class": "class_string@develop-and-test", "__classVer": null,"id": "10101010-5583-11e6-aef7-cf50314f026b",\
       "string_text": "Example10", "string_miltilinetext": "Example10", "string_formattext": "Example10"}]' \

an example of a request for creating objects to the acceptor service in dnt: test/modules/rest/acceptor.spec.js

/Checking acceptor service/# basicAuth authorization with admin rights, POSTing strings/# result of creation of objects

The method returns the code 200 and an array of stored objects.

    "id": "10101010-5583-11e6-aef7-cf50314f026b",
    "_class": "class_string@develop-and-test",
    "_classVer": "",
    "string_formattext": "Example10",
    "string_miltilinetext": "Example10",
    "string_text": "Example10",
    "_id": "10101010-5583-11e6-aef7-cf50314f026b"

In case of an error, the response code will be 400 , and the response text will contain

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<pre>Bad Request</pre>