Creating globals with GraphQL

Hi,

I used specklepy and some GraphQL queries to pre-populate the globals of a newly created stream using the following:

'{ "query": "mutation { branchCreate ( branch: { streamId: \\"streamId\\", name: \\"globals\\", description: \\"Globals Variables\\" } ) }" }'

'{ "query": "mutation { objectCreate ( objectInput: { streamId: \\"streamId\\", objects: { ParentObject: { Object1: \\"value\\", Object2: \\"value\\" } } } ) }", "variables": {} }'

'{ "query": "mutation { commitCreate ( commit: { streamId: \\"streamId\\", branchName: \\"globals\\", objectId: \\"objectId\\" } ) }", "variables": {} }'

Those globals look normal on the speckle server, but for some reason I cannot receive them in Grasshopper? Any ideas?

It looks like it works after making a small change in the web interface to the globals… So maybe there is something missing in my query?

Hi @tlmn, you’ll probably need to specifiy a speckle_type: "Base" for each of your objects in there.

The frontend doesn’t really care about the speckle_type, so it can display them nicely. When saving them, it probably added the type in there for you too.

I made a similar mistake recently with the IFC parser; let me know if this helps!

3 Likes