Create Dashboard through GraphQL

Hi Speckle people!

I’m trying to create a dashboard through the API, using this mutation:

mutation addDashboard($input: WorkspaceCreateInput!) {
    workspaceMutations {
        create(input: $input) {
            dashboards {
                items {
                    id
                    name
                    createdBy {
                        id
                        avatar
                        name
                    }
                    createdAt
                }
            }
        }
    }
}

However, I get a 403 response:
`"Your workspace plan does not have access to this feature."´

My workspace have access to dashboards and I can also pull them through a query.

Any ideas what goes wrong?

Cheers!
/Christian

Heyo!

It looks like your mutation is creating a workspace and not a dashboard and that new workspace does not have access to the dashboards feature. Could you try this again with a mutation like

mutation($workspace: WorkspaceIdentifier!, $input: DashboardCreateInput!) {
  dashboardMutations {
    create(workspace: $workspace, input: $input) {
      id
    }
  }
}

inputs should look like

{
  "input": {
    "name": "",
    "projectId": ""
  },
  "workspace": "id or slug"
}

hope this helps.

Thanks that worked!

1 Like