Skip to content

Instantly share code, notes, and snippets.

@andysign
Last active February 27, 2023 10:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andysign/d5f546c38eb559510ed1b0c4f8b7992e to your computer and use it in GitHub Desktop.
Save andysign/d5f546c38eb559510ed1b0c4f8b7992e to your computer and use it in GitHub Desktop.
README-diy4u-middleware.md

Table of Contents generated with DocToc

WIZ Middleware Server

This is designed to explain how to use the Wiz Dev Server.

The architecture diagram of this system is presented below. Section 1). represents this group of API endpoints described in this document here. If you want to learn more about the others, see below.

┌─────────────────┐          ┌────────────────────────────────────┐          ┌─────────────────────────────┐
│                 │          │                                    │          │                             │
│ IRIS            │ ───────► │ PrivateMiddleware                  │ ───────► │ RDIUP                       │
│                 │          │                                    │          │                             │
│ DigitalPlatform │ ◄─────── │ WIZ + DC                           │ ◄─────── │ Python                      │
│                 │          │                                    │          │                             │
└─────────────────┘          │ ┌────────────────────────────────┐ │ OR       └─────────────────────────────┘
                             │ │                                │ │ Fallback
 1).                         │ │ Software Middleware w fallback │ │          ┌─────────────────────────────┐
                             │ │                                │ │ ───────► │                             │
                             │ │ PORT: 3000                     │ │          │ MongoDb                     │
                             │ │                                │ │ ◄─────── │                             │
                             │ └────────────────────────────────┘ │          └─────────────────────────────┘
                             │                                    │
────────────────────────     │ ────────────────────────────────── │ ────────────────────────────────────────
                             │                                    │
 2).                         │                                    │
                             │                                    │
┌─────────────────┐          │ ┌────────────────────────────────┐ │          ┌─────────────────────────────┐
│                 │          │ │                                │ │          │                             │
│ IRIS            │ ───────► │ │ Hardware Middleware Prime OLD  │ │          │ Static Backend              │
│                 │          │ │                                │ │ ◄─────── │                             │
│ DigitalPlatform │ ◄─────── │ │ PORT: 3001                     │ │          │ Read-Only Data (expressJs)  │
│                 │          │ │                                │ │          │                             │
└─────────────────┘          │ └────────────────────────────────┘ │          └─────────────────────────────┘
                             │                                    │
 3).                         │                                    │
                             │                                    │
┌─────────────────┐          │ ┌────────────────────────────────┐ │
│                 │          │ │                                │ │          ┌─────────────────────────────┐
│ CODY            │ ───────► │ │ Hardware Middleware (Virtual)  │ │ ───────► │                             │
│                 │          │ │                                │ │          │ MongoDb                     │
│ HardwareBackEnd │ ◄─────── │ │ PORT: 3003                     │ │ ◄─────── │                             │
│                 │          │ │                                │ │          └─────────────────────────────┘
└─────────────────┘          │ └────────────────────────────────┘ │
                             │                                    │
                             └────────────────────────────────────┘

To read the full documentation for all the other sections see below:

For Section 2)., use the link: https://gist.github.com/andysign/a8ad8df9f0f0492f0cd6af38f05c4c82

For Section 3)., use the link: https://gist.github.com/andysign/6d38c10bdfca83a2500ac495ad3c79f7


A. Project Structure And Starting Instructions

This section describes the folder structure and how to start the project.


A.1. Project Structure And Starting Instructions: Folder Structure

The project can be found in:

/c/work/diy4u-db

Note: You can use Power Shell, Command Prompt or Git Bash to access it.


A.2. Project Structure And Starting Instructions: Starting The Project

Check Task Manager and make sure there is no node.exe process running. After that navigate to /c/work/diy4u-db in bash and type:

npm start

B. Remote Connection

Remote connections are also available for uploading or downloading code.


B.1. Remote Connection: FTP Connection

  • Port: 21
  • Username: admin
  • Pwd: crC5mtU9AdQ3JP!

By default all files uploaded trough the ftp will go in:

C:\inetpub\vhosts\trusting-sinoussi.207-244-228-246.plesk.page\httpdocs\

Every static html file uploaded here will be accessible using the link below:

http://207.244.228.246/plesk-site-preview/trusting-sinoussi.207-244-228-246.plesk.page/


B.2. Remote Connection: SSH Connection

No SSH connection!


C. Remote Desktop

The main server can be controlled remotely using the following credentials.


C.1. Remote Desktop: Main Remote Desktop Connection

  • IP: 207.244.228.246
  • Username Administrator
  • Password: crC5mtU9AdQ3JP

C.2. Remote Desktop: Remote Desktop Connection One

  • Username: diy4you1
  • New Password: diy4u!

C.3. Remote Desktop: Remote Desktop Connection Two

  • Username: diy4you2
  • New Password: diy4u!

C.4. Remote Desktop: Remote Desktop Connection Three

  • Username: diy4you3
  • New Password: diy4u!

D. Database

This section should be considered only a draft section, there are no plans to use a db, yet.


D.1. Database: Mongo Db

There is a database system in place but it is still unknown if this system needs more work.

The current MONGODB_URL for the Db is:

mongodb://127.0.0.1:27017/demo-api

E. API Endpoints

All the current endpoints for Ver 0 ( V0 ) are described below.


E.1. API Endpoints: Root

  • Endpoint: /
  • EndpointAlternative: /api/v0/
  • Curl command:
curl -X GET http://207.244.228.246:3000/ ; echo
  • Expected Result:
   { "result": "Demo" }

E.2. API Endpoints: Status

  • Endpoint: /api/v0/status
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/status'; echo
  • Expected Result:
   { "result": "Middleware is up and running" }

E.3. API Endpoints: Post Quiz and Get Hardcoded Formulation Recommendations

  • Method: POST
  • MethodOld (deprecated): GET
  • Endpoint: /api/v0/analytics-ext/consultations-hardcoded
  • Note: This endpoint will try to return up to three random existing formulas, either three liquids or three powders depending on the request data, if there is not connection with the backend, liquids or powders will be returned instead
  • Note: If data is no provided it will default to: quiz_answers: { "61a88fe73298440fa56c95aa": "61a88fe73298440fa56c95a8" }
  • Note: If the answer to the question number three, 61a88fe73298440fa56c95aa ( 02 Liquid or Powder detergent ) is 61a88fe73298440fa56c95a8 ( Liquid ) then render 3 Liquid Formulas with random scores. If else 61a88fe73298440fa56c95a9 ( Powder ) render 3 Powder Formulas.
  • EndpointOld: /api/v0/get-test-formulation
  • If post object not is not provided or EQUAL to {} then default to:
{
   "quiz_answers": { "61a88fe73298440fa56c95aa": "61a88fe73298440fa56c95a8" }
}
  • Curl command OLD (deprecated): curl http://207.244.228.246:3000/api/v0/analytics-ext/consultations-hardcoded

  • Curl command example for LIQUID:

curl -X POST -H "Content-Type: application/json" -d '{"quiz_answers":{"61a88fe73298440fa56c95aa":"61a88fe73298440fa56c95a8"}}' 'http://207.244.228.246:3000/api/v0/analytics-ext/consultations-hardcoded' ; echo
  • Hardcoded Expected Result:
{"error":"NumOfFormulasError | At least 3 liquids & powders needed"}
  • Curl command example for POWDER:
curl -X POST -H "Content-Type: application/json" -d '{"quiz_answers":{"61a88fe73298440fa56c95aa":"61a88fe73298440fa56c95a9"}}' 'http://207.244.228.246:3000/api/v0/analytics-ext/consultations-hardcoded' ; echo
  • Hardcoded Expected Result:
{
"id": "61a78c6356777245b53af5df",
"formula_state": "powder", "formula_type": "detergent",
"owner_id": "600068a50600906ada93a48b",
"quiz_answers": { "61a88fe73298440fa56c95aa": "61a88fe73298440fa56c95a9" },
"customer_id": "60193dfe4e2d91e62bec88ce",
"result": {
   "theoretical_formula": {},
   "basic_formula_id": "60195adb9f50db4f4a5b3782",
   "recommendation": [
      {
      "formula_id": {
         "id": "6319fb0defa4a17bec0fdba4", "name": "Formula test 123",
         "formula_type": "detergent", "formula_state": "powder",
         "adjustment_rules_id": "null", "performance": {},
         "owner_id": "600068a50600906ada93a48b", "is_basic": false,
         "constituents": [ { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.005 },
                           { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.015 }
         ]
      },
      "score": 0.9511501740075896,
      "fablabs": [ "Fablab 14", "Fablab 18", "Fablab 11" ]
      },
      {
      "formula_id": {
         "id": "6225fe9bc97cb252af63a86f", "name": "Do Not remove real F2 POWDER",
         "formula_type": "detergent", "formula_state": "powder",
         "adjustment_rules_id": "1", "performance": {},
         "owner_id": "600068a50600906ada93a48b", "is_basic": true,
         "constituents": [ { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.03 },
                           { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.25 },
                           { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.01 },
                           { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.01 }
         ]
      },
      "score": 0.8176228774336612,
      "fablabs": [ "Fablab 4", "Fablab 9", "Fablab 6" ]
      },
      {
      "formula_id": {
         "id": "6318a1305ec70c1340e42e67", "name": "Do Not remove real F2 POWDER test",
         "formula_type": "detergent", "formula_state": "powder",
         "adjustment_rules_id": null, "performance": {},
         "owner_id": "600068a50600906ada93a48b", "is_basic": false,
         "constituents": [ { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.03 },
                           { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.25 },
                           { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.01 },
                           { "rms_id": "600068a50600906ada93a48b", "weight": 0.01 },
                           { "rms_id": "60054dfd557977e7cef3dedb", "weight": 0.01 }
         ]
      },
      "score": 0.7681342244848045,
      "fablabs": [ "Fablab 13", "Fablab 19", "Fablab 4" ]
      }
   ]
}
}

E.4. API Endpoints: Formulation Relation Endpoints

All the formulation relation endpoints will be described here.


E.4.1. API Endpoints: Get All Formulations

  • Method: GET
  • Endpoint: /api/v0/core/formulas
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/formulas'; echo
  • Expected Result:
   [ {
      "id": "62102ab3b66e03c7f4a08b7a",
      "name": "formula 1", "formula_type": "detergent",
      "formula_state": "powder",
      "adjustment_rules_id": null, "performance": {},
      "owner_id": "600068a50600906ada93a48b",
      "is_basic": false,
      "constituents": [
         {"rms_id": "6001ba15560c106958eaeb79","weight": 0.071},
         {"rms_id": "6001bd60560c106958eaeb7a","weight": 0.017},
         {"rms_id": "6001bd86560c106958eaeb7b","weight": 0.111},
         {"rms_id": "6001bdac560c106958eaeb7c","weight": 0.025},
         {"rms_id": "6001bebb560c106958eaeb7d","weight": 0.089},
         {"rms_id": "60054ccc557977e7cef3ded7","weight": 0.039},
         {"rms_id": "60054d21557977e7cef3ded8","weight": 0.118},
         {"rms_id": "60054d41557977e7cef3ded9","weight": 0.065},
         {"rms_id": "60054d73557977e7cef3deda","weight": 0.067},
         {"rms_id": "60054dfd557977e7cef3dedb","weight": 0.041},
         {"rms_id": "60054e1b557977e7cef3dedc","weight": 0.089},
         {"rms_id": "60054e4f557977e7cef3dedd","weight": 0.126},
         {"rms_id": "60054e7a557977e7cef3dede","weight": 0.018},
         {"rms_id": "60054ebd557977e7cef3dedf","weight": 0.05},
         {"rms_id": "60054f3a557977e7cef3dee0","weight": 0.034},
         {"rms_id": "60054faa557977e7cef3dee1","weight": 0.039}
      ]
   } ]

E.4.2. API Endpoints: Get Formulation By Id

  • Method: GET
  • Endpoint: /api/v0/core/formulas/{ID}
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/formulas/6225ee4825de7568dbe0a893'; echo
  • Expected Result:
   {
      "id": "62102ab3b66e03c7f4a08b7a",
      "name": "formula 1", "formula_type": "detergent",
      "formula_state": "powder",
      "adjustment_rules_id": null, "performance": {},
      "owner_id": "600068a50600906ada93a48b",
      "is_basic": false,
      "constituents": [
         {"rms_id": "6001ba15560c106958eaeb79","weight": 0.071},
         {"rms_id": "6001bd60560c106958eaeb7a","weight": 0.017},
         {"rms_id": "6001bd86560c106958eaeb7b","weight": 0.111},
         {"rms_id": "6001bdac560c106958eaeb7c","weight": 0.025},
         {"rms_id": "6001bebb560c106958eaeb7d","weight": 0.089},
         {"rms_id": "60054ccc557977e7cef3ded7","weight": 0.039},
         {"rms_id": "60054d21557977e7cef3ded8","weight": 0.118},
         {"rms_id": "60054d41557977e7cef3ded9","weight": 0.065},
         {"rms_id": "60054d73557977e7cef3deda","weight": 0.067},
         {"rms_id": "60054dfd557977e7cef3dedb","weight": 0.041},
         {"rms_id": "60054e1b557977e7cef3dedc","weight": 0.089},
         {"rms_id": "60054e4f557977e7cef3dedd","weight": 0.126},
         {"rms_id": "60054e7a557977e7cef3dede","weight": 0.018},
         {"rms_id": "60054ebd557977e7cef3dedf","weight": 0.05},
         {"rms_id": "60054f3a557977e7cef3dee0","weight": 0.034},
         {"rms_id": "60054faa557977e7cef3dee1","weight": 0.039}
      ]
   }

E.4.3. API Endpoints: Post New Formulation

  • Method: POST
  • Endpoint: /api/v0/core/formulas (at least one raw material is required)
  • Curl command:
curl -X POST -H 'Content-Type: application/json' \
-d '{"name":"Test","formula_state":"powder","formula_type":"detergent","constituents":[{"rms_id":"6001ba15560c106958eaeb79","weight":0.5}]}' \
'http://207.244.228.246:3000/api/v0/core/formulas'; echo
  • Expected Result:
   {
      "id":"621100a11795242a8636689f","name":"Test",
      "formula_type":"detergent","formula_state":"powder",
      "adjustment_rules_id":null,"performance":{},
      "owner_id":"600068a50600906ada93a48b","is_basic":false,
      "constituents":[{"rms_id":"6001ba15560c106958eaeb79","weight":0.5}]
   }

E.4.4. API Endpoints: Put An Updated Formulation

  • Method: PUT
  • Endpoint: /api/v0/core/formulas/{ID} (at least one raw material is required)
curl -X PUT -H 'Content-Type: application/json' \
-d '{"id":"621100a11795242a8636689f","name":"TestTWO","formula_state":"powder","adjustment_rules_id":null,"owner_id":"600068a50600906ada93a48b","constituents":[{"rms_id":"6001ba15560c106958eaeb79","weight":1}]}' \
'http://207.244.228.246:3000/api/v0/core/formulas'; echo
  • Expected Result: A simple empty string in the response body

E.4.5. API Endpoints: Delete Formulation

  • Method: DELETE
  • Endpoint: /api/v0/core/formulas/{ID}
  • Curl command:
curl -X DELETE 'http://207.244.228.246:3000/api/v0/core/formulas/621100a11795242a8636689f'; echo
  • Expected Result: A simple empty string in the response body

E.5. API Endpoints: Raw Material Related Endpoints

This section is about all the materials relation endpoints.


E.5.1. API Endpoints: Get All Raw Materials

  • Method: GET
  • Endpoint: /api/v0/core/raw-materials
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/raw-materials'; echo
  • Expected Result:
   [
      { "id":"6001ba15560c106958eaeb79",
         "name":"Bleach", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"6001bd60560c106958eaeb7a",
         "name":"Aesthetic1", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"6001bd86560c106958eaeb7b",
         "name":"Aesthetic2", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"6001bdac560c106958eaeb7c",
         "name":"Citric", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"6001bebb560c106958eaeb7d",
         "name":"Agglo", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054ccc557977e7cef3ded7",
         "name":"Dispersant", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054d21557977e7cef3ded8",
         "name":"Brightener", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054d41557977e7cef3ded9",
         "name":"SudsSupp", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054d73557977e7cef3deda",
         "name":"Carbonate", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054dfd557977e7cef3dedb",
         "name":"PerfPart", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054e1b557977e7cef3dedc",
         "name":"activator", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054e4f557977e7cef3dedd",
         "name":"Nonionic", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054e7a557977e7cef3dede",
         "name":"PerfumeSO1", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054ebd557977e7cef3dedf",
         "name":"PerfumeSO2", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054f3a557977e7cef3dee0",
         "name":"zeolite", "formula_type":"detergent",
         "formula_state":"powder", "calc_method":"parts",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      },
      { "id":"60054faa557977e7cef3dee1",
         "name":"Sulphate", "formula_type":"detergent",
         "formula_state":"powder",
         "calc_method":"balance",
         "uop":"admix", "owner_id":"600068a50600906ada93a48b",
         "external_idx":null, "usage_tag":"other",
         "unit_price":0, "co2_prod":0, "co2_transport":0, "is_suspended":false
      }
   ]

E.5.2. API Endpoints: Get Raw Materials By Id

  • Method: GET
  • Endpoint: /api/v0/core/raw-materials/{ID}
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/raw-materials/6001ba15560c106958eaeb79'; echo
  • Expected Result:
   { "id":"6001ba15560c106958eaeb79",
     "name":"Bleach", "formula_type":"detergent",
     "formula_state":"powder", "calc_method":"parts",
     "uop":"admix", "owner_id":"600068a50600906ada93a48b",
     "external_idx":null, "usage_tag":"other", "unit_price":0,
     "co2_prod":0, "co2_transport":0, "is_suspended":false
   }

E.5.3. API Endpoints: Post New Raw Material

  • Method: POST
  • Endpoint: /api/v0/core/raw-materials
  • Curl command:
curl -X POST -H 'Content-Type: application/json' \
-d '{"name":"Sodium","formula_type":"detergent","formula_state":"powder","calc_method":"parts","uop":"admix","usage_tag":"other","unit_price":0,"co2_prod":0,"co2_transport":0}' \
'http://207.244.228.246:3000/api/v0/core/raw-materials'; echo
  • Expected Result:
   {
      "id": "61f98aec694a8042bf20cb91", "name": "Sodium", "formula_type": "detergent",
      "formula_state": "powder", "calc_method": "parts", "uop": "admix",
      "owner_id": "600068a50600906ada93a48b", "external_idx": null, "usage_tag": "other",
      "unit_price": 0.0, "co2_prod": 0.0, "co2_transport": 0.0, "is_suspended": false
   }

E.5.4. API Endpoints: Put And Updated Raw Material

  • Method: PUT
  • Endpoint: /api/v0/core/raw-materials
  • Curl command:
curl -X PUT -H 'Content-Type: application/json' \
-d '{"id":"621104391795242a863668a2","name":"SODIUM","formula_state":"powder","formula_type":"detergent","calc_method":"parts","owner_id":"600068a50600906ada93a48b","uop":"admix","unit_price":0}' \
'http://207.244.228.246:3000/api/v0/core/raw-materials'; echo
  • Expected Result: A simple empty string in the response body

E.5.5. API Endpoints: Delete Raw Material

  • Method: DELETE
  • Endpoint: /api/v0/core/raw-materials/{ID}
  • Curl command:
curl -X DELETE 'http://207.244.228.246:3000/api/v0/core/raw-materials/621104391795242a863668a2'; echo
  • Expected Result: A simple empty string in the response body

E.6. API Endpoints: Fablabs Related Endpoints

This section is about all the fablab relation endpoints.

E.6.1. API Endpoints: Get All Fablabs

  • Method: GET
  • Endpoint: /api/v0/core/fablabs
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/fablabs'; echo
  • Expected Result:
   [
      { "id":"6086bcf45126499d06598e1f", "name":"Les Mureaux fablab",
      "address": { "country":"Paris", "state":"les Mureaux", "line":"21 Rue Xyz" },
      "rms_stocks": [ { "rms_id":"12ggrs3445", "weight":2.5 } ]
      },
      { "id":"6087cfaa0010bdea1e65cd01", "name":"Les Mureaux fablab",
      "address": { "country":"Paris", "state":"les Mureaux", "line":"21 rue Abc" },
      "rms_stocks": [ { "rms_id":"6087ccdf0010bdea1e65ccfb", "weight":2.5 } ]
      }
   ]

E.6.2. API Endpoints: Get Fablab By Id

  • Method: GET
  • Endpoint: /api/v0/core/fablabs/{ID}
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/fablabs/6086bcf45126499d06598e1f'; echo
  • Expected Result:
   { "id":"6086bcf45126499d06598e1f", "name":"Les Mureaux fablab",
   "address": { "country":"Paris", "state":"les Mureaux", "line":"21 Rue Xyz" },
   "rms_stocks": [ { "rms_id":"12ggrs3445", "weight":2.5 } ] }

E.6.3. API Endpoints: Post New Fablab

  • Method: POST
  • Endpoint: /api/v0/core/fablabs (at least one raw material should be present)
  • Curl command:
curl -X POST -H 'Content-Type: application/json' \
-d '{"name":"Les Mureaux fablab","address":{"country":"Paris","state":"les Mureaux","line":"21 rue Maximilien Robespierre"},"rms_stocks":[{"rms_id":"12ggrs3445","weight": 2.5}]}' \
'http://207.244.228.246:3000/api/v0/core/fablabs'; echo
  • Expected Result:
   { "id": "61f9c08d47bb610cbcb34a84", "name": "Les Mureaux fablab",
      "address": {
         "country": "Paris", "state": "les Mureaux",
         "line": "21 rue Maximilien Robespierre"
      }, "rms_stocks": [ { "rms_id": "12ggrs3445", "weight": 2.5 } ] }

E.6.4. API Endpoints: Put An Updated Fablab

  • Method: PUT
  • Endpoint: /api/v0/core/fablabs (at least one raw material should be present)
  • Curl command:
curl -X PUT -H 'Content-Type: application/json' \
-d '{"id":"61f9c4cb47bb610cbcb34a86","name":"Les Mureaux fablab","address":{"country":"PARIS"},"rms_stocks":[{"rms_id":"12ggrs3445","weight":2.5}]}' \
'http://207.244.228.246:3000/api/v0/core/fablabs'; echo
  • Expected Result: A simple empty string in the response body

E.6.5. API Endpoints: Delete A Fablab

  • Method: DELETE
  • Endpoint: /api/v0/core/fablabs/{ID}
  • Curl command:
curl -X DELETE 'http://207.244.228.246:3000/api/v0/core/fablabs/61f9c4cb47bb610cbcb34a86'; echo
  • Expected Result: A simple empty string in the response body

E.7. API Endpoints: Questions

  • Method: GET
  • Endpoint: /api/v0/core-ext/questions-hardcoded
  • EndpointAlternative: /api/v0/core/questions
  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core-ext/questions-hardcoded'; echo
  • Expected Result:
   [
      {
         "id":"5ff33a28bc205fcf1a56aaf2",
         "title":"01-01 Clean Power",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"g01",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"5ff33a28bc205fcf1a56aaee","title":"Min","description":null,"is_suspended":false},
            {"choice_id":"5ff33a28bc205fcf1a56aaef","title":"MinToBaseline","description":null,"is_suspended":false},
            {"choice_id":"5ff33a28bc205fcf1a56aaf0","title":"BaselineToMax","description":null,"is_suspended":false},
            {"choice_id":"5ff33a28bc205fcf1a56aaf1","title":"Max","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"5ff33a9abc205fcf1a56aaf7",
         "title":"01-02 Ecological",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"g01",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"5ff33a9abc205fcf1a56aaf3","title":"min","description":null,"is_suspended":false},
            {"choice_id":"5ff33a9abc205fcf1a56aaf4","title":"baseline","description":null,"is_suspended":false},
            {"choice_id":"5ff33a9abc205fcf1a56aaf5","title":"baseline 2","description":null,"is_suspended":false},
            {"choice_id":"5ff33a9abc205fcf1a56aaf6","title":"max","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"5ff33af1bc205fcf1a56aafc",
         "title":"01-03 For Sensitive Skin",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"g01",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"5ff33af1bc205fcf1a56aaf8","title":"min","description":null,"is_suspended":false},
            {"choice_id":"5ff33af1bc205fcf1a56aaf9","title":"Baseline","description":null,"is_suspended":false},
            {"choice_id":"5ff33af1bc205fcf1a56aafa","title":"Baseline 2","description":null,"is_suspended":false},
            {"choice_id":"5ff33af1bc205fcf1a56aafb","title":"Max","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"5ff33b5ebc205fcf1a56ab01",
         "title":"01-04 Price",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"g01",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"5ff33b5ebc205fcf1a56aafd","title":"min","description":null,"is_suspended":false},
            {"choice_id":"5ff33b5ebc205fcf1a56aafe","title":"Baseline","description":null,"is_suspended":false},
            {"choice_id":"5ff33b5ebc205fcf1a56aaff","title":"Baseline 2","description":null,"is_suspended":false},
            {"choice_id":"5ff33b5ebc205fcf1a56ab00","title":"max","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a88fe73298440fa56c95aa",
         "title":"02 Liquid or Powder detergent?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a88fe73298440fa56c95a8","title":"Liquid","description":null,"is_suspended":false},
            {"choice_id":"61a88fe73298440fa56c95a9","title":"Powder","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a8919d1c8a1a701762b4c8",
         "title":"03 Do you regularly need to clean tough stains?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 6",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a8919d1c8a1a701762b4c4","title":"Rarely/never","description":null,"is_suspended":false},
            {"choice_id":"61a8919d1c8a1a701762b4c5","title":"Ocassionally","description":null,"is_suspended":false},
            {"choice_id":"61a8919d1c8a1a701762b4c6","title":"Frequently","description":null,"is_suspended":false},
            {"choice_id":"61a8919d1c8a1a701762b4c7","title":"All the time","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a891e41c8a1a701762b4cb",
         "title":"04 Do you experience stains that you find difficult to remove with your current detergent?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 7",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a891e41c8a1a701762b4c9","title":"Yes","description":null,"is_suspended":false},
            {"choice_id":"61a891e41c8a1a701762b4ca","title":"No","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a892283298440fa56c95b0",
         "title":"05 Do you experience stains that you find difficult to remove with your current detergent? If so, please select below:",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 8",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a892283298440fa56c95ab","title":"Grass","description":null,"is_suspended":false},
            {"choice_id":"61a892283298440fa56c95ac","title":"Grease","description":null,"is_suspended":false},
            {"choice_id":"61a892283298440fa56c95ad","title":"Mud","description":null,"is_suspended":false},
            {"choice_id":"61a892283298440fa56c95ae","title":"Make-up","description":null,"is_suspended":false},
            {"choice_id":"61a892283298440fa56c95af","title":"Coloured food","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a8925a3298440fa56c95b5",
         "title":"06 What type of fabric will you wash most with this detergent?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 9",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a8925a3298440fa56c95b1","title":"Whites","description":null,"is_suspended":false},
            {"choice_id":"61a8925a3298440fa56c95b2","title":"Darks","description":null,"is_suspended":false},
            {"choice_id":"61a8925a3298440fa56c95b3","title":"Colours","description":null,"is_suspended":false},
            {"choice_id":"61a8925a3298440fa56c95b4","title":"Delicate wool","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a892993298440fa56c95bb",
         "title":"07 Do you experience fabric care issues with your current detergent?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 10",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a892993298440fa56c95b6","title":"Fading","description":null,"is_suspended":false},
            {"choice_id":"61a892993298440fa56c95b7","title":"Harsh feel","description":null,"is_suspended":false},
            {"choice_id":"61a892993298440fa56c95b8","title":"Pilling","description":null,"is_suspended":false},
            {"choice_id":"61a892993298440fa56c95b9","title":"Shrinking","description":null,"is_suspended":false},
            {"choice_id":"61a892993298440fa56c95ba","title":"Others","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a892c21c8a1a701762b4cf",
         "title":"08 How will you wash laundry with this detergent?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 11",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a892c21c8a1a701762b4cc","title":"Frontload","description":null,"is_suspended":false},
            {"choice_id":"61a892c21c8a1a701762b4cd","title":"Top load","description":null,"is_suspended":false},
            {"choice_id":"61a892c21c8a1a701762b4ce","title":"Hand Wash","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a892ec1c8a1a701762b4d3",
         "title":"09 How do you dry your clothes?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 12",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a892ec1c8a1a701762b4d0","title":"Tumble Dryer","description":null,"is_suspended":false},
            {"choice_id":"61a892ec1c8a1a701762b4d1","title":"Indoor line","description":null,"is_suspended":false},
            {"choice_id":"61a892ec1c8a1a701762b4d2","title":"Outdoor line","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a8930e3298440fa56c95be",
         "title":"10 Do you or anyone in your household have a sensitive skin?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 13",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a8930e3298440fa56c95bc","title":"Yes","description":null,"is_suspended":false},
            {"choice_id":"61a8930e3298440fa56c95bd","title":"No","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a8938d1c8a1a701762b4de",
         "title":"11 What type of scent do you prefer on your laundry? Choose up to 2 scents",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 14",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a8938d1c8a1a701762b4d4","title":"Lavender","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4d5","title":"Camomile","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4d6","title":"Geranium Blossom","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4d7","title":"Vanilla","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4d8","title":"Peony","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4d9","title":"Orchid","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4da","title":"Yellow poppy","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4db","title":"Alpine fresh","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4dc","title":"Flower power","description":null,"is_suspended":false},
            {"choice_id":"61a8938d1c8a1a701762b4dd","title":"Free of fragance","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a893d91c8a1a701762b4e5",
         "title":"12 How much scent do you like on your laundry?",
         "formula_state":"both",
         "formula_type":"detergent",
         "tag":"tag 15",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a893d91c8a1a701762b4e0","title":"None","description":null,"is_suspended":false},
            {"choice_id":"61a893d91c8a1a701762b4e1","title":"Some","description":null,"is_suspended":false},
            {"choice_id":"61a893d91c8a1a701762b4e2","title":"Average","description":null,"is_suspended":false},
            {"choice_id":"61a893d91c8a1a701762b4e3","title":"Lots","description":null,"is_suspended":false},
            {"choice_id":"61a893d91c8a1a701762b4e4","title":"All I can get!","description":null,"is_suspended":false}
         ]
      },
      {
         "id":"61a8942d3298440fa56c95c9",
         "title":"13 What colour do you like for your detergent? (liquid only)",
         "formula_state":"liquid",
         "formula_type":"detergent",
         "tag":"tag 15",
         "owner_id":"600068a50600906ada93a48b",
         "description":null,
         "is_suspended":false,
         "choices":[
            {"choice_id":"61a8942d3298440fa56c95bf","title":"Red","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c0","title":"Orange","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c1","title":"Light orange","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c2","title":"Green","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c3","title":"Aqua","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c4","title":"Yellow","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c5","title":"Fuchsia","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c6","title":"Orchid","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c7","title":"Violet","description":null,"is_suspended":false},
            {"choice_id":"61a8942d3298440fa56c95c8","title":"Blue","description":null,"is_suspended":false}
         ]
      }
   ]
  • Hardcoded Result Summary (all hardcoded IDs):
    5ff33a28bc205fcf1a56aaf2 5ff33a9abc205fcf1a56aaf7, 5ff33af1bc205fcf1a56aafc, 5ff33b5ebc205fcf1a56ab01, 61a88fe73298440fa56c95aa, 61a8919d1c8a1a701762b4c8, 61a891e41c8a1a701762b4cb, 61a892283298440fa56c95b0, 61a8925a3298440fa56c95b5, 61a892993298440fa56c95bb, 61a892c21c8a1a701762b4cf, 61a892ec1c8a1a701762b4d3, 61a8930e3298440fa56c95be, 61a8938d1c8a1a701762b4de, 61a893d91c8a1a701762b4e5, 61a8942d3298440fa56c95c9

E.8. API Endpoints: Fallback Functions

There is a small chance the Python backend might be down or respond slower than normal. In that respect the idea is to have a set of default hardcoded response JSON objects for all the major API endpoints. Those objects are already implemented as separate json files and can be found in the ./src/services/json: consultations-hardcoded-post.json, questions-hardcoded-get.json, fablabs-get.json, raw-materials-get.json, formulas-get.json etc.

By default the middleware will not provide any fallback when the Python is down.

Switch ON the fallback system with:

E.8.0. API Endpoints: Fallback Functions Switch ON or OFF and Defaults

  • Method: POST ( ON )
  • Endpoint: /api/v0/timeout
  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"timeout":1}' 'http://207.244.228.246:3000/api/v0/timeout'; echo
  • OR Method: POST ( OFF )
  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"timeout":300000}' 'http://207.244.228.246:3000/api/v0/timeout'; echo

Note: you can check the current timeout delay in ms with (default is 300000): curl 'http://207.244.228.246:3000/api/v0/timeout'; echo

Finally, to manage your fallback JSONs use the following:

  • Method: POST / GET ( Submit / Retrieve FablabsJsonObjects )
  • Endpoint: /api/v0/fallback/fablabs
  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"objects":[]}' http://207.244.228.246:3000/api/v0/fallback/fablabs; echo
  • OR Method: POST / GET ( Submit / Retrieve FormulasJsonObjects )
  • Endpoint: /api/v0/fallback/formulas
  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"objects":[]}' http://207.244.228.246:3000/api/v0/fallback/formulas; echo
  • OR Method: POST / GET ( Submit / Retrieve QuestionsJsonObjects )
  • Endpoint: /api/v0/fallback/questions-hardcoded
  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"objects":[]}' http://207.244.228.246:3000/api/v0/fallback/questions-hardcoded; echo
  • Method: POST / GET ( Submit / Retrieve MaterialsJsonObjects )
  • Endpoint: /api/v0/fallback/raw-materials
  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"objects":[]}' http://207.244.228.246:3000/api/v0/fallback/raw-materials; echo

E.8.1. API Endpoints: Fallback Functions Response From Get All Formulations or Single Formulation

  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/formulas'; echo # OR ../:id
  • Expected Result:
[
{ "id": "6225ee4825de7568dbe0a893",
   "name": "Do Not remove real F1 LIQUID",
   "formula_type": "detergent",
   "formula_state": "liquid",
   "adjustment_rules_id": "not-exists",
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 0.4 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.02 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 0.02 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.02 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.1 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.02 },
      { "rms_id": "6225ea3e25de7568dbe0a892", "weight": 0.42 }
   ]
},
{ "id": "6225fe9bc97cb252af63a86f",
   "name": "Do Not remove real F2 POWDER",
   "formula_type": "detergent",
   "formula_state": "powder",
   "adjustment_rules_id": "1",
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": true,
   "constituents": [
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.03 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.25 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.01 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.01 }
   ]
},
{ "id": "622f2a3e1bd535a1162f5248",
   "name": "new formula name",
   "formula_type": "detergent",
   "formula_state": "powder",
   "adjustment_rules_id": "null",
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.019 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 0.97 }
   ]
},
{ "id": "62334c474c9e76fab9df3862",
   "name": "formula david borrar",
   "formula_type": "detergent",
   "formula_state": "liquid",
   "adjustment_rules_id": "null",
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [{ "rms_id": "60054e1b557977e7cef3dedc", "weight": 0.012 }]
},
{ "id": "626a51890f3b26571430099e",
   "name": "Do Not remove real F2 POWDER test",
   "formula_type": "detergent",
   "formula_state": "powder",
   "adjustment_rules_id": "null",
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.03 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.25 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.01 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.01 }
   ]
},
{ "id": "627009de445f389a7ee12bdd",
   "name": "new formula name new",
   "formula_type": "detergent",
   "formula_state": "liquid",
   "adjustment_rules_id": null,
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [{ "rms_id": "6001ba15560c106958eaeb79", "weight": 0.1 }]
},
{ "id": "62791003670a9e2c72458188",
   "name": "Do Not remove real F2 POWDER test",
   "formula_type": "detergent",
   "formula_state": "powder",
   "adjustment_rules_id": null,
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.03 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.25 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.01 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.01 }
   ]
},
{ "id": "62793da574ddf8ff17aa6acb",
   "name": "Do Not remove real F2 POWDER test",
   "formula_type": "detergent",
   "formula_state": "powder",
   "adjustment_rules_id": null,
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.03 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.25 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.01 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.01 }
   ]
},
{ "id": "627b62352f68ad2e7c837ede",
   "name": "s",
   "formula_type": "detergent",
   "formula_state": "liquid",
   "adjustment_rules_id": null,
   "performance": {},
   "owner_id": "600068a50600906ada93a48b",
   "is_basic": false,
   "constituents": [{ "rms_id": "6001ba15560c106958eaeb79", "weight": 1 }]
}
]

E.8.2. API Endpoints: Fallback Functions Response From Get All Raw Materials or Single Raw Material

  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/raw-materials'; echo # OR ../:id
  • Expected Result:
[
{ "id": "6001ba15560c106958eaeb79", "name": "Bleach",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6001bd60560c106958eaeb7a", "name": "Aesthetic1",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": true
},
{ "id": "6001bd86560c106958eaeb7b", "name": "Aesthetic2",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6001bdac560c106958eaeb7c", "name": "citric",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6001bebb560c106958eaeb7d", "name": "Agglo",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054ccc557977e7cef3ded7", "name": "dispersant",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054d21557977e7cef3ded8", "name": "brightener",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054d41557977e7cef3ded9", "name": "sudssupp",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054d73557977e7cef3deda", "name": "carbonate",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054dfd557977e7cef3dedb", "name": "PerfPart",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054e1b557977e7cef3dedc", "name": "activator",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054e7a557977e7cef3dede", "name": "perfumeso1",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054ebd557977e7cef3dedf", "name": "perfumeso2",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "60054f3a557977e7cef3dee0", "name": "zeolite",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": true
},
{ "id": "60054faa557977e7cef3dee1", "name": "Sulphate",
   "formula_type": "detergent", "formula_state": "powder",
   "calc_method": "balance",
   "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6225e33f25de7568dbe0a88d", "name": "surfactant",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6225e37d25de7568dbe0a88e", "name": "fatty acid",
   "formula_type": "detergent", "formula_state": "liquid",
   "calc_method": "parts",
   "uop": "sprayon",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6225e3b125de7568dbe0a88f", "name": "nonionic surfactant",
   "formula_type": "detergent", "formula_state": "both",
   "calc_method": "parts",
   "uop": "sprayon",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6225e9b725de7568dbe0a890", "name": "color care additive",
   "formula_type": "detergent", "formula_state": "liquid",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6225e9de25de7568dbe0a891", "name": "dye 1",
   "formula_type": "detergent", "formula_state": "liquid",
   "calc_method": "balance",
   "uop": "sprayon",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
},
{ "id": "6225ea06903c944087d3b12d", "name": "dye 2",
   "formula_type": "detergent", "formula_state": "liquid",
   "calc_method": "parts", "uop": "admix",
   "owner_id": "600068a50600906ada93a48b", "external_idx": null,
   "usage_tag": "other", "unit_price": 0,
   "co2_prod": 0, "co2_transport": 0,
   "is_suspended": false
}
]

E.8.3. API Endpoints: Fallback Functions Response From Get All Fablabs or Single Fablab

  • Curl command:
curl -X GET 'http://207.244.228.246:3000/api/v0/core/fablabs'; echo # OR ../:id
  • Expected Result:
[
{ "id": "620e67b543e3567141654995",
   "name": "Fablab 1",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 0.06 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.14 }
   ]
},
{ "id": "620e680ef3cea4a115c97e5d",
   "name": "Demo fablab 555",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001ba15560c106958eaeb79", "weight": 0 }]
},
{ "id": "62139731a64a8f4aca7524b3",
   "name": "Demo fablab2",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001ba15560c106958eaeb79", "weight": 0 }]
},
{ "id": "621631cf1587b277a289a0ad",
   "name": "dasds",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.01 }]
},
{ "id": "62163279863298cd4b8ca5a9",
   "name": "otro fablab david",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.01 }]
},
{ "id": "621634761587b277a289a0ae",
   "name": "ssddsd",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.01 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 0.01 }
   ]
},
{ "id": "6220d897ad28715e8be5c8d0",
   "name": "Andoni",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 2000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.26 }
   ]
},
{ "id": "6225c841903c944087d3b12a",
   "name": "ssssssssssss",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.01 }]
},
{ "id": "6225cbc3903c944087d3b12b",
   "name": "fabla1",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 }]
},
{ "id": "622f28cb1bd535a1162f5247",
   "name": "prueba",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001bd60560c106958eaeb7a", "weight": 8.999 }]
},
{ "id": "6230b5a1801cae11bcb5e505",
   "name": "fablab test david",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 }]
},
{ "id": "6230b84a801cae11bcb5e506",
   "name": "fablab david 33",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 }]
},
{ "id": "6258007e756cd17861683a31",
   "name": "My fablab",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 197.44966775394107 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 200 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 300 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 300 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 200 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 77.91457524826092 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 199.9959194684063 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 200 }
   ]
},
{ "id": "625e96b67820a4d82d757a45",
   "name": "example fablab david local",
   "address": { "country": "" },
   "rms_stocks": [{ "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.999 }]
},
{ "id": "626654f9434aa89cfc482748",
   "name": "Fablab test 4",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 }
   ]
},
{ "id": "62665a3042d5d242a3ed4787",
   "name": "Fablab test 3",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 23 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 }
   ]
},
{ "id": "62665a7642d5d242a3ed4788",
   "name": "Fablab test 3",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 }
   ]
},
{ "id": "6266a06ab70bc3bcf32bdd04",
   "name": "Fablab test",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 }
   ]
},
{ "id": "6266b51eb70bc3bcf32bdd05",
   "name": "Fablab test",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 22 }
   ]
},
{ "id": "6268ef38cfa9bf2a33e9e593",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 20 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 20 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 20 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 20 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 20 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 20 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 20 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 20 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 20 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 20 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 20 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 20 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 20 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 20 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 20 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 20 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 20 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 20 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 }
   ]
},
{ "id": "626920e7f4d71b2412f77872",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 20 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 20 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 20 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 20 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 20 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 20 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 20 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 20 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 20 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 20 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 20 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 20 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 20 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 20 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 20 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 20 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 20 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 20 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 }
   ]
},
{ "id": "626920e8f4d71b2412f77873",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 20 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 20 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 20 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 20 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 20 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 20 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 20 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 20 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 20 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 20 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 20 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 20 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 20 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 20 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 20 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 20 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 20 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 20 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 }
   ]
},
{ "id": "626920e9199e2b2a5365e61f",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 20 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 20 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 20 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 20 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 20 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 20 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 20 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 20 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 20 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 20 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 20 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 20 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 20 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 20 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 20 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 20 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 20 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 20 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 20 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 20 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 20 }
   ]
},
{ "id": "626933bb199e2b2a5365e638",
   "name": "fablab 1",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 0.001 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 0.001 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 0.001 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 0.001 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 0.001 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 0.001 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 0.001 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 0.001 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 0.001 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 0.001 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 }
   ]
},
{ "id": "62694f85f4d71b2412f7789a",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 1000 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 1000 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 1000 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 1000 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 1000 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 1000 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 1000 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 1000 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 1000 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 1000 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 1000 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 1000 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 }
   ]
},
{ "id": "626950aa199e2b2a5365e653",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 1000 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 1000 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 1000 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 1000 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 1000 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 1000 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 1000 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 1000 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 1000 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 1000 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 1000 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 1000 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 }
   ]
},
{ "id": "626950ad199e2b2a5365e656",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 },
      { "rms_id": "60054dfd557977e7cef3dedb", "weight": 1000 },
      { "rms_id": "60054e1b557977e7cef3dedc", "weight": 1000 },
      { "rms_id": "60054e7a557977e7cef3dede", "weight": 1000 },
      { "rms_id": "60054ebd557977e7cef3dedf", "weight": 1000 },
      { "rms_id": "60054f3a557977e7cef3dee0", "weight": 1000 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 1000 },
      { "rms_id": "6225e33f25de7568dbe0a88d", "weight": 1000 },
      { "rms_id": "6225e37d25de7568dbe0a88e", "weight": 1000 },
      { "rms_id": "6225e3b125de7568dbe0a88f", "weight": 1000 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 1000 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 1000 },
      { "rms_id": "6225ea06903c944087d3b12d", "weight": 1000 },
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 }
   ]
},
{ "id": "626953acf4d71b2412f778ae",
   "name": "fablab 1",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "60054faa557977e7cef3dee1", "weight": 0.001 },
      { "rms_id": "6225e9de25de7568dbe0a891", "weight": 0.001 },
      { "rms_id": "6225e9b725de7568dbe0a890", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 }
   ]
},
{ "id": "626a5cc40f3b2657143009ad",
   "name": "dasdsds",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 0.001 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 0.001 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 0.001 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 0.001 }
   ]
},
{ "id": "62792302a22f6705324d0540",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 }
   ]
},
{ "id": "62792303a22f6705324d0541",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 }
   ]
},
{ "id": "62792304a22f6705324d0543",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 }
   ]
},
{ "id": "62792fa2a71500e35f34bf03",
   "name": "fablab-for-testing",
   "address": { "country": "" },
   "rms_stocks": [
      { "rms_id": "6001ba15560c106958eaeb79", "weight": 1000 },
      { "rms_id": "6001bd60560c106958eaeb7a", "weight": 1000 },
      { "rms_id": "6001bd86560c106958eaeb7b", "weight": 1000 },
      { "rms_id": "6001bdac560c106958eaeb7c", "weight": 1000 },
      { "rms_id": "6001bebb560c106958eaeb7d", "weight": 1000 },
      { "rms_id": "60054ccc557977e7cef3ded7", "weight": 1000 },
      { "rms_id": "60054d21557977e7cef3ded8", "weight": 1000 },
      { "rms_id": "60054d41557977e7cef3ded9", "weight": 1000 },
      { "rms_id": "60054d73557977e7cef3deda", "weight": 1000 }
   ]
}
]

E.8.4. API Endpoints: Fallback Functions Response From Post Quiz and Get Hardcoded Formulation Recommendations or Get Recommendations

  • Curl command:
curl -X POST -H "Content-Type: application/json" -d '{"quiz_answers":{"61a88fe73298440fa56c95aa":"61a88fe73298440fa56c95a8"}}' 'http://207.244.228.246:3000/api/v0/analytics-ext/consultations-hardcoded' ; echo # OR powder OR use GET
  • Expected Result:
{
"id": "61a78c6356777245b53af5df",
"formula_state": "liquid",
"formula_type": "detergent",
"owner_id": "600068a50600906ada93a48b",
"quiz_answers": { "61a88fe73298440fa56c95aa": "61a88fe73298440fa56c95a8" },
"customer_id": "60193dfe4e2d91e62bec88ce",
"result": {
   "theoretical_formula": {},
   "basic_formula_id": "60195adb9f50db4f4a5b3782",
   "recommendation": [
      {
      "formula_id": "6225ee4825de7568dbe0a893",
      "score": 0.9491840724026354,
      "fablabs": ["Fablab 14", "Fablab 18", "Fablab 11"]
      },
      {
      "formula_id": "62334c474c9e76fab9df3862",
      "score": 0.8386254126608259,
      "fablabs": ["Fablab 4", "Fablab 9", "Fablab 6"]
      },
      {
      "formula_id": "627009de445f389a7ee12bdd",
      "score": 0.7190428517626353,
      "fablabs": ["Fablab 13", "Fablab 19", "Fablab 4"]
      }
   ]
}
}

F. Adjustment Rules Insertion Using The GUI

Note: Currently this API endpoint doesn't work, apparently.

Example of adjustment CSV file:

question,answer,Bleach,Aesthetic1,Aesthetic2,Citric,Agglo,Dispersant,Brightener,SudsSupp,Carbonate,PerfPart,Activator,Nonionic,PerfumeSO1,PerfumeSO2,Zeolite,Sulphate
01-01 Clean Power,Min,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
01-01 Clean Power,MinToBaseline,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
01-01 Clean Power,BaselineToMax,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
01-01 Clean Power,Max,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

G. Errors

Error One (GetAllQuestionsError):

( ErrorCode: get() missing 1 required positional argument: 'id' )

curl -X GET -H "Authorization: Bearer ${B}" \
'https://diy4u-efs.herokuapp.com/core/questions'

Error Two (ListAllAdjustmentsRulesError):

( ErrorCode: 500 - Sorry, an internal error when handling the request, please retry again later )

curl -X GET -H "Authorization: Bearer ${B}" \
'https://diy4u-efs.herokuapp.com/core/adjustment-rules'

Error Three (PutUpdateToBaseFormulaError):

( ErrorCode: adjustment_rules_id turns to "1" when in GUI )

curl -X PUT \
-H "Authorization: Bearer ${B}" \
-H 'Content-Type: application/json' \
-d '{
    "id": "621115794549833edfbff456",
    "name": "Formula test 111",
    "formula_type": "detergent",
    "formula_state": "powder",
    "adjustment_rules_id": "61a89b211c8a1a701762b4f0",
    "performance": {},
    "owner_id": "600068a50600906ada93a48b",
    "is_basic": false,
    "constituents": [ {"rms_id":"6001ba15560c106958eaeb79","weight":0.5},{"rms_id":"6001bd60560c106958eaeb7a","weight":0.5} ]
}' 'https://diy4u-efs.herokuapp.com/core/formulas'

Error Four (CreateAdjustmentRulesError):

( ErrorCode: 400 - Invalid adjustment rules data was provided )

curl -X POST -H "Authorization: Bearer ${B}" -H 'Content-Type: application/json' \
-d '{
  "title": "Fake Adjustment rules", "formula_state": "powder", "formula_type": "detergent",
  "related_questions": [
      {
          "question_id": "5ff33a28bc205fcf1a56aaf2",
          "related_answers": [
              { "answer_id": "5ff33a28bc205fcf1a56aaee",
                "related_rms_adjustments": [ {"rms_id":"6001ba15560c106958eaeb79","kept_percent":0.1},{"rms_id":"6001bd60560c106958eaeb7a","kept_percent":0.1},{"rms_id":"6001bd86560c106958eaeb7b","kept_percent":0.1} ]
              }
          ]
      }
  ]
}' \
'https://diy4u-efs.herokuapp.com/core/adjustment-rules'

Error Five (UpdateAdjustmentRulesError):

( ErrorCode: Application Error )

curl -X PUT -H "Authorization: Bearer ${B}" -H 'Content-Type: application/json' \
--data-raw '{
    "id": "61a89b211c8a1a701762b4f0", "title": "Powder adjustment rules",
    "formula_state": "powder", "formula_type": "detergent",
    "owner_id": "600068a50600906ada93a48b",
    "related_questions": [
        {   "question_id": "5ff33a28bc205fcf1a56aaf2",
            "related_answers": [
                {
                    "answer_id": "5ff33a28bc205fcf1a56aaee",
                    "related_rms_adjustments": [ {"rms_id":"6087e4618756d6daf814e68c","kept_percent":0.2} ]
                }
            ]
        }
    ]
}' \
'https://diy4u-efs.herokuapp.com/core/adjustment-rules/61a89b211c8a1a701762b4f0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment