AMAGE REST API - Resources/Parameters

Introduction/Context

Context for operations on resource module objects (Structure) in the AMAGE system, which should be extended with the appropriate method in the query.

  • rest/amage/v1/assets

Data structures

Structures and data types used in queries and responses.

Result:

The ID/UUID fields contain the identifier of the newly created or edited object. If the operation is performed correctly, the success field is set to true. If an error occurs, the success field is set to false, and the message field contains a description of the error. The error code then contains an HTTP code of the NOT_FOUND or BAD_REQUEST type. The BAD_REQUEST code is also returned in the query. Depending on the type of error during query processing, the error code may be different than the main query code returned. The query code will be BAD_REQUEST, and the internal code will be set to NOT_FOUND in the case when the query sets an object property to another object in the system. The JSON parameter will be correct (record UUID), but there will be no such record in the system. Therefore, the NOT_FOUND code will appear in the errorCode field. In the message description field, a message informing what record was not found, and the main query error code will be BAD_REQUEST.

{
    "id": 1,
    "uuid":"f25e62ea-0100-4f4e-aad2-853cf48df2b9",
    "success":true,
    "errorCode":0,
    "message":""
}

Parameter type. An enumeration element that specifies the type of the parameter (ParameterType):

  • STRING,

  • FLOAT,

  • INTEGER,

  • ENUM,

  • DATETIME,

  • DATE,

  • TIME

Source of information. Enumerated field as a comma-separated list of values. Available values:

  • FROM_DESKTOP,

  • FROM_MOBILE,

  • FROM_IDENTIFIER,

  • FROM_DIFFERENCE,

  • FROM_IMPORT,

  • FROM_WEB_SERVICE,

  • FROM_DATA_AGGREGATOR,

  • FROM_AUTOMATION

API operations

Reading the parameter setting value

  • Method: GET

  • Path: /parametersetting/{uuid}

  • Generates: application/json

  • Requires: application/json, text/plain

  • Authorization: API signature (device-uuid, api-key, api-sign)

Parameters:

  • UUID - parameter settings identifier in the resource

The returned data is a JSON object with the structure:

{
    "id": 12345,
    "uuid": "f25e62ea-0100-4f4e-aad2-853cf48df2b9",
    "parameter": {
        "id": 34567,
        "uuid": "f25e62ea-0100-4f4e-aad2-853cf48df2b9",
        "name": "parameter",
        "description": "parameter description",
        "category": "parameter category",
        "type": "STRING"
    },
    "value": "Test value",
    "availability": true,
    "userUuid": "f25e62ea-0100-4f4e-aad2-853cf48df2b9",
    "timestamp": "2021-01-01T12:00:00"
}

Saving history to existing parameter setting

  • Method: POST

  • Path: /add-parametersetting-history/{uuid}

  • Generates: application/json

  • Requires: application/json

  • Authorization: API signature (device-uuid, api-key, api-sign)

Parameters:

  • UUID - parameter settings identifier

In the query body, you should include a JSON object with the parameter history data. The object has the structure:

{
    "date": "2021-01-01T12:00:00",
    "parameterSettingUuid": "f25e62ea-0100-4f4e-aad2-853cf48df2b9",
    "userUuid": "f25e62ea-0100-4f4e-aad2-853cf48df2b9",
    "currentValue": "TestValue",
    "source": "FROM_WEB_SERVICE"
}

Query

/rest/amage/v1/assets/add-parametersetting-history/1c4066e6-cdd6-4903-803a-b6bffe689527

Response

{
    "id": 12345,
    "uuid":"f25e62ea-0100-4f4e-aad2-853cf48df2b9",
    "success":true,
    "errorCode":0,
    "message":""
}