Ticket for Direct Embbedding problem

I’m using the Direct Embedding Ticket for a web application, it works flawlessly but after a few hours/days the Ticket changes, and so the API stops working.

Should I use the Backend Ticket or how can I avoid this issue?


Every time you go back to the embedding section, a new ticket is generate that you can use to embed your model. However, the old tickets generated the previous times you checked the embedding section keep working as well. You can use any of them indefinitely to access your model with the API.

In case that does not explain your issue, could you give me an example of a ticket you used to embed your model which stopped working in the meantime?

Do old tickets also work indefinitely to export outputs? As you mentioned, the model can be seen and modified by our API, but when we download the stl file it generates, we receive the following message:

{“error”:“SdSessionGoneError”,“desc”:“Session timed out”,“message”:“Session not found”}

The embedding ticket does not have a limited lifetime. However download links, which are generated in response to export requests, are bound to sessions and are therefore limited by the maximum lifetime of sessions, which is two hours. You can read more about this here.

In case you want to offer a download link to your customers which is valid for a longer period, please consider the following options:

  • Provide a link to a page which opens a new session, requests the export for the same parameter values, and presents the new download link to the user, or
  • download and save the exported file on your own backend system, and provide a link to it.

Hi, so i actually tried the second option, where i am trying to send the export link to backend and then store its content into a file and save it, but seems like the file stored do not open and gives error that the file can not be open, also the content of the file downloaded directly and file created by me are also not the same, im using php and here is what i did

 if($request->filled('link')) {

            $file = file_get_contents($request->link);
            $file_name = now()->format('YmdHi'). rand(12321, 45654664) . '.stl';
            file_put_contents(public_path('model-files/' . $file_name), $file);

I’m not an expert in PHP, but maybe the example shown here works better for you: PHP: stream_copy_to_stream - Manual

I actually tried it, and it not not giving any code error, but still when the file saves, and i open it, it says the file cannot be opened

here is my code

            $file_name = now()->format('YmdHi'). rand(12321, 45654664) . '.stl';
            $src = fopen($request->link, 'r');
            $dest = fopen('model-files/'.$file_name, 'w');
            stream_copy_to_stream($src, $dest);

where $request->link is the export link generated by shapediver

This will likely be a problem related to permissions of the file you are trying to read. This forum here is not about web development using PHP. However if you post precise details of the error message, your code, anything that allows to understand the problem, then someone here might be able to spot what’s wrong.