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
workspaceRidstring (RID) required
Query parameters
resourceTypesarray of string, one ofASSET,RUN,NOTEBOOK,NOTEBOOK_TEMPLATE,CHECKLIST,SAVED_VIEW,PROCEDURE,PLANThe resource types to include in the favorites list. If none are provided, all resource types will be included.
Response
favoritesarray ofFavoriteResource
Set
typeto"asset".assetstring (RID)
Set
typeto"run".runstring (RID)
Set
typeto"notebook".notebookstring (RID)
Set
typeto"notebookTemplate".notebookTemplatestring (RID)
Set
typeto"checklist".checkliststring (RID)
Set
typeto"savedView".savedViewstring (RID)
Set
typeto"procedure".procedurestring (RID)
Set
typeto"plan".planstring (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
workspaceRidstring (RID) required
Body
resourcesarray ofFavoriteResourceThe resources to set as the user’s favorites. Note that the provided list will overwrite all the user’s previous favorites.
Set
typeto"asset".assetstring (RID)
Set
typeto"run".runstring (RID)
Set
typeto"notebook".notebookstring (RID)
Set
typeto"notebookTemplate".notebookTemplatestring (RID)
Set
typeto"checklist".checkliststring (RID)
Set
typeto"savedView".savedViewstring (RID)
Set
typeto"procedure".procedurestring (RID)
Set
typeto"plan".planstring (RID)
Response
favoritesarray ofFavoriteResource
Set
typeto"asset".assetstring (RID)
Set
typeto"run".runstring (RID)
Set
typeto"notebook".notebookstring (RID)
Set
typeto"notebookTemplate".notebookTemplatestring (RID)
Set
typeto"checklist".checkliststring (RID)
Set
typeto"savedView".savedViewstring (RID)
Set
typeto"procedure".procedurestring (RID)
Set
typeto"plan".planstring (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 |
|
|
404 |
|
Types#
FavoriteResource#
Set type to the name of one of the other fields, and set only that field.
assetstring (RID)
runstring (RID)
notebookstring (RID)
notebookTemplatestring (RID)
checkliststring (RID)
savedViewstring (RID)
procedurestring (RID)
planstring (RID)
Page design based on Scalar, MIT License.