Deprecation of REST API endpoint for file uploads

As you may have recently read, we have made a number of improvements to the file upload features in Speckle; such as supporting more file types and larger file sizes and improving our IFC file support.

In order to make these features possible we have made changes to Speckle server’s API. This will affect any developer who has made a custom integration to upload files to Speckle using the REST API path POST /api/file/:fileType/:streamId/:branchName?'.

If you are not developing against Speckle’s REST API or not self-hosting Speckle’s open source server, this will not affect you. These new features are already available on https://app.speckle.systems.

For the vigilant amongst developers using Speckle’s REST API, you may have noticed that since early July the POST /api/file/:fileType/:streamId/:branchName?' REST API endpoint has returned an additional Warning header in its response. This Warning header states that this endpoint is deprecated.

This endpoint is replaced by three separate operations, including two Graphql mutations. This new process allows much larger file sizes to be supported, and potentially allows these files to be uploaded faster than via the REST API. Below I will explain how to use the new methods in detail.

These new graphql mutations are available immediately on https://app.speckle.systems. They are also available for self-hosters, and further below we provide more details to make the new method work on a self-hosted Speckle server.

Instructions for developers

Firstly, the client must make an authenticated POST request to /graphql with the mutation fileUploadMutations.generateUploadUrl. Providing the projectId and the name of the file you wish to upload (filename) as inputs, the endpoint will return an url.

A PUT request should be sent to this returned url. The Content-type header should be set for this request, and should match the content type of the file being uploaded in this request body. This request will respond with details about the uploaded file, including its etag.

Finally, to start the process of parsing the file and importing it as a new version to a Speckle model one more graphql operation is required. Please make a POST request to /graphql with the mutation fileUploadMutations.startFileImport. This input should include the following:

  • projectId, the same value as used in the generateUploadUrl mutation before.
  • modelId. The imported version must be assigned to an existing Speckle model.
  • fileId. This can be any value which uniquely identifies the specific file which was uploaded. A hash of the file, or hash of pertinent metadata related to the file, or the etag would suffice.
  • etag. This is the value returned in the previous PUT request.

Congratulations! The file import will now start and begin the parsing of the file and creation of the new version of the specified Speckle model.

Instructions for self-hosters

These mutations are also available to self-hosters of the open source Speckle server. For the above-described method to work it requires the S3-compatible blob storage is accessible from the same network in which your users are accessing your speckle server from, which could be the public internet or corporate intranet. This may require adjustment of firewall rules around your S3-compatible blob storage. Before making your S3-compatible blob storage accessible from an external network we recommend a security audit. In particular, publicly-accessible buckets should be disabled.

This method also requires the blob storage to support pre-signed urls which most S3-compatible blob storage solutions should support.

Thirdly, the networking architecture of speckle server may require the blob storage to have a separate url when accessed from the public internet or corporate intranet compared to when accessed from a private network in which the server resides. This is likely the case if running speckle server and the blob storage in a Docker network. In this case we have provided an additional environment variable to the server which can be used for this; S3_PUBLIC_ENDPOINT is now available alongside the existing S3_ENDPOINT.

As always please post any questions and queries below. We will try to support you through this change.

5 Likes

OMG

What a feature. Uploading CAD/AEC Files.
Absolutely gorgeous.

I already noticed that IFC Upload was much more reliable and faster. Today I played with Speckle again for testing an IFC and noticed that beside the IFC Speckle also offered the DWG beside for upload. DWG, ok, great !

But now I read about all the other supported formats, for Point Clouds, 3D, 3D Printing and even DGN !

Ungrateful as I am, I will already place some wishes for later further format support :slight_smile:

USD, NWD, RVT and VWX :wink:

2 Likes

Hey @zoomer you need to follow our updates more :smiley:

Oh … that totally went under my radar.
But I am just a week behind.

Looks like I was a bit distracted by a few hardware failures and current typical Software Beta and Release cycles.

My favorites DGN, DWG, FBX and IFC

(But WTH is “*.X”, an Elon File ?)

Definitely not :grin:
It’s a direct x format… I think quite a legacy one (DirectX 9)

To be honest, I don’t think we have any use cases in mind with .x, and it’s one we may not keep… but due to us using Rhino.Inside to power many of these file formats, we get quite a few formats “for free” (or close enough)

1 Like

Wow, there are lots of file formats.
I like “Strickmuster”, you can activate complete new target groups for Speckle.

And POV-Ray.

BTW,
I tried to upload a DGN. It loaded and has a Model thumbnail in my Project.

But there is nothing in Viewer.

Will try the DWG version …

BTW 2,

is there a reason why the Viewer always orients Models to be viewed from north east (the back/ugly side) ? Each time I open a Model the first thing is to rotate it to south west …

If it’s possible for you to share the DGN file with me. I can take a look…

Sorry,
I had the same result with the DWG … until I noticed it just needed a little more time to convert/process …

Both are there perfectly fine :

Hmmhhh, but both only accessible or load into Viewer - when I open it from … Menu : “View Versions”

If I directly open by the Model Thumbnail from Project, i’ll always get this :

FBX works fine too (by View Versions workaround)

And back in Blender …

Unfortunately no (1 default only) Materials

I think I’ve seen this once or twice, where the progress bar doesn’t show. The model should eventually load…

If you can reliably reproduce, please let us know, it might help us determine where the problem lies.

The progress bar was every time there but white and made no progress. I also tried to let Speckle sit in case it will need some time to load but that did not seem to help either but maybe I did not wait long enough.

I am not 100% sure, but I thought I also tried to restart my Speckle Web App (Apples save website as App) ?

But what should I say … today, so far, it works like a charm …

Can you say when the old method (non-public S3) be removed completely for self-hosted servers?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.