This section handles the calculations configuration.

GET /calculations

This method returns the list of calculation types.

Request parameters:

  • company [mandatory]: the company name or id.
  • session [mandatory]: the Id of the active session.
  • process [mandatory]: The id of the process.

Response:

  • status: returns "0" on success, and an error code in any other case.
  • data: returns the list of calculation types.
  • message: "Success" or a descriptive information of the error in any other case.

Request:

{

"session": "cJvqHJcEssmpGukxrZF73migL5M4LVUZniyesQHBatOvTkrbpkYgrHKvfVpP",

"company": "demo01",

"process": "P0001"

}


Response:

{

"status": "0",

"data": [

       {

               "name": "Euros",

               "variables": "Euros",

               "units": "Euros",

               "formula": ""Euros""

       }

"message": "Success"

}

POST /calculations

This method creates a calculation type. The user must have the administrator role.

Request parameters (for additional information please review the calculation types configuration):

    • company [mandatory]: the company name or id.
    • session [mandatory]: the Id of the active session.
    • name [mandatory]: the name of the calculation type.
    • variables: variables that will be requested in order to calculate the quantity. There are predefined variables in configuration.
    • units: measurement units  that will be used to express the result of the calculation.
    • formula:mathematic function used to calculate the result. Variables must be enclosed with quotation marks, for example: "Width".

Request:

{

"session": "cJvqHJcEssmpGukxrZF73migL5M4LVUZniyesQHBatOvTkrbpkYgrHKvfVpP",

"company": "demo01",

"name": "Calc"

}

Response:

{

"status": 0,

"data": true,

"message": "Success"

}

DELETE /calculations/{id}

This method deletes a calculation type. The user must have the administrator role.

Request attribute:

    • id [mandatory]: the Id of the calculation type to delete.

Request parameters:

    • company [mandatory]: the company name or id.
    • session [mandatory]: the Id of the active session.

Response:

    • status: returns "0" on success, and an error code in any other case.
    • data: "success" on success, and empty in case of error.
    • message: "success" or a descriptive information of the error in any other case.

Request:

{

/calculations/Calc

}

{

"session": "cJvqHJcEssmpGukxrZF73migL5M4LVUZniyesQHBatOvTkrbpkYgrHKvfVpP",

"company": "demo01"

}


Response:

{

"status": 0,

"data": null,

"message": "Success"

}