Connecting Speckle to cloud hosted applications

I am a developer of a cloud hosted Asset Register and are looking into potential integrations with Speckle to enable two way synchronisation between asset data and model properties.

Use cases would be:

  • Retrieve list of models in a given project
  • Retrieve objects for a given model
  • Retrieve property sets and properties for a given object
  • Write properties to objects

It appears that the REST API can be used to achieve some, but not all, of the above. Notably, retrieving a list of objects for a project / model where we don’t already know their objectIDs doesn’t seem to be supported.

We are therefore considering writing (or finding?) a Speckle connector to act as a web service client and make web service calls back to our application, as we have already implemented the server side for this approach.

Just wondering if this type of connector has been considered or developed by anyone else, or are connectors intended to be Speckle <—> desktop application?

The GraphQL API is tailor-made for this activity - you’ll find the whole of app.speckle.systems frontend is using it, so it isn’t a connector per se but has total granular access to all datasets.

If you already have data uploaded to Speckle, you can already explore: Speckle GraphQL API Pro

Thanks for the response. I’ve been trying out some queries via Speckle GraphQL API and don’t seem to be able to return all objects within a project.

Is it possible to specify a query like the following but without specifying an object.id?

query($myQuery:[JSONObject!]){
    project(id:"myProjectID"){
        object(id:"51a5b3d7c3b4c939f24296e7ae8c00ec"){
      			data
      			speckleType
      			totalChildrenCount
            children(query: $myQuery select:["parameters", "speckle_type", "type", "family", "category"]){
                totalCount
                cursor
                objects{
                    id
                    data
                }
            }
        }
    }
}

Hi @Neil_Hinson,

You need to specify the object ID because you need to specify the Object that you want to query. If you want to Query the whole model (ie query all the objects) - then you will need to specify the Root Object ID.

The Root Object ID you can easaly find it by clicking the Dev Mode(without selecting anything) in the 3D Viewer.

The other way to get the Root Object ID (aka referencedObject) is by quering the Project that holds your models like below.

You simple query the Project to find what Models and Versions exists - then you pick the latests (or whatever version you like).

Lastly, using GQL API you will need to specify a limit - by defult is 100, this means that it will return 100 objects. You can also specify the Depth, in order to query Nested objects. One object can have multiple nested objects.

I hope this is helpful - let us know if you have more questions.

1 Like

Thanks @Nikos for the info. Very useful. I am now able to query everything I think i need from my project and its models.

I was hoping next to be able to issue some mutations to update existing properties (or create new ones) on objects within the model, in the hope that these updates would then be reflected back in the native models if the revevant connector is installed. Is this possible?

The mutation fields don’t appear to include ‘objectMutations’ or ‘propertyMutations’ - which I was hoping to find.

Nice, thats great!

Now updating/creating object properties it can be a bit tricky and cannot happen using GQL. You can use GQL to create a new Project, Model or Version - but not updating/creating properties.

To work with object properties you need to use the Speckle SDKs (python or C#). You can find more here Introduction | Speckle Docs.

What connectors are you using?

@Neil_Hinson To expand on what @Nikos said, Objects in Speckle are, by definition, immutable. We handle versions instead.

A version is a collection of all the changed and also unchanged objects determined to be the packet of information sent at that time. Behind the scenes, our SDKs help you figure out which objects have changed and assemble the version for you, so what gets sent to Speckle is only what’s new, along with references to the rest.