Page 2 of 2

Change URL Value for RSS Feed

Posted: Tue Apr 28, 2015 4:56 am
by Yurii Orishchuk

Hi Eric,

Here is a solution to change service URL in accordance to selected select item:

  1. Open "Storage and model" interface.

  2. Add "currentRSSUrl" storage with type "string" and storage - "local storage".
    Details: http://prntscr.com/6z14jp/direct

  3. Add "value change" event handler for needed select. And populate it with following JS code:

    pre

    //Hardcoded value for test.
    var url = "http://cvunews.wordpress.com/?tag=nordic&feed=rss2";

    //Get url from select. Uncoment this line of code when you populated select with URL values.
    //url = jQuery(this).val();

    localStorage.setItem("currentRSSUrl", url);

    /pre

  4. open your service.
    4.1. In settings tab use "{currentURL}" in URL field.
    Details: http://prntscr.com/6z15dj/direct
    4.2. Navigate to request tab. Open "Query String" sub tab. And add "currentURL" parameter.
    Details: http://prntscr.com/6z15q5/direct

  5. Open service datasource "before send" mapping.
    Details: http://prntscr.com/6z166r/direct

  6. In datasource make link from "currentRSSUrl" storage to "currentURL" request parameter.
    Details: http://prntscr.com/6z16k3/direct

  7. Invoke service without any parameters(like you did above) when you need.

    That's all.

    Regards.


Change URL Value for RSS Feed

Posted: Wed Apr 29, 2015 2:25 am
by Eric Van Buren

Thanks very much for the detailed response. I'm pretty sure I have everything set up correctly but it's still not working. Since the selectbox does not allow URL values, I changed the js code slightly and url value alerts correctly.

Is this the proper way to invoke the service?

var url = "https://cvunews.wordpress.com/" + jQuery(this).val() + "/feed/";

localStorage.setItem("currentRSSUrl", url);

CVUNewsService.execute();


Change URL Value for RSS Feed

Posted: Thu Apr 30, 2015 2:07 am
by Yurii Orishchuk

Hi Eric,

Please debug this implementation with console.log(); code.

For example to see what actually you have in you your URL processing you can use following JS code:

pre

var url = "https://cvunews.wordpress.com/" + jQuery(this).val() + "/feed/";

localStorage.setItem("currentRSSUrl", url);

console.log("url = " + url);

CVUNewsService.execute();

/pre

Then you can open browser debugger on network tab and take a look what URL requested with service.

Regards.


Change URL Value for RSS Feed

Posted: Sat Mar 18, 2017 11:36 pm
by Amelia Small

How did you add the "URL", "Method" and "Response Data Type" fields in the appery service?