Results for s3/store doesn't show even with results: true parameter

john's Avatar

john

08 May, 2014 07:34 AM

Hi guys,

I was wondering if there's a way to have the metadata (similar to s3/import) for the object for s3/store available from the results when using results:true ?

Currently it doesn't show even though I use results:true
It will also validate if the headers i set for s3 is successful

John

  1. Support Staff 1 Posted by Tim Koschützki on 08 May, 2014 07:42 AM

    Tim Koschützki's Avatar

    Hey John,

    the /s3/store robot (or other store robots) do not emit results. Instead, they just change the URL of the files in the steps that were piped into them.

    So if you have an /image/resize step, the result URL to an image would be http://tmp.transloadit.com/... If you pipe that into an /s3/store robot, the URL will be http://yourbucket.s3.amazonaws.com/... in the result JSON of your /image/resize step.

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  2. Support Staff 2 Posted by Tim Koschützki on 08 May, 2014 07:43 AM

    Tim Koschützki's Avatar

    Also please keep in mind that the parameter is named "result" and not "results".

  3. 3 Posted by john on 08 May, 2014 07:47 AM

    john's Avatar

    Hi Tim,

    Do you have a suggestion to get the metadata of the final file stored using s3/store?

    This is because I could run multiple processing steps. As the result returned is a hash, I would not be able to depend on the ordering by checking the last element.

    For me the simplest solution is to load that meta in s3/store step instead of storing the entire step sequence ..

    Any good suggestions?

    John

  4. Support Staff 4 Posted by Tim Koschützki on 08 May, 2014 07:50 AM

    Tim Koschützki's Avatar

    Hey John,

    I am not sure I fully understand. Can you please attach an assembly id?

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  5. 5 Posted by john on 08 May, 2014 08:00 AM

    john's Avatar

    An moot example would be 03227b40d68611e3abcb9790a8348e49

    {
      "steps": {
        "import": {
          "robot": "/s3/import"
        },
        "convert-thumbnail_photo": {
          "width": 200,
          "height": 200,
          "resize_strategy": "crop",
          "robot": "/image/resize"
        },
        "convert-thumbnail_smaller_photo": {
          "width": 100,
          "height": 100,
          "resize_strategy": "crop",
          "robot": "/image/resize"
        },
        "convert-thumbnail_smallest_photo": {
          "width": 50,
          "height": 50,
          "resize_strategy": "crop",
          "robot": "/image/resize"
        },
        "store-thumbnail": {
          "result": true,
          "robot": "/s3/store"
        }
      }
    

    As robot conversion steps could get complicated (eg filters, downsampling etc)
    I'm only interested in the file-metadata of the final stored file ... (steps inbetween are secondary)

    Returned results is a hash. (hence unordered)
    I would like to access it using the final store step
    result["store-thumbnail"] instead of remembering the last step run "convert-thumbnail_smallest_photo" because its dynamic. Only the final step is fixed as "store-thumbnail"

  6. Support Staff 6 Posted by Kevin van Zonne... on 08 May, 2014 01:53 PM

    Kevin van Zonneveld's Avatar

    Hi John,

    Thanks for the explanation. I think first of all, you should really use the use parameter. For instance:

    {
      "steps": {
        "import": {
          "robot": "/s3/import"
        },
        "convert-thumbnail_photo": {
          "use": "import",
          "width": 200,
          "height": 200,
          "resize_strategy": "crop",
          "robot": "/image/resize"
          "result": true,
        },
        "convert-thumbnail_smaller_photo": {
          "use": "import",
          "width": 100,
          "height": 100,
          "resize_strategy": "crop",
          "robot": "/image/resize"
          "result": true,
        },
        "convert-thumbnail_smallest_photo": {
          "use": "import",
          "width": 50,
          "height": 50,
          "resize_strategy": "crop",
          "robot": "/image/resize"
          "result": true,
        },
        "store-thumbnail": {
          "use": [
            "import",
            "convert-thumbnail_photo",
            "convert-thumbnail_smaller_photo",
            "convert-thumbnail_smallest_photo",
          ],
          "robot": "/s3/store"
        }
      }
    

    That should solve the ordering of the 'hash'. It's recommended you do this anyway for best results.

    I think you should then also be able to access all the metadata via code such as:

      for stepName, files of response.results
        console.log files[0].meta.video_codec
    

    Hope this helps!

    Best,
    Kevin

  7. 7 Posted by john on 09 May, 2014 04:34 AM

    john's Avatar

    Hi Kevin,

    Maybe i gave a really bad example. I meant that each step is to be chained (use previous step). And i'm only saving the final file.

    A better example would be
    Step 0 : S3/import
    Step 1 : Watermark
    Step 2 : Video Resize
    Step 3 : S3/store

    Programatically the each step chained are just added dynamically without being tracked..
    And i only want the metadata of the
    Step 0 : S3/import
    and
    Step 3 : S3/store

    response.results returns a Unordered Hash in ruby. Its ordering isn't reliable.

    I manage to get the original file metadata through the "import" results. However I was wondering if i can get the metadata from the "export" result?

  8. Support Staff 8 Posted by Tim Koschützki on 09 May, 2014 07:10 AM

    Tim Koschützki's Avatar

    Hey John,

    our store robots do not trigger results by themselves. The only thing that they do is they change the URL in the meta data of the steps that were passed into them.

    So if you examine the results of the Video Resize step, it will have all the meta data, and its "url" property will point to an URL on Amazon S3.

    Does this make sense? We know that this is a little confusing and we might change it in a future API version.

    I hope this sheds some light into this.

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  9. 9 Posted by john on 12 May, 2014 07:09 AM

    john's Avatar

    Hi Tim,

    its a little counter intuitive.. instead of modifying the metadata (url) of the previous step.
    Why don't you copy the previous metadata instead and change the url in the current s3/store step?

    That way it maintains atomicity and also context

    It is really confusing the way it works currently

    John

  10. Support Staff 10 Posted by Tim Koschützki on 12 May, 2014 11:34 AM

    Tim Koschützki's Avatar

    Hey John,

    yeah, we agree it's confusing, especially for newcomers to Transloadit. We'll talk to more customers about it and then may address it in future API changes.

    Thank you for your feedback!

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  11. 11 Posted by Tima on 20 Dec, 2014 07:38 PM

    Tima's Avatar

    Agree that store should output result.

    Example usecase scenario: allow to upload either image or video, use robot to process each, store gets input from either one or another,
    I want to be able to parse result[:store] for the url instead or trying both result[:image] and result[:video] - which would help as I process more and more files for storage.

  12. Support Staff 12 Posted by Tim Koschützki on 04 Feb, 2015 03:32 PM

    Tim Koschützki's Avatar

    Hey Tima,

    I am going to close this ticket for now. Feel free to reopen it by replying to it.
    We'll keep your feedback in mind as we design further API versions.

    Kind regards,
    Tim

    Co-Founder Transloadit
    @tim_kos

  13. Tim Koschützki closed this discussion on 04 Feb, 2015 03:32 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

20 Nov, 2016 02:52 AM
29 Oct, 2015 05:01 AM
27 Oct, 2015 05:01 AM
27 Oct, 2015 05:01 AM
26 Oct, 2015 05:03 AM

 

26 Oct, 2015 05:02 AM
26 Oct, 2015 05:02 AM
26 Oct, 2015 05:02 AM
26 Oct, 2015 05:02 AM
26 Oct, 2015 05:02 AM
26 Oct, 2015 05:01 AM