Favorites service#

Creating favorites allows users to pin specific resources (i.e. assets, workbooks, etc.) as favorites for quick access within search pages throughout the application for themselves.

OpenAPI file: FavoritesService.json

Endpoints#

Get favorites list#

GET /scout/v2/favorites/workspace/{workspaceRid}

Retrieves the favorites list for the current user in the specified workspace.

Path parameters

workspaceRid string (RID) required

​

Query parameters

resourceTypes array of string, one of ASSET, RUN, NOTEBOOK, NOTEBOOK_TEMPLATE, CHECKLIST, SAVED_VIEW, PROCEDURE, PLAN

The resource types to include in the favorites list. If none are provided, all resource types will be included.

Response

favorites array of FavoriteResource

​

Set type to "asset".

asset string (RID)

​

Set type to "run".

run string (RID)

​

Set type to "notebook".

notebook string (RID)

​

Set type to "notebookTemplate".

notebookTemplate string (RID)

​

Set type to "checklist".

checklist string (RID)

​

Set type to "savedView".

savedView string (RID)

​

Set type to "procedure".

procedure string (RID)

​

Set type to "plan".

plan string (RID)

​

Request

curl "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>" \
  -H "Authorization: Bearer <api key>"
import requests

response = requests.get(
    "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>",
    headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import httpx

response = httpx.get(
    "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>",
    headers={"Authorization": "Bearer <api key>"},
)
response.raise_for_status()
print(response.json())
import asyncio

import aiohttp


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.get(
            "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>",
            headers={"Authorization": "Bearer <api key>"},
        ) as response:
            response.raise_for_status()
            print(await response.json())


asyncio.run(main())

Response: 200

{
  "favorites": [
    {
      "type": "asset",
      "asset": "<asset rid>"
    }
  ]
}

Set favorites list#

PUT /scout/v2/favorites/workspace/{workspaceRid}

Overwrites the favorites list for the current user in the specified workspace.

Path parameters

workspaceRid string (RID) required

​

Body

resources array of FavoriteResource

The resources to set as the user’s favorites. Note that the provided list will overwrite all the user’s previous favorites.

Set type to "asset".

asset string (RID)

​

Set type to "run".

run string (RID)

​

Set type to "notebook".

notebook string (RID)

​

Set type to "notebookTemplate".

notebookTemplate string (RID)

​

Set type to "checklist".

checklist string (RID)

​

Set type to "savedView".

savedView string (RID)

​

Set type to "procedure".

procedure string (RID)

​

Set type to "plan".

plan string (RID)

​

Response

favorites array of FavoriteResource

​

Set type to "asset".

asset string (RID)

​

Set type to "run".

run string (RID)

​

Set type to "notebook".

notebook string (RID)

​

Set type to "notebookTemplate".

notebookTemplate string (RID)

​

Set type to "checklist".

checklist string (RID)

​

Set type to "savedView".

savedView string (RID)

​

Set type to "procedure".

procedure string (RID)

​

Set type to "plan".

plan string (RID)

​

Request

curl -X PUT "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>" \
  -H "Authorization: Bearer <api key>" \
  -H "Content-Type: application/json" \
  --data '{
  "resources": [
    {
      "type": "asset",
      "asset": "<asset rid>"
    }
  ]
}'
import requests

response = requests.put(
    "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>",
    headers={"Authorization": "Bearer <api key>"},
    json={"resources": [{"type": "asset", "asset": "<asset rid>"}]},
)
response.raise_for_status()
print(response.json())
import httpx

response = httpx.put(
    "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>",
    headers={"Authorization": "Bearer <api key>"},
    json={"resources": [{"type": "asset", "asset": "<asset rid>"}]},
)
response.raise_for_status()
print(response.json())
import asyncio

import aiohttp


async def main() -> None:
    async with aiohttp.ClientSession() as session:
        async with session.put(
            "https://api.gov.nominal.io/api/scout/v2/favorites/workspace/<workspace rid>",
            headers={"Authorization": "Bearer <api key>"},
            json={"resources": [{"type": "asset", "asset": "<asset rid>"}]},
        ) as response:
            response.raise_for_status()
            print(await response.json())


asyncio.run(main())

Response: 200

{
  "favorites": [
    {
      "type": "asset",
      "asset": "<asset rid>"
    }
  ]
}

Errors#

Errors shows how these errors are sent.

Each error’s errorName is Favorites: followed by its name below.

Status

Name

Notes

400

DuplicateResourcesError

404

ResourcesNotFoundError

Types#

FavoriteResource#

Set type to the name of one of the other fields, and set only that field.

asset string (RID)

​

run string (RID)

​

notebook string (RID)

​

notebookTemplate string (RID)

​

checklist string (RID)

​

savedView string (RID)

​

procedure string (RID)

​

plan string (RID)

​

Page design based on Scalar, MIT License.