Created on 06-01-2020 03:32 AM - edited 06-01-2020 04:25 AM
hi to everyone ...i want to pass the attribute in http invoked processor but the attribute which contain the date and time like 2020-06-01T09:47:59.946Z format....i want to subtract the present time with 10 min.-------
this expression i have seen in this community
${now():toNumber():minus(???):format('???')}
what i have to put in the place of question mark for 10 min minus ...60000?? and for
format 2020-06-01T09:47:59.946Z(+%FT%T.%3NZ if i use this i'll get error in format ) ..... and what processor i have to use...currently i m using updateAttribute for date format
thanks in advance
Created on 06-01-2020 05:12 AM - edited 06-01-2020 06:52 AM
@renuu Good morning, the Expression Language you are looking for to create an ISO format timestamp for 10 minutes ago is:
${now():minus(600000):format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "GMT")}
Processor Configuration:
FlowFile Output:
If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.
Thanks,
Steven @ DFHZ
Created 06-01-2020 06:25 AM
@renuu this should be the correct format for a $_GET request to the service:
https://localhost:8080/api/alarm?sort-by=from-date=${lastTime}
However, are you sure this is the correct Remote Url? I see maybe an issue with sort-by=from-date=... Maybe this should be sort-by=SomeValue&from-date=${lastTime}. I also suspect the dashes (-) in the variable names as this is not a good practice in variable naming.
What is the service you are trying to get the alarm from? If its private can you PM me the details.
There are 4 ways to pass data from NiFi to InvokeHttp:
Based on the service's requirements, you will need to handle invokeHttp to suit the requirements.
Created on 06-01-2020 06:49 AM - edited 06-01-2020 06:49 AM
@renuu just add more S....
${now():minus(600000):format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "GMT")}
I have updated the original snippet as well...
Created on 06-01-2020 05:12 AM - edited 06-01-2020 06:52 AM
@renuu Good morning, the Expression Language you are looking for to create an ISO format timestamp for 10 minutes ago is:
${now():minus(600000):format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "GMT")}
Processor Configuration:
FlowFile Output:
If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.
Thanks,
Steven @ DFHZ
Created 06-01-2020 06:12 AM
thanks for reply ....actually we want to send this timestamp in http processor to get all the alarm which came from this timestamp...can you please suggest how to pass this timestamp in http invoked processor end point....
here i have attached the snap ...i have first used generate flowfile processor after that in upadteAttribute processor i have calculate timestamp which you provide
lastTime= ${now():minus(600000):format("yyyy-MM-dd'T'HH:mm:ss'Z'", "GMT")}
and thanks this is working ...but now i want to pass this timestamp in http processor for get request ...i have used attributtojson that convert updateAttribut processor output i have used this bec when i connected updateAttribute to evaluatejsonpath processor this processor will give error ....that why i have to used this AtrributeTOjson then i have use evaluatejsonpath to extract timestamp as an attribute bec i have to send the http get request https://localhost:8080/api/alarm?sort-by=from-date=${lastTime} using this timestamp ...but i didn't get appropriate output ..i'll getting all alram
Created 06-01-2020 06:25 AM
@renuu this should be the correct format for a $_GET request to the service:
https://localhost:8080/api/alarm?sort-by=from-date=${lastTime}
However, are you sure this is the correct Remote Url? I see maybe an issue with sort-by=from-date=... Maybe this should be sort-by=SomeValue&from-date=${lastTime}. I also suspect the dashes (-) in the variable names as this is not a good practice in variable naming.
What is the service you are trying to get the alarm from? If its private can you PM me the details.
There are 4 ways to pass data from NiFi to InvokeHttp:
Based on the service's requirements, you will need to handle invokeHttp to suit the requirements.
Created 06-01-2020 06:43 AM
yes i got it ...i found it ....the problem in the date time format..could you please see on my further reply
Created on 06-01-2020 06:49 AM - edited 06-01-2020 06:49 AM
@renuu just add more S....
${now():minus(600000):format("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "GMT")}
I have updated the original snippet as well...
Created 06-01-2020 06:59 AM
big thank you to you @stevenmatison
Created 06-01-2020 06:39 AM
@stevenmatison the solution which you provide that give "lastTime":"2020-06-01T12:39:13Z"
but i want the format like this 2020-06-01T13:17:13.474Z
please see on yellow shed