Roger6240907
Posts: 0
Joined: Mon Sep 16, 2013 5:33 pm

httpget inside custom JS with FAcebook Publishing APIs

I am using the Facebook Publishing APIs. When I read the feed I would like to invoke a http get request to my server to modify the display status string.

This is the code in the plugin that works to display the status feeds:
code
var feedId = value.id,
feedMsg = value.story || value.message,
feedBtn = element.find('[name=feed_name]');

feedBtn.find('.ui-btn-text').text(feedMsg);
feedBtn.attr('data-id', feedId);
/code

feedMsg is the text of the status feed returned from the Facebook APIs. I need to make an httpget request to my server like:
code
var r=httpGet('http://myserver/getStatus/'+escape(feedMsg));
/code

I return a JSON object, the element 'status' contains the new string to display.

Thanks for your help,
Roger

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

httpget inside custom JS with FAcebook Publishing APIs

Hello,

Please try to use REST service instead of httpGet function. http://docs.appery.io/documentation/r...

Roger6240907
Posts: 0
Joined: Mon Sep 16, 2013 5:33 pm

httpget inside custom JS with FAcebook Publishing APIs

The problem is that I need to execute it for every item returned from the Facebook API. So I can call the REST from the custom JS, how can I update the correct UI element when each REST request returns its correct value?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

httpget inside custom JS with FAcebook Publishing APIs

You need to create REST get service and map service response to UI component. Then you can invoke this service from JS http://docs.appery.io/documentation/r... and it will update UI component.

Roger6240907
Posts: 0
Joined: Mon Sep 16, 2013 5:33 pm

httpget inside custom JS with FAcebook Publishing APIs

This is what I do with the Facebook APIs, have them mapped them to UI (this is phase 1 and it is working), now I need to invoke my REST service for each element returned by Facebook APIs. This is the question.

So to simplify I need to call 2 REST services in series, the first one maps to UI and return something like {'v':1; 'v':2, 'v':3} and by itself it will create 3 buttons labeled 1,2, and 3. This is working.
Now for each element of UI I want to call the second REST service that will take 1,2,3 and make 4,5, and 6 by executing 3 REST calls. This results in 3 buttons labeled 4,5 and 6. I hope this can clarify what I'm trying to do.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

httpget inside custom JS with FAcebook Publishing APIs

Hi Roger,

Not sure we fully understand what your need. Most probably, you should invoke service for each record within JavaScript code added to component mapping.

Return to “Issues”