I need to receive some data from an URL every 30 seconds.
I wanted to use camel and jetty:http for it. I found one problem - to get the data from URL i need to send post variables with login and password.
How to do this?
I've been looking for an example, but i didn't found anything.
Could you help me?
And additionally question:
if i want to make some action for every 30 seconds, my code should looks like this?
from("file:src/data?noop=true&delay=30000")
.to("file:src/new");
thanks for help
if you want post data through http component, you can using form_urlencoded content type:
from("direct:postTest")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader(Exchange.CONTENT_TYPE, constant(MediaType.APPLICATION_FORM_URLENCODED))
.setBody(simple("text=a&user=ethan"))
.to("http://someurl");
Related
Hello i am trying to get page level insights and post level insights in the same request but cant seem to get the syntax correct.
page id /published_posts?fields=permalink_url,created_time,message,shares,reactions.limit(0).summary(1),comments.limit(0).summary(1),insights.metric(post_reactions_by_type_total,post_impressions_unique,page_posts_impressions_organic)&since=yesterday
This is my request for now but i wanna add page insights like page_fans and page_fans_city.
How can i do that?
You are using the published_posts endpoint there already, you can not go back “up” to the page object from there. You need to rewrite the whole thing so that you use the page id itself as the basic endpoint, and then request everything else via the fields parameter. The trick is to get the syntax and nesting right …
/page-id?fields=insights.metric(page_fans,page_fans_city),published_posts{…}
should work, inside the {…} you then put all the original fields you requested from the published_posts endpoint before, so
/page-id?fields=insights.metric(page_fans,page_fans_city),published_posts{permalink_url,
created_time,…,insights.metric(post_reactions_by_type_total,post_impressions_unique,
page_posts_impressions_organic)}
And &since=yesterday then just goes at the end again, after all that.
To have the since limitation still apply on the post level, it apparently needs to be added on that “field” again, syntax similar to .metric():
?fields=…,published_posts.since(yesterday){…}
I'm working on validating a large amount of data. My Get request returns a JSON file with all of the information I need. My Put request needs to have all of that information, but also modify a few fields. Right now, I save all of the fields as separate environment variables, which are then pumped into the Put body.
Is there a quicker way of doing this, since I'm working with around ~100 different fields? Can I save the entire Get request in a single variable, which I then place in the Put? It hasn't worked so far, but I'm wondering if I'm missing something.
Nevermind, found the answer here https://github.com/postmanlabs/postman-app-support/issues/1825
I need to get the Page ID from the Page URL. This is NOT from inside a page tab, that's easy. This is similar to what is being done here: http://findmyfbid.com
Any help would be appreciated as I have been searching for over an hour! Bonus points for showing how to do this in classic ASP. I have no issue getting signed requests & parsing them, the URL to ID portion is what is throwing me.
thanks :)
As noted above in 1st answer commments, that does work, but it's not the data that we want since it's an external url. THIS is the correct way to do it:
https://graph.facebook.com/v2.5/cocacola?access_token=[yourtoken]
OR
This works too:
https://graph.facebook.com/v2.5/https://www.facebook.com/cocacola?access_token=[yourtoken]
This is the way to do it: https://developers.facebook.com/docs/graph-api/reference/v2.0/url
if you are using a GET request, be sure to append access_token=appid|appsecret to the URL you are requesting and it will work.
Thanks for the tip to point me in the correct direction Alex!
I have a question. For a rest service API designing, we can have a post method with parameters. There are four places to put my parameters.
1, we can pass it as URI template, I think if the variable is a resource, we have to put it there.
2, we can put it to the header of the request, I guess "version" is a good choice.
3, we can put it to the post request body, I mean the real parameters we want to execute the method on server.
4, we can put it as a query string, such as /sample.com/orders?id=1025.
In my mind, the post and put is not suggest to put parameters in the query string as my fourth point indicated, I cannot remember where I got that, or I might misunderstand it. Please correct me if I'm wrong, and let me know how do you think about this.
Thanks,
I think I already figureout what I asked. Here is a related post, please refer that if anymore needs it.
Do HTTP POST methods send data as a QueryString?
Thanks,
I'm trying to use the Yummly API. I've noticed that some of their developers have answered other questions here, so I'm hoping to catch their eye. I used the documentation at the yummly developer site https://developer.yummly.com/documentation#IDs.
Specifically here is my get request:
<http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039>
Which returns this:
Please include X-Yummly-App-ID and X-Yummly-App-Key
Seems like this is a sensible thing, except that I don't see anywhere in the documentation for the single recipe call where I'm supposed to insert that info. Any one out there know how to properly format this?
or include them as URL parameters:
_app_id=app-id&_app_key=app-key
https://developer.yummly.com/documentation#IDs
Try this:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
You need to take the URL you mentioned in the question and add your authentication parameters to it. So it becomes:
http://api.yummly.com/v1/api/recipe/Avocado-cream-pasta-sauce-recipe-306039?_app_id=ID&_app_key=KEY
Instead of ID and KEY insert the application id and key from your account on developer.yummly.com