Set Favorites

Sets current user’s favorites.

If you need to set favorites of another user, use the Update User request.

Request

HTTP Request

POST /node/api/users/favorites
text

Body parameters

Favorites don’t have a fixed structure, so favorites may return a custom set of variables.

The recommended structure is described in the Favorites model.

Request body

Request body contains entities that you set as favorites.

This request overwrites the previous set of favorites.

Favorites don’t have a fixed structure, so you can pass any parameters and use a custom format.

However, it’s recommended to use the structure is described in the Favorites model:

[
    {
        "name": "String", // Favorites collection name.
        "objects": [
            "String" // Object's ID.
        ],
        "links": [
            "String" // Link's ID.
        ],
        "operations": [
            {
                "id": "String", // Operation's ID."
                "entityType": Integer, // Type of the entity. It's equal to 1 for objects and 2 for links.
                "entityId": "String" // ID of an entity to which the operation belongs.
            }
        ],
        "graphs": [
            {
                "metric": "String", // Metric name."
                "entityType": Integer, // Type of the entity. It's equal to 1 for objects and 2 for links.,
                "entityId": "String", // ID of an entity to which the metric belongs.
            }
        ]
    }
]
json

Response

Returns favorites set by this request.

Example

Request

login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/users/favorites

curl -X POST $url -u $login:$password \
    -H "Content-Type: application/json" \
    --d @- <<EOF     [
      {
          "name": "My favorites",
          "objects": [
              "5e21b752308c3c66d64e072c",
              "6315fc710f3d71351b6609c8"
          ],
          "links": [
              "5e4fc1c77915112ac209e53d",
              "5c541db3347bb9002714d002"
          ],
          "operations": [
              {
                  "id": "5e21b85b308c3c66d64e07bc",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c"
              },
              {
                  "id": "5c541db3347bb9002714d003",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c"
              }
          ],
          "graphs": [
              {
                  "metric": "stdout.m1",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c",
              },
              {
                  "metric": "stdout.m2",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c",
              },
              {
                  "metric": "TOTAL.bytesUsed",
                  "entityType": 1,
                  "entityId": "5c541dc5347bb9002714d17c",
              }
          ]
      }
    ]
EOF
bash

Response

    [
      {
          "name": "My favorites",
          "objects": [
              "5e21b752308c3c66d64e072c",
              "6315fc710f3d71351b6609c8"
          ],
          "links": [
              "5e4fc1c77915112ac209e53d",
              "5c541db3347bb9002714d002"
          ],
          "operations": [
              {
                  "id": "5e21b85b308c3c66d64e07bc",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c"
              },
              {
                  "id": "5c541db3347bb9002714d003",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c"
              }
          ],
          "graphs": [
              {
                  "metric": "stdout.m1",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c",
              },
              {
                  "metric": "stdout.m2",
                  "entityType": 1,
                  "entityId": "5e21b752308c3c66d64e072c",
              },
              {
                  "metric": "TOTAL.bytesUsed",
                  "entityType": 1,
                  "entityId": "5c541dc5347bb9002714d17c",
              }
          ]
      }
    ]
json