Indus,
We should probably have another JIRA to have the InvokeHTTP processor
capture response headers and store them as flow file attributes or at
least as a single attribute with the headers on it - something.
However, the core need you have is totally doable. I'd recommend the
following flow:
GenerateFlowFile -> UpdateAttribute -> InvokeHTTP -> go do great
things with the content
In UpdateAttribute create a property called 'filename' and give it a value of
${now():format('MMddyyyy')}.zip
Then in the invoke HTTP use that for the expression language in the URL:
http://example.com/${filename}
Now you'll get your content and have retained the filename you used to pull it.
Thanks
Joe
On Wed, Sep 23, 2015 at 8:29 PM, indus well <[email protected]> wrote:
> Worked like a charm! Thank you for your quick response, Daryl and Mark.
>
> The content of the downloaded file is stored in the file generated FlowFile
> with a random filename, how would I rename the output file to actual
> downloaded filename?
>
> By the way, the ticket is a good enhancement.
>
> Thanks,
>
> Indus
>
> On Wed, Sep 23, 2015 at 8:27 PM, Mark Payne <[email protected]> wrote:
>>
>> Indus,
>>
>> As Daryl mentioned, InvokeHTTP will allow you to use the Expression
>> Language to do an HTTP GET.
>> It works a bit differently, though, because GetHTTP is a "Source
>> Processor" whereas InvokeHTTP needs to
>> be fed a FlowFile to do anything. So you can use GenerateFlowFile as a
>> source and have it generate a
>> 0 byte FlowFile (set the File Size property to "0 B"). Then just connect
>> GenerateFlowFile to InvokeHTTP.
>>
>> Having said that, it is a bit awkward to have to use a GenerateFlowFile to
>> trigger InvokeHTTP to run, so
>> I went ahead and created a ticket [1] to allow GetHTTP to evaluate the
>> Expression Language for the URL
>> property. In the meantime, though, GenerateFlowFile -> InvokeHTTP should
>> provide you with
>> the capability you're looking for.
>>
>> Thanks
>> -Mark
>>
>> [1] https://issues.apache.org/jira/browse/NIFI-993
>>
>> On Sep 23, 2015, at 9:14 PM, Daryl Teo <[email protected]> wrote:
>>
>> Indus - use InvokeHTTP
>>
>> Daryl
>>
>> On Thu, Sep 24, 2015 at 11:07 AM, indus well <[email protected]> wrote:
>>>
>>> Hello NiFi Experts:
>>>
>>> The GetHTTP processor works fine with static filename when getting files
>>> from a website. However, I have a use case where I need to download a file
>>> daily and the filename is the date of today, ie: 09222015.zip. Since the URL
>>> property of the GetHTTP does not support expression language, I cannot do
>>> something like http://example.com/${now():format('MMddyyyy')}.zip. Is there
>>> a way I can specify the filename dynamically? Or using other processor to
>>> make this work. Please advise.
>>>
>>> Thanks,
>>>
>>> Indus
>>
>>
>>
>>
>> --
>> Daryl Teo
>>
>> Tech Lead
>>
>>
>> <logo2.jpg>
>>
>> 122 Cremorne Street
>> Richmond VIC 3121
>> Australia
>>
>> T +61 (3)8669 1821
>> M +61 (0)432 413 752
>>
>> www.listcorp.com
>>
>> <stroke.png>
>>
>> This email (including any attachments) is confidential and may be
>> privileged. It may be read, copied and used only by the intended recipient.
>> If you have received it in error, please contact the sender immediately by
>> return email. Please then delete both emails and do not disclose their
>> contents to any person. We believe, but do not warrant, that this email and
>> any attachments are virus free. You should take full responsibility for
>> virus checking. Listcorp. reserves the right to monitor all email
>> communications. If the content of this email is personal or unconnected with
>> our business, we accept no liability or responsibility for it.
>>
>>
>