Replaying Assemblies

Archived from the Transloadit support forum. Originally posted on January 3, 2013; details may be outdated, see our docs for current behavior. Original thread

I’m having trouble properly replaying an assembly. This is my code…

$request = $transloadit->request(array(
            'method' => 'POST',
            'path' => "/assemblies/{$image->assembly_id}/replay",
            'reparse_template' => true
        ), false);

        $response = $request->execute();

But this alters my template by adding..

"assembly_replay_import_profile_image_0": {
      "robot": "/http/import",
      "url": "http://tmp.transloadit.com.s3.amazonaws.com/REDACTED.jpeg",
      "field": "profile_image"
    },

And replacing all of my references to :original with assembly_replay_import_profile_image_0. This makes sense, since I’m no longer uploading an image. I’m just confused about how I can influence the template upon triggering the replay so that I can inform the import robot where the file is actually located as opposed to it just assuming. Surely I don’t need to maintain two templates, right?

Chris

Hey Chris,

happy new year!

Nope you don’t need to maintain two templates.

Uploaded files (as in the :original step) are replaced via import steps, because you no longer upload any files. This of course only works if the files are still in our temporary bucket. If not, you can’t overwrite the import paths (yet).

Can you please tell me the id of the assembly that you’d like to replay?

I’d also like to point you to our newest addition of auto-replaying crashed assemblies: https://transloadit.com/blog/2013/01/improvements-for-how-assembly-crashes-are-handled

kind regards,
Tim

Co-Founder Transloadit
@tim_kos

That’s unfortunate, as the only reason I’d like to replay an assembly is because I have at a later date changed it’s template. For instance, I may now want that upload to have a different size.

What it sounds like I need to do is to update that template for any new uploads, and create a patch template for any previous uploads that used that template. That’s not ideal, but if you can confirm that’s my best option I’ll get on with it.

The assembly I had attempted to replay was…

Replaying: REDACTED
TransloaditResponse Object
(
    [data] => Array
        (
            [ok] => ASSEMBLY_REPLAYING
            [message] => The assembly is now in the process of being replayed.
            [success] => 1
        )

    [curlInfo] => Array
        (
            [url] => http://api2.transloadit.com/assemblies/REDACTED/replay
            [content_type] => text/plain; charset=utf-8
            [http_code] => 200
            [header_size] => 286
            [request_size] => 256
            [filetime] => -1
            [ssl_verify_result] => 0
            [redirect_count] => 0
            [total_time] => 1.442416
            [namelookup_time] => 0.694109
            [connect_time] => 0.735377
            [pretransfer_time] => 0.735392
            [size_upload] => 370
            [size_download] => 108
            [speed_download] => 74
            [speed_upload] => 256
            [download_content_length] => 108
            [upload_content_length] => 370
            [starttransfer_time] => 0.735612
            [redirect_time] => 0
            [certinfo] => Array
                (
                )

            [redirect_url] => 
        )

    [curlErrorNumber] => 0
    [curlErrorMessage] => 
)

You can also specify reparse_template => 1 to use your updated template when replaying an assembly that used the old version.

Closing this ticket for now. Feel free to reply to it (it will automatically reopen).

kind regards,
Tim

Co-Founder Transloadit
@tim_kos