Is it possible to commit an ifc file with the api? I have uploaded the ifc file but how can a create a commit with it?
You can of course do that; here’s how our IFC import service does it, just with he usual GQL API: speckle-server/index.js at 7bac769180966f19be56bb477593e9983f00dc9d · specklesystems/speckle-server · GitHub
Thanks, can use your IFC import service via the api to parse the IFC file? Or how can I get a valid object from the IFC?
Are you asking if there is a single REST API endpoint to trigger the upload-conversion-commit?
Yes sorry for being unclear, I mean can I commit an IFC file with the api and get the same result as when I do it through the UI on speckle.xyz (ie a commit with the IFC displayed in the viewer)? I tried commitCreate but how can I get a valid object from the IFC file to include?
mutation {
one: commitCreate(commit: {
streamId: "streamId"
branchName: "branchName"
objectId: ?
message: "message"
sourceApplication: "ifc"
totalChildrenCount: ?
}
)
}
I was looking at the same thing. GraphQL is very cool and useful to work with, but it would be really nice to upload IFC files directly (perhaps using REST). I didn’t find any clues in the docs, so the last few weeks I’ve been looking at the code to see if there were any opportunities to achieve this.
By importing (parts of) a Speckle Connector in a standalone Python script, I was able to upload GIS data to Speckle and create commits. I’d love to do this with IFC files too. There’s an IFC parser in the server package, which is (if I’m correct) only triggered when dragging and dropping a file in the frontend.
If there’s no way to upload an IFC file to Speckle without using a Connector or the frontend, I am going to try to set up a REST endpoint myself, to which you can POST a file, to be passed into the parser.
Just a bit of addition to this,
if you post a multipart file upload with a content of your ifc file to the server’s endpoint:
'/api/file/:fileType/:streamId/:branchName?'
, the server automatically creates a file import job, that will parse and commit the file’s content into the given (model) branch specified in the query parameter. If no param is added we’re using the default main
.
You can register webhook handlers to be notified when a commit is created on the branch if you need a poke after a finished parsing operation.
So while this is not a explicitly wait until a commit is created from an uploaded file, it is basically triggering a background parse job, that will create a commit from an ifc file.
Hope that helps
That’s what I was looking for, thanks helps a lot!