Workspace service (gRPC)#
This service provides information about workspaces. Workspaces provide access control boundaries. All resources in Nominal live within a workspace.
Endpoints#
Get default workspace#
gRPC /nominal.workspaces.v1.WorkspaceService/GetDefaultWorkspace
Gets the default workspace for the requesting user. If the user belongs to a single workspace, that workspace is returned. Otherwise, if the user’s organization has a default workspace and the user belongs to it, that will be returned.
Request: GetDefaultWorkspaceRequest
A message with no fields.
Response: GetDefaultWorkspaceResponse
workspaceWorkspace
Fields of
WorkspaceidstringA unique identifier for the workspace within the organization. The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
ridstring
orgstring
display_namestring
symbolWorkspaceSymbol
Fields of
WorkspaceSymbol- one of
icon,emoji,image
iconstringWorkspace icon name (e.g. castle)
emojistringWorkspace emoji name (e.g. :castle:)
imagestringWorkspace image url (e.g. https://example.com/image.png)
- one of
settingsWorkspaceSettings
Fields of
WorkspaceSettingsref_namesPreferredRefNameConfiguration
Fields of
PreferredRefNameConfigurationv1array ofRefNameAndType
Fields of
RefNameAndTypenamestring
typeDataSourceType
Values of
DataSourceTypeDATA_SOURCE_TYPE_UNSPECIFIED
DATASET
CONNECTION
VIDEO
SPATIAL
proceduresProcedureSettings
Fields of
ProcedureSettingsv1ProcedureSettingsV1
Fields of
ProcedureSettingsV1workspace_proceduresarray of stringA list of procedures that are elevated to the workspace-level. They will be available for execution in a top-level context, rather than just from the procedure details page.
Request
import grpc
from nominal.protos.workspaces.v1 import workspaces_pb2, workspaces_pb2_grpc
channel = grpc.secure_channel("api.gov.nominal.io:443", grpc.ssl_channel_credentials())
workspace_service = workspaces_pb2_grpc.WorkspaceServiceStub(channel)
auth = [("authorization", "Bearer <api key>")]
request = workspaces_pb2.GetDefaultWorkspaceRequest()
response = workspace_service.GetDefaultWorkspace(request, metadata=auth)
print(response)
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
workspacesv1 "github.com/nominal-io/nominal-api-protos-go/nominal/protos/workspaces/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
)
func main() {
conn, err := grpc.NewClient("api.gov.nominal.io:443",
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
if err != nil {
log.Fatal(err)
}
defer conn.Close()
workspaceService := workspacesv1.NewWorkspaceServiceClient(conn)
ctx := metadata.AppendToOutgoingContext(context.Background(), "authorization", "Bearer <api key>")
request := &workspacesv1.GetDefaultWorkspaceRequest{}
response, err := workspaceService.GetDefaultWorkspace(ctx, request)
if err != nil {
log.Fatal(err)
}
fmt.Println(response)
}
Response
{
"workspace": {
"id": "<id>",
"rid": "<rid>",
"org": "<org>",
"display_name": "<display name>",
"symbol": {
"icon": "<icon>"
},
"settings": {
"ref_names": {
"v1": [
{
"name": "<name>",
"type": "DATASET"
}
]
},
"procedures": {
"v1": {
"workspace_procedures": [
"<workspace procedures>"
]
}
}
}
}
}
Get workspace#
gRPC /nominal.workspaces.v1.WorkspaceService/GetWorkspace
Gets the workspace with the specified WorkspaceRid.
Request: GetWorkspaceRequest
workspace_ridstring
Response: GetWorkspaceResponse
workspaceWorkspace
Fields of
WorkspaceidstringA unique identifier for the workspace within the organization. The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
ridstring
orgstring
display_namestring
symbolWorkspaceSymbol
Fields of
WorkspaceSymbol- one of
icon,emoji,image
iconstringWorkspace icon name (e.g. castle)
emojistringWorkspace emoji name (e.g. :castle:)
imagestringWorkspace image url (e.g. https://example.com/image.png)
- one of
settingsWorkspaceSettings
Fields of
WorkspaceSettingsref_namesPreferredRefNameConfiguration
Fields of
PreferredRefNameConfigurationv1array ofRefNameAndType
Fields of
RefNameAndTypenamestring
typeDataSourceType
Values of
DataSourceTypeDATA_SOURCE_TYPE_UNSPECIFIED
DATASET
CONNECTION
VIDEO
SPATIAL
proceduresProcedureSettings
Fields of
ProcedureSettingsv1ProcedureSettingsV1
Fields of
ProcedureSettingsV1workspace_proceduresarray of stringA list of procedures that are elevated to the workspace-level. They will be available for execution in a top-level context, rather than just from the procedure details page.
Request
import grpc
from nominal.protos.workspaces.v1 import workspaces_pb2, workspaces_pb2_grpc
channel = grpc.secure_channel("api.gov.nominal.io:443", grpc.ssl_channel_credentials())
workspace_service = workspaces_pb2_grpc.WorkspaceServiceStub(channel)
auth = [("authorization", "Bearer <api key>")]
request = workspaces_pb2.GetWorkspaceRequest(workspace_rid="<workspace rid>")
response = workspace_service.GetWorkspace(request, metadata=auth)
print(response)
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
workspacesv1 "github.com/nominal-io/nominal-api-protos-go/nominal/protos/workspaces/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
)
func main() {
conn, err := grpc.NewClient("api.gov.nominal.io:443",
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
if err != nil {
log.Fatal(err)
}
defer conn.Close()
workspaceService := workspacesv1.NewWorkspaceServiceClient(conn)
ctx := metadata.AppendToOutgoingContext(context.Background(), "authorization", "Bearer <api key>")
request := &workspacesv1.GetWorkspaceRequest{
WorkspaceRid: "<workspace rid>",
}
response, err := workspaceService.GetWorkspace(ctx, request)
if err != nil {
log.Fatal(err)
}
fmt.Println(response)
}
Response
{
"workspace": {
"id": "<id>",
"rid": "<rid>",
"org": "<org>",
"display_name": "<display name>",
"symbol": {
"icon": "<icon>"
},
"settings": {
"ref_names": {
"v1": [
{
"name": "<name>",
"type": "DATASET"
}
]
},
"procedures": {
"v1": {
"workspace_procedures": [
"<workspace procedures>"
]
}
}
}
}
}
Get workspaces#
gRPC /nominal.workspaces.v1.WorkspaceService/GetWorkspaces
Gets all workspaces that the requesting user belongs to.
Request: GetWorkspacesRequest
filter_by_session_orgbooleanWhen unset, defaults to true.
include_guest_workspacesbooleanWhen unset, defaults to false.
include_role_bound_workspacesbooleanWhen unset, defaults to false. Also returns the session org’s workspaces where a role binding grants the caller workspace:view.
Response: GetWorkspacesResponse
workspacesarray ofWorkspace
Fields of
WorkspaceidstringA unique identifier for the workspace within the organization. The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
ridstring
orgstring
display_namestring
symbolWorkspaceSymbol
Fields of
WorkspaceSymbol- one of
icon,emoji,image
iconstringWorkspace icon name (e.g. castle)
emojistringWorkspace emoji name (e.g. :castle:)
imagestringWorkspace image url (e.g. https://example.com/image.png)
- one of
settingsWorkspaceSettings
Fields of
WorkspaceSettingsref_namesPreferredRefNameConfiguration
Fields of
PreferredRefNameConfigurationv1array ofRefNameAndType
Fields of
RefNameAndTypenamestring
typeDataSourceType
Values of
DataSourceTypeDATA_SOURCE_TYPE_UNSPECIFIED
DATASET
CONNECTION
VIDEO
SPATIAL
proceduresProcedureSettings
Fields of
ProcedureSettingsv1ProcedureSettingsV1
Fields of
ProcedureSettingsV1workspace_proceduresarray of stringA list of procedures that are elevated to the workspace-level. They will be available for execution in a top-level context, rather than just from the procedure details page.
Request
import grpc
from nominal.protos.workspaces.v1 import workspaces_pb2, workspaces_pb2_grpc
channel = grpc.secure_channel("api.gov.nominal.io:443", grpc.ssl_channel_credentials())
workspace_service = workspaces_pb2_grpc.WorkspaceServiceStub(channel)
auth = [("authorization", "Bearer <api key>")]
request = workspaces_pb2.GetWorkspacesRequest(
filter_by_session_org=True,
include_guest_workspaces=True,
include_role_bound_workspaces=True,
)
response = workspace_service.GetWorkspaces(request, metadata=auth)
print(response)
Response
{
"workspaces": [
{
"id": "<id>",
"rid": "<rid>",
"org": "<org>",
"display_name": "<display name>",
"symbol": {
"icon": "<icon>"
},
"settings": {
"ref_names": {
"v1": [
{
"name": "<name>",
"type": "DATASET"
}
]
},
"procedures": {
"v1": {
"workspace_procedures": [
"<workspace procedures>"
]
}
}
}
}
]
}
Update workspace#
gRPC /nominal.workspaces.v1.WorkspaceService/UpdateWorkspace
Updates the settings of the workspace with the specified WorkspaceRid.
Request: UpdateWorkspaceRequestWrapper
ridstring
requestUpdateWorkspaceRequest
Fields of
UpdateWorkspaceRequestdisplay_nameUpdateOrRemoveWorkspaceDisplayName
Fields of
UpdateOrRemoveWorkspaceDisplayName- one of
display_name,remove_typerequired
display_namestring
remove_typeRemoveType
- one of
symbolUpdateOrRemoveWorkspaceSymbol
Fields of
UpdateOrRemoveWorkspaceSymbol- one of
symbol,remove_typerequired
symbolWorkspaceSymbol
Fields of
WorkspaceSymbol- one of
icon,emoji,imagerequired
iconstringWorkspace icon name (e.g. castle)
emojistringWorkspace emoji name (e.g. :castle:)
imagestringWorkspace image url (e.g. https://example.com/image.png)
- one of
remove_typeRemoveType
- one of
settingsWorkspaceSettingsExcluded fields in the settings update will be ignored.
Fields of
WorkspaceSettingsref_namesPreferredRefNameConfiguration
Fields of
PreferredRefNameConfigurationv1array ofRefNameAndType
Fields of
RefNameAndTypenamestring
typeDataSourceType
Values of
DataSourceTypeDATA_SOURCE_TYPE_UNSPECIFIED
DATASET
CONNECTION
VIDEO
SPATIAL
proceduresProcedureSettings
Fields of
ProcedureSettingsv1ProcedureSettingsV1
Fields of
ProcedureSettingsV1workspace_proceduresarray of stringA list of procedures that are elevated to the workspace-level. They will be available for execution in a top-level context, rather than just from the procedure details page.
Response: UpdateWorkspaceResponse
workspaceWorkspace
Fields of
WorkspaceidstringA unique identifier for the workspace within the organization. The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
ridstring
orgstring
display_namestring
symbolWorkspaceSymbol
Fields of
WorkspaceSymbol- one of
icon,emoji,image
iconstringWorkspace icon name (e.g. castle)
emojistringWorkspace emoji name (e.g. :castle:)
imagestringWorkspace image url (e.g. https://example.com/image.png)
- one of
settingsWorkspaceSettings
Fields of
WorkspaceSettingsref_namesPreferredRefNameConfiguration
Fields of
PreferredRefNameConfigurationv1array ofRefNameAndType
Fields of
RefNameAndTypenamestring
typeDataSourceType
Values of
DataSourceTypeDATA_SOURCE_TYPE_UNSPECIFIED
DATASET
CONNECTION
VIDEO
SPATIAL
proceduresProcedureSettings
Fields of
ProcedureSettingsv1ProcedureSettingsV1
Fields of
ProcedureSettingsV1workspace_proceduresarray of stringA list of procedures that are elevated to the workspace-level. They will be available for execution in a top-level context, rather than just from the procedure details page.
Request
import grpc
from nominal.protos.workspaces.v1 import workspaces_pb2, workspaces_pb2_grpc
channel = grpc.secure_channel("api.gov.nominal.io:443", grpc.ssl_channel_credentials())
workspace_service = workspaces_pb2_grpc.WorkspaceServiceStub(channel)
auth = [("authorization", "Bearer <api key>")]
request = workspaces_pb2.UpdateWorkspaceRequestWrapper(
rid="<rid>",
request={
"display_name": {"display_name": "<display name>"},
"symbol": {"symbol": {"icon": "<icon>"}},
"settings": {
"ref_names": {"v1": [{"name": "<name>", "type": "DATASET"}]},
"procedures": {"v1": {"workspace_procedures": ["<workspace procedures>"]}},
},
},
)
response = workspace_service.UpdateWorkspace(request, metadata=auth)
print(response)
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
"github.com/nominal-io/nominal-api-protos-go/nominal/protos/types"
workspacesv1 "github.com/nominal-io/nominal-api-protos-go/nominal/protos/workspaces/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
)
func main() {
conn, err := grpc.NewClient("api.gov.nominal.io:443",
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
if err != nil {
log.Fatal(err)
}
defer conn.Close()
workspaceService := workspacesv1.NewWorkspaceServiceClient(conn)
ctx := metadata.AppendToOutgoingContext(context.Background(), "authorization", "Bearer <api key>")
request := &workspacesv1.UpdateWorkspaceRequestWrapper{
Rid: "<rid>",
Request: &workspacesv1.UpdateWorkspaceRequest{
DisplayName: &workspacesv1.UpdateOrRemoveWorkspaceDisplayName{
UpdateOrRemoveWorkspaceDisplayName: &workspacesv1.UpdateOrRemoveWorkspaceDisplayName_DisplayName{DisplayName: "<display name>"},
},
Symbol: &workspacesv1.UpdateOrRemoveWorkspaceSymbol{
UpdateOrRemoveWorkspaceSymbol: &workspacesv1.UpdateOrRemoveWorkspaceSymbol_Symbol{Symbol: &workspacesv1.WorkspaceSymbol{
WorkspaceSymbol: &workspacesv1.WorkspaceSymbol_Icon{Icon: "<icon>"},
}},
},
Settings: &workspacesv1.WorkspaceSettings{
RefNames: &workspacesv1.PreferredRefNameConfiguration{
V1: []*types.RefNameAndType{
{
Name: "<name>",
Type: types.DataSourceType_DATASET,
},
},
},
Procedures: &workspacesv1.ProcedureSettings{
ProcedureSettings: &workspacesv1.ProcedureSettings_V1{V1: &workspacesv1.ProcedureSettingsV1{
WorkspaceProcedures: []string{
"<workspace procedures>",
},
}},
},
},
},
}
response, err := workspaceService.UpdateWorkspace(ctx, request)
if err != nil {
log.Fatal(err)
}
fmt.Println(response)
}
Response
{
"workspace": {
"id": "<id>",
"rid": "<rid>",
"org": "<org>",
"display_name": "<display name>",
"symbol": {
"icon": "<icon>"
},
"settings": {
"ref_names": {
"v1": [
{
"name": "<name>",
"type": "DATASET"
}
]
},
"procedures": {
"v1": {
"workspace_procedures": [
"<workspace procedures>"
]
}
}
}
}
}
Errors#
Errors shows how these errors are sent.
Code |
Reason |
Message |
|---|---|---|
|
|
Workspaces are hard boundaries in Nominal. Resources from different workspaces cannot be combined. |
|
|
A workspace was not specified and could not be inferred. |
|
|
The workspace with the specified rid was not found. |
Types#
DataSourceType#
DATA_SOURCE_TYPE_UNSPECIFIED
DATASET
CONNECTION
VIDEO
SPATIAL
PreferredRefNameConfiguration#
v1array ofRefNameAndType
ProcedureSettings#
ProcedureSettingsV1#
workspace_proceduresarray of stringA list of procedures that are elevated to the workspace-level. They will be available for execution in a top-level context, rather than just from the procedure details page.
RefNameAndType#
namestring
typeDataSourceType
RemoveType#
The request to remove a field from a workspace.
A message with no fields.
UpdateOrRemoveWorkspaceDisplayName#
The request to update the display name of the workspace. The request will replace the existing display name with the display name specified if it’s provided. Otherwise, the current display name will be removed from the workspace.
Set exactly one of the fields below.
- one of
display_name,remove_typerequired
display_namestring
remove_typeRemoveType
UpdateOrRemoveWorkspaceSymbol#
The request to update the symbol of the workspace. The request will replace the existing symbol with the symbol specified if it’s provided. Otherwise, the current symbol will be removed from the workspace.
Set exactly one of the fields below.
- one of
symbol,remove_typerequired
symbolWorkspaceSymbol
remove_typeRemoveType
UpdateWorkspaceRequest#
display_nameUpdateOrRemoveWorkspaceDisplayName
symbolUpdateOrRemoveWorkspaceSymbol
settingsWorkspaceSettingsExcluded fields in the settings update will be ignored.
Workspace#
idstringA unique identifier for the workspace within the organization. The workspace ID must be lower case alphanumeric characters, optionally separated by hyphens.
ridstring
orgstring
display_namestring
symbolWorkspaceSymbol
settingsWorkspaceSettings
WorkspaceSettings#
ref_namesPreferredRefNameConfiguration
proceduresProcedureSettings
WorkspaceSymbol#
Set exactly one of the fields below.
- one of
icon,emoji,imagerequired
iconstringWorkspace icon name (e.g. castle)
emojistringWorkspace emoji name (e.g. :castle:)
imagestringWorkspace image url (e.g. https://example.com/image.png)
Page design based on Scalar, MIT License.